Repository navigation
feat(root): support atomic creation and required file flushing - #486
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: needs real behavior proof before merge. Reviewed September 18, 2026, 4:52 PM ET / 20:52 UTC (Revision 3). ClawSweeper reviewWhat this changesAdds optional atomic buffered creation and required file flushing, with shared cleanup reporting and stronger checks before publishing files. Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this remains useful work absent from main and the latest release. No actionable patch defect was found, but the previously requested inspectable runtime proof remains outstanding. Priority: P2 Review scores
Verification
How this fits togetherRoot is fs-safe’s filesystem capability for handling untrusted relative paths. Its guarded writers turn buffers, JSON, or streams into files while checking filesystem identity and caller authority. flowchart TD
A[Buffer or JSON input] --> B[Root creation options]
B --> C{Atomic publication requested}
C -->|No| D[Existing buffered writer]
C -->|Yes| E[Complete staged file]
E --> F[Authority and identity checks]
F --> G[Exclusive publication]
G --> H[File or settlement error]
Before merge
Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Retain the opt-in guarantees through shared guarded writers, with auditable filesystem evidence for complete publication and strict file flushing. Do we have a high-confidence way to reproduce the issue? Not applicable: this adds explicit creation guarantees; main and release source establish that these options are currently absent. Is this the best way to solve the issue? Yes: extending existing guarded staging and preserving defaults is a focused approach consistent with the direction described in #482. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 880372e0ed74. LabelsLabel 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
History |
5d0d8f0 to
476c36c
Compare
What Problem This Solves
Consumers that seed files need exclusive creation that keeps incomplete content invisible, even without the native addon, and an explicit way to require file flushing.
User Impact
Root.create()andcreateJson()now acceptatomic: truefor complete-content publication anddurable: "file"to require successful file fsync. Streamed creation remains staged. Existing buffered defaults and boolean durability behavior remain compatible.The JavaScript atomic fallback requires same-volume hardlinks. Directory synchronization remains best effort. Errors can follow complete publication; cleanup and publication receipts preserve that distinction.
Why This Change Was Made
Reuse the existing staging and no-clobber publication owners, with shared settlement that retains operation, cleanup, and close failures. Final authority callbacks are followed by descriptor and pathname identity checks before publication. This also preserves complete published files when later mode, sync, or verification work fails.
Related: #482
Evidence
Full
pnpm check: 13,348 tests passed, 586 skipped; package imports, declarations, documentation examples, and Python protocol checks passed.Real macOS filesystem proof through the compiled public APIs in native
offandrequiremodes: atomic buffer/JSON creation, required file flushing, existing-entry preservation, and independent-process publication observers.Regression probes reproduced callback-driven stage replacement on both native publication paths before the fix and pass afterward.
Fresh Linux VM: native/WASM build, 267 focused tests, npm/pnpm package smoke with normal and omitted optional dependencies, then a separate installed public-API probe in native
offandrequiremodes. Complete 700,018-byte payloads and JSON round-trips passed; independent 1 MiB create races produced one complete single-link winner. This used91bf3e7; later changes affect test fixtures and upstream docs only.The macOS installed npm/pnpm package checks passed with and without the addon. Full Bun native suite: 1,048 passed, 46 skipped.
CI exposed two fixture issues: binding initialization during Windows emulation, and Windows refusing a parent rename with an open child. The fixtures now install the binding before Root construction and replace the empty parent before stage creation. Removing the parent identity fence demonstrably makes the repaired test fail; all original assertions remain.
Independent reviews found no actionable P0–P2 issues. Final head
476c36chas 31 successful checks and no failures: CI, coverage, and public mutation proof.Tests added or updated when behavior changed
Security and compatibility impact considered
CHANGELOG.mdupdated when release-relevantNo credentials, private paths, private hosts, or sensitive contents included