Repository navigation
fix(write): align Windows create-on-directory errors and document final-link modes - #745
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. |
|
Codex review: blocked before merge. Reviewed September 28, 2026, 1:41 AM ET / 05:41 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch changes Root create-only writes to report an existing directory as Merge readiness⛔ Blocked before merge - 4 items remain Current main still returns the wrong error for create-only writes to an existing directory, so this focused PR remains useful. Its Windows link documentation also changes how a public policy guarantee is described and needs an explicit maintainer decision. Priority: P2 Review scores
Verification
How this fits togetherRoot receives a caller's path, write options, and data, then checks the path and policy before selecting a pinned or legacy writer. The admission step determines whether creation proceeds or returns an error without changing an existing destination. flowchart LR
A[Create-only request] --> B[Root path and policy checks]
B --> C{Existing target}
C -->|File or directory| D[Already exists error]
C -->|Other type| E[Not file error]
C -->|Missing| F[Pinned or legacy writer]
F --> G[New file]
Decision needed
Why: The observed native and legacy behavior differs under an existing public policy promise; choosing the supported security and compatibility contract requires maintainer intent. Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep create-only collision errors consistent across backends, preserve existing confinement and legacy authorization checks, and publish a maintainer-approved Windows link contract with a concise release note. Do we have a high-confidence way to reproduce the issue? Yes. The submitted baseline replay reports Is this the best way to solve the issue? Yes for the create-only defect: the branch changes the narrow collision preflight and verifies unchanged destinations. The long-term Windows link contract still needs a maintainer decision. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 85474b5e9cb5. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
create("existingDirectory", ...)must reportalready-exists:docs/errors.mdexplicitly includes an existing file or directory, and the writing guide promises that code when the target exists. Windows legacy buffered creation already honors that contract; the shared pinned preflight incorrectly returnednot-file. Admit directories only to the existing collision rejection, preserving non-regular type, hardlink, boundary and policy checks. No destination is opened or changed.Add a public differential replay covering eight create-only variants in separate off/auto/require processes, and compare their error code/category and unchanged directory contents. The replay also records Windows final-link and parent-junction behavior for omitted policy, explicit rejection and rename-identity compatibility. Run it under both Node and Bun in native CI, including
windows-latestandwindows-2022. Existing Windows legacy target-reauthorization tests remain unchanged.The writing/security/native documentation now states the actual Windows modes. With omitted
mutationSymlinks, the native pinned writer rejects a final link (path-alias) and parent junctions can fail withinvalid-path; the legacy JS writer can use an unchanged contained final-link target or an admitted parent-junction target. ExplicitmutationSymlinks: "reject"supplies uniform rejection.Contract finding for coordinator decision: the previous unqualified “omitting preserves existing behavior” language and native guide's “public policy does not change with the selected mechanism” promise do not describe those existing differences. Read as cross-implementation guarantees, native rejection is the divergence from the established Windows legacy contract. This PR documents current results and leaves native behavior unchanged; it does not settle whether a future native path should honor that legacy behavior.
Validation:
a386202bcbaf0229397df7dc37ddc673f8e2ef34:node scripts/root-create-directory-proof.mjs offfails because it receivesnot-fileinstead of documentedalready-exists.node scripts/root-create-directory-proof.mjsandbun scripts/root-create-directory-proof.mjs: all eight create variants agree in off/auto/require (48 local mode/runtime cases).pnpm test test/root-create-directory-differential.test.ts test/root-create-only-preflight.test.ts test/root-windows-legacy-policy-boundaries.test.ts --maxWorkers=1: 4 passed, 13 Windows-only skips on the macOS host.pnpm docs:check,git diff --check, independent Codex P2 review: passed.pnpm checkstops at the known Homebrew Rust WASM-target mismatch; the approved packaged WASM asset was used for local focused tests. Exact-head hosted CI and coverage are green at0939ed36393688d5b39ac5cb4aeb2a49cb639394. Both Windows latest and Windows 2022 native jobs passed the Node and Bun differential replay steps, including the documented link modes.Supersedes the rejected blanket-admission candidate #741, now closed with its branch retained. No changelog edit for this bug-hunt round. Do not merge; coordinator review and landing remain separate.