fix(atomic): close descriptor mode gaps - #100
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 7:37 PM ET / 23:37 UTC. ClawSweeper reviewWhat this changesThe PR keeps synchronous atomic parent validation active without Merge readiness⛔ Blocked until real behavior proof is added - 4 items remain This PR is still necessary: current Priority: P2 Review scores
Verification
How this fits togetherThe atomic replacement subsystem stages a file, verifies the target parent, then publishes the replacement by rename or a guarded copy fallback. It is used by higher-level safe writes, so its descriptor identity checks, modes, and durability behavior affect filesystem confinement and persisted-file correctness. flowchart LR
Request[Atomic replacement request] --> Parent[Create and verify parent directory]
Parent --> Stage[Write staged file by descriptor]
Stage --> Publish[Rename or guarded copy fallback]
Publish --> Mode[Apply destination mode by descriptor]
Mode --> Durable[Sync file and parent when requested]
Durable --> Result[Constrained published file]
Decision needed
Why: The safe fix requires either accepting an explicit availability limitation or choosing a new descriptor-relative creation design; source review cannot select that security and compatibility tradeoff. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain descriptor-bound mode and identity handling, land this narrow hardening only after redacted runtime proof is attached and maintainers explicitly accept the fail-closed Do we have a high-confidence way to reproduce the issue? Yes for the addressed paths: the added tests define current source-level reproductions for missing synchronous parent validation, fallback mode ordering, and mode restoration. The Is this the best way to solve the issue? Unclear: descriptor-bound validation and mode application are the safest repair direction, but maintainers must decide whether the documented fail-closed AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9bb846538fa5. LabelsLabel 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 (1 earlier review cycle)
|
Summary
fchmodSyncchmodorchmodSyncmethodsThe audit also expands exact-mode coverage across umasks
000,022,077, and777, verifies present and missingpreserveExistingModedestinations for async and sync calls, counts descriptors after a forced fallback-mode failure, and documents the Windows staged-directory mode caveat.Verification
pnpm checkpnpm test:securitygit diff --checkEscalated limitation
With a POSIX process umask of
0777, a newly created directory lands as mode000and cannot be reopened for descriptor-bound mode application. This affects new atomic parent directories and staged directory move fallback. This PR does not reintroduce pathnamechmodor mutate the process-wide umask; resolving that case safely needs an explicit design decision or a descriptor-relative creation primitive.