Skip to content

fix(root): align Windows buffered destination admission - #741

Closed
steipete wants to merge 1 commit into
mainfrom
codex/fix-windows-buffered-leaf-admission-20260927
Closed

steipete wants to merge 1 commit into
mainfrom
codex/fix-windows-buffered-leaf-admission-20260927

Conversation

@steipete

@steipete steipete commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Held draft — do not land. Exact-head Windows CI establishes a legacy compatibility contract that this candidate breaks. Keep this PR for the coordinator's decision; it is not a completed fix.

The differential repro is real: native-off buffered Root.write() follows an unchanged contained final symlink, while the pinned/native path rejects it. However, docs/security-model.md promises that omitting mutationSymlinks preserves existing mutation behavior, and test/root-windows-legacy-policy-boundaries.test.ts explicitly verifies both successful legacy final-link publication and reauthorization of its target before staging/publication. This candidate's new preflight rejects before those established checks. It therefore cannot ship as a blanket admission change.

The same investigation also found that Windows native-off create() on an existing directory reports already-exists, while the pinned path reports not-file. That error-classification difference can be addressed independently. The recommended follow-up is to narrow the implementation change to exclusive-create classification and clarify the legacy Windows exceptions in the native/error documentation, preserving the established final-link checks.

Evidence at c941ba10da306c612512bf39a4f2ecc507c6d3cb:

  • Windows AWS Crabbox cbx_b05521aceb1c, Node 24.21.0 / Bun 1.4.2, identical published 0.21.0 native binding: one-call repros and before/after snapshots; new regression suite 4 failures before, all passing after. Focused Windows suites: 118 passed, 2 skips. Those focused suites did not include the legacy policy-boundary suite.
  • Linux focused suites: 64 passed, 56 platform skips. Full pnpm check: 16,550 passed; package/docs checks passed.
  • Independent Codex P2 review and git diff --check passed, but do not override the later compatibility failures.
  • Windows native CI fails three existing legacy policy-boundary cases: both original-target reauthorization cases expect denied-path, and unchanged final-link publication must succeed. The candidate instead returns path-alias.
  • Windows public mutation proof also fails. Other hosted lanes remain recorded on this head; this PR is not CI green.

No changelog edit and no merge. Stopped at the compatibility gate under the bug-hunt escape-hatch instruction; do not remove or weaken the failing boundary assertions to make this candidate pass.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 27, 2026, 10:58 PM ET / September 28, 2026, 02:58 UTC (Revision 3).

ClawSweeper review

What this changes

The branch adds a destination check before buffered Windows Root writes use the JavaScript fallback, shares that check with pinned writes, and adds error guidance and regression tests.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 9 items remain

Keep this held draft open. Current main still has the Windows create-only directory error discrepancy, but the submitted broader change breaks the documented legacy final-link behavior. The PR body reports three failures in the existing Windows policy suite on this head.

Priority: P2
Reviewed head: c941ba10da306c612512bf39a4f2ecc507c6d3cb
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused Windows behavior evidence is useful, but the introduced preflight fails established compatibility tests and blocks this patch from landing.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR reports before-and-after public Root write and create calls through the changed Windows buffered path on real Node and Bun setups, with improved final-link rejection and directory classification. That focused proof did not cover the legacy policy suite, whose later Windows CI failures establish a separate patch defect. No stored-data contract changes.
Patch quality 🧂 unranked krab (1/6) 3 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR reports before-and-after public Root write and create calls through the changed Windows buffered path on real Node and Bun setups, with improved final-link rejection and directory classification. That focused proof did not cover the legacy policy suite, whose later Windows CI failures establish a separate patch defect. No stored-data contract changes.
Evidence reviewed 8 items Introduced Windows preflight: The introduced hunk resolves and inspects the destination before entering the buffered Windows fallback; an existing final symlink is rejected as path-alias.
Established Windows behavior: The existing policy-boundary suite expects an unchanged contained final link to publish successfully and a redirected target to be denied during later authorization checks.
Documented compatibility contract: Omitting mutationSymlinks preserves existing mutation behavior; the explicit policies reject final symlinks.
Findings 3 actionable findings [P1] Preserve legacy final-link writes in the Windows fallback
[P3] Align the error-code reference with directory admission
[P3] Record the public behavior change under Unreleased
Security None None.

How this fits together

Root confines caller-supplied file paths to a directory. Buffered write and create calls resolve a destination, check its state, then publish through a native or guarded JavaScript writer.

flowchart LR
  A[Caller path and data] --> B[Root write or create]
  B --> C[Resolve inside root]
  C --> D[Windows destination check]
  D --> E{Destination admitted?}
  E -->|Yes| F[Guarded publication]
  E -->|No| G[Typed error]
  F --> H[Updated file]
Loading

Decision needed

Question Recommendation
Should Windows buffered writes without an explicit mutationSymlinks policy retain successful publication through an unchanged contained final link? Preserve legacy behavior: Keep the existing final-link authorization path and narrow this PR to the create-only directory error discrepancy.

Why: Current documentation and regression tests establish that compatibility behavior; replacing it with unconditional rejection changes a public filesystem contract.

Before merge

  • Preserve legacy final-link writes in the Windows fallback (P1) - This preflight rejects an existing final symlink before the fallback can reauthorize its target. With mutationSymlinks omitted, the documented behavior and existing Windows tests require an unchanged contained link to publish and a redirected target to receive denied-path; the PR reports three exact-head failures. Narrow the check to the create-only directory case or obtain an explicit breaking-contract decision.
  • Align the error-code reference with directory admission (P3) - The added paragraph promises not-file for a create-only directory target, but the error table and Root guidance describe already-exists for an existing target. Reconcile the public guidance after the intended compatibility behavior is settled.
  • Record the public behavior change under Unreleased (P3) - A narrowed fix would still change a public Windows error classification. Repository policy calls for a concise Unreleased entry for that user-visible compatibility change before landing.
  • Resolve merge risk (P2) - Existing Windows fallback callers that write through an unchanged contained final symlink would receive path-alias instead of the documented legacy behavior; the exact-head Windows policy suite reports three failures.
  • Resolve merge risk (P2) - Windows fallback create-only callers targeting a directory would receive a different public error code, while the current error reference and Root guidance still describe already-exists.
  • Complete next step (P2) - Resolve the Windows legacy final-link contract, repair the preflight accordingly, then align the public error guidance and Unreleased note before merge.
  • Improve patch quality - Preserve the legacy final-link path and add coverage that runs alongside the existing Windows policy-boundary suite.
  • Improve patch quality - Reconcile error guidance and add an Unreleased entry for the final narrowed behavior.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [P1] Preserve legacy final-link writes in the Windows fallback — src/root-impl.ts:1069
  • [P3] Align the error-code reference with directory admission — docs/errors.md:49-52
  • [P3] Record the public behavior change under Unreleased — docs/errors.md:49-52
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Code and coverage delta production +14 net lines, tests +65 lines, docs +5 lines The production growth is focused, but the added tests omit the established Windows legacy-policy cases.

Merge-risk options

Maintainer options:

  1. Narrow the Windows repair (recommended)
    Remove the blanket final-link preflight, retain legacy reauthorization, and fix the create-only directory classification with focused coverage.
  2. Accept a breaking contract
    Explicitly approve strict final-link rejection and document how existing Windows callers must change their paths or policy.

Technical review

Best possible solution:

Preserve legacy final-link reauthorization, narrow the repair to create-only directory classification, clarify the Windows native and fallback error contract, and record the user-visible change under Unreleased.

Do we have a high-confidence way to reproduce the issue?

Yes. Public Windows Root calls, the existing legacy-policy tests, and the reported before-and-after run give concrete paths for both the original discrepancy and this PR's regression; this read-only review did not execute them.

Is this the best way to solve the issue?

No. The blanket final-link check contradicts the existing legacy contract; a narrower create-only error repair preserves the guarded publication path.

Full review comments:

  • [P1] Preserve legacy final-link writes in the Windows fallback — src/root-impl.ts:1069
    This preflight rejects an existing final symlink before the fallback can reauthorize its target. With mutationSymlinks omitted, the documented behavior and existing Windows tests require an unchanged contained link to publish and a redirected target to receive denied-path; the PR reports three exact-head failures. Narrow the check to the create-only directory case or obtain an explicit breaking-contract decision.
    Confidence: 0.97
  • [P3] Align the error-code reference with directory admission — docs/errors.md:49-52
    The added paragraph promises not-file for a create-only directory target, but the error table and Root guidance describe already-exists for an existing target. Reconcile the public guidance after the intended compatibility behavior is settled.
    Confidence: 0.97
  • [P3] Record the public behavior change under Unreleased — docs/errors.md:49-52
    A narrowed fix would still change a public Windows error classification. Repository policy calls for a concise Unreleased entry for that user-visible compatibility change before landing.
    Confidence: 0.91

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a386202bcbaf.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded Windows Root compatibility defect with a concrete remaining directory-error repair.
  • merge-risk: 🚨 compatibility: The introduced preflight changes successful legacy writes and a public create-only error code for Windows fallback callers.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🐚 platinum hermit and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The PR reports before-and-after public Root write and create calls through the changed Windows buffered path on real Node and Bun setups, with improved final-link rejection and directory classification. That focused proof did not cover the legacy policy suite, whose later Windows CI failures establish a separate patch defect. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR reports before-and-after public Root write and create calls through the changed Windows buffered path on real Node and Bun setups, with improved final-link rejection and directory classification. That focused proof did not cover the legacy policy suite, whose later Windows CI failures establish a separate patch defect. No stored-data contract changes.

Evidence

What I checked:

  • Introduced Windows preflight: The introduced hunk resolves and inspects the destination before entering the buffered Windows fallback; an existing final symlink is rejected as path-alias. (src/root-impl.ts:1069, c941ba10da30)
  • Established Windows behavior: The existing policy-boundary suite expects an unchanged contained final link to publish successfully and a redirected target to be denied during later authorization checks. (test/root-windows-legacy-policy-boundaries.test.ts:235, c941ba10da30)
  • Documented compatibility contract: Omitting mutationSymlinks preserves existing mutation behavior; the explicit policies reject final symlinks. (docs/security-model.md:152, c941ba10da30)
  • Exact-head Windows failures: The PR body reports that Windows native CI fails three legacy policy cases: two expect denied-path after target reauthorization, and one expects unchanged final-link publication. The candidate instead returns path-alias. The supplied check state confirms failing Windows lanes; raw hosted logs were unavailable for this review. (c941ba10da30)
  • Windows behavior proof: The PR reports before-and-after public Root calls on Windows Node 24 and Bun using Crabbox cbx_b05521aceb1c: the new focused cases pass after the change. Those focused runs omitted the legacy policy suite that later failed. (test/root-buffered-write-leaf-admission.test.ts:23, c941ba10da30)
  • Current main and release boundary: Current main and v0.21.1 enter the Windows buffered fallback without this destination preflight. The PR head is not an ancestor of the fetched main, so the proposed behavior is not implemented there. (src/root-impl.ts:1060, a386202bcbaf)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-28T02:44:30.301Z sha c941ba1 :: blocked before merge. :: [P3] Make the error-code reference agree with directory admission | [P3] Record the public behavior change under Unreleased
  • reviewed 2026-09-28T02:49:02.617Z sha c941ba1 :: blocked before merge. :: [P3] Align the error-code reference with directory admission | [P3] Record the behavior change under Unreleased

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 28, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Closing this candidate because blanket final-link rejection would break the documented Windows legacy contract for omitted mutationSymlinks and its target-reauthorization boundary tests. Superseded by a narrower follow-up for create-on-directory error consistency and documentation of final-link/parent-junction modes; native link behavior will remain unchanged. The branch is retained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant