Repository navigation
fix(tests): make CLI config mode test pass on Windows - #3870
Irish-Joseph wants to merge 2 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
@Irish-Joseph is attempting to deploy a commit to the OpenClaw Foundation Team on Vercel. A member of the Team first needs to authorize it. |
|
Codex review: needs maintainer review before merge. What this changesThis PR makes the CLI config permission test use a host-native temporary path and adds a changelog entry. Example: A Windows contributor runs the config permission tests on drive D.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: current main still contains the Windows-incompatible fixture, and this focused correction has no blocking findings. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe CLI config writer receives registry and token values, resolves the configured file path, and writes restricted config files; this PR changes its mocked filesystem test fixture. flowchart TD
A[CLI login] --> B[Config writer]
C[Config permission test] --> B
D[Host temporary directory] --> C
B --> E[Path resolution]
E --> F[Filesystem operations]
Technical reviewBest possible solution: Use the host-native fixture and derived directory expectation while retaining all existing permission assertions. Do we have a high-confidence way to reproduce the issue? Source confirms that host-native resolve and dirname cannot match the literal POSIX expectations on Windows; the contributor also supplies before-and-after Windows results, which this read-only review did not rerun. Is this the best way to solve the issue? This is the best fix location: normalize the fixture rather than skip Windows coverage or change correct production path resolution. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0bf64843c697. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (70 earlier review cycles; latest 8 shown)
Reviewed October 14, 2026, 9:34 AM ET / 13:34 UTC (Revision 71). |
|
Verification summary for maintainers (run against the current head, including the import-ordering cleanup):
The only red badge is the Vercel preview-deploy status ("Authorization required to deploy"), which needs a team-member authorization click; no test or CI job is failing. Happy to make any further adjustments. |
CI workflow replication (Linux)The queued
Could a maintainer approve the queued workflow runs on this PR (GitHub Actions → |
|
Status note while the re-review verdict is pending delivery: the description contains the full evidence — before/after unit results for |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
CI replication now covers the remaining two workflow jobs as well, in the same ubuntu:24.04 container against this branch head: |
|
This pull request has been automatically marked as stale due to inactivity. |
What Problem This Solves
Fixes:
packages/clawhub/src/config.test.ts> "writes config with restricted modes" fails on Windows, blocking Windows-based contributors from a green CLI test baseline.User Impact
No user-visible change. The
writeGlobalConfigpermission tests now pass on Windows in addition to Linux.Why This Change Was Made
The test stubs
process.platformtolinux(which correctly drives the chmod branch), but the fixture path was the POSIX literal/tmp/clawhub-config-test/config.json.writeGlobalConfigrunsresolve()on that override, which on Windows re-renders it with a drive prefix and backslashes (D:\tmp\clawhub-config-test\config.json), so themkdirassertion against the literal/tmp/clawhub-config-testnever matched. The fixture is now built fromtmpdir()withresolve(), and themkdirexpectation is derived fromdirname()of the same fixture path — the assertions still verify the exact same behavior (0o700 dir, 0o600 file, explicit chmod) on every platform.Evidence
Real behavior: built CLI writing the global config (real
clawhub login --token)The unit test documents
writeGlobalConfig's permission behavior; the same code path exercised through the real built CLI:Linux (ubuntu 24.04, Node 24, built CLI from this branch) — fresh config dir is created
0o700, the file0o600:Pre-existing world-readable config file is re-chmodded to
0o600on login (thechmodbranch for existing files):Windows (same built CLI, same command shape) — the config file is written; the POSIX mode assertions are Linux-only by design (
process.platform !== "win32"guards thechmod):(Runs against a local registry emulator; no public registry or real credentials involved.)
main):config.test.ts→ 2 passed / 1 failed (mkdir expected/tmp/clawhub-config-test, receivedD:\tmp\clawhub-config-test).bunx vitest run -c vitest.config.ts src/config.test.ts→ 3 passed (3).packages/clawhubsource suite on the same host: 108 failed / 353 passed vs 109 failed / 352 passed on unmodifiedmain; the delta is exactly this test.resolve(join(tmpdir(), …))yields the same kind of absolute POSIX path the literal did, and the expectations are derived from the same variable.bun run ci:staticpasses.CIworkflow):static,packages,types-build,e2e-httpall pass;unit(7,311 tests) has only 4 pre-existing timing flakes that fail identically on unmodifiedmainin the same environment. (The PR's queued GitHubCIrun is awaiting first-time-contributor approval.)tsc -p packages/clawhub --noEmit,oxlint --type-aware,oxfmt --checkall clean on the touched files.