Skip to content

fix(durability): preserve exact directory pin identities - #483

Merged
steipete merged 6 commits into
mainfrom
codex/directory-pin-exact-identity-20260918
Sep 18, 2026
Merged

steipete merged 6 commits into
mainfrom
codex/directory-pin-exact-identity-20260918

Conversation

@steipete

@steipete steipete commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Directory pins could report assertCurrent() or sync() success after pathname replacement when distinct inode values rounded to the same JavaScript Number, or Windows returned unknown zero identity components. The retained descriptor still referred to the original directory, so success could misrepresent the directory currently at the pathname.

Keep exact bigint identities and immutable path facts as private receipt authority. Public numeric Stats metadata comes from the same observation, remains independently mutable, and cannot change retained authority or metadata. New admissions validate supplied path and identity fields; top-level receipt fields are checked before pathname alias handling, preventing raw string-method errors for incomplete inputs. Publication, staging, durable creation, and synchronous store writes preserve exact provenance. Store durability reuses its already-admitted parent observation without rereading or readmitting the pathname.

Descriptor/path checks reject known mismatches immediately and allow one retry for unknown Windows components. A preflight mismatch never flushes the descriptor; replacement discovered after a flush still rejects. Public DirectoryReceipt.identity keeps its numeric Stats shape and methods. Unsafe reconstructed numeric identities fail closed; callers can retain the original library receipt/identity object or use bigint expectedExistingIdentity. Documentation and Unreleased notes describe this boundary.

Validation on final head 4090e17954aae1e6602472f113360467dbd79215, including integration with atomic buffered creation from #486:

  • Native-enabled pnpm check: 13,393 tests passed, 586 skipped; 530 passed test files and 22 skipped. Build, lint, documentation examples, package/API checks, and whitespace checks passed.
  • Focused interaction tests: 241/241 on each of Node 22.23.2 and Node 24.21.0, zero skips.
  • All 24 required checks passed on this exact head, including cross-platform and normal/optional-free installed-package checks.
  • Current-head FAT32 delta: 44/44 outcomes across Node 22/24, comprising 40 FAT32 cases and four hardlink-capable missing-auto controls; 40 collision-preservation checks. Complete publications and expected indeterminate/preserved/closed stages were verified, including complete stage contents and closed descriptors. Physical optional-free consumers matched all 856 installed package files and loaded no addon. Provider: AWS Crabbox, c7a.4xlarge, 16 vCPU; lease released.
  • Final integration AutoReview: both passes scoped-clean through P2.
  • Regression coverage includes real POSIX directory replacement, an A–B–A metadata race, caller-mutated receipts, unknown/wide Windows identities, and refusal before opening or flushing. Windows store tests inject exact-identity drift because the open descendant prevents the physical directory rename used by the POSIX fixture.

Additional earlier-candidate evidence includes the 847-scenario method smoke, 210 FAT32 outcomes, and 38 optional-free archive outcomes. These are historical coverage evidence; their package hashes are not claimed to identify this final head. The method smoke is not a performance comparison.

@steipete
steipete requested a review from a team as a code owner September 18, 2026 19:18
@clawsweeper

clawsweeper Bot commented Sep 18, 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 18, 2026, 5:22 PM ET / 21:22 UTC (Revision 5).

ClawSweeper review

What this changes

The PR preserves exact directory identities across durability checks, publication, staging, and synchronous store writes while retaining mutable numeric metadata for callers.

Merge readiness

⛔ Blocked before merge - 4 items remain

This fix remains necessary: main and v0.15.0 still compare numeric directory identities. No introduced correctness defect was found, but the prior runtime-proof and compatibility-acceptance blockers remain.

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

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation is focused and extensively covered, but the reported real runs lack inspectable behavior output.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: The reported Linux FAT32 runs provide useful real-setup context, but aggregate outcomes do not expose the directory-pin path rejecting replacement before flushing or demonstrate original-receipt reuse and bigint migration; inspected fault-injection tests remain supplemental. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The reported Linux FAT32 runs provide useful real-setup context, but aggregate outcomes do not expose the directory-pin path rejecting replacement before flushing or demonstrate original-receipt reuse and bigint migration; inspected fault-injection tests remain supplemental. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 8 items Current main still needs the fix: Main uses numeric lstatSync/fstatSync observations and sameFileIdentity for directory receipts and descriptors; it does not retain the proposed exact private identity.
Latest release retains numeric comparison: The v0.15.0 implementation also performs numeric pathname identity comparison, so the requested repair is not already shipped in the supplied latest release.
Exact authority and admission: Private WeakMaps preserve exact identity and metadata snapshots; new admissions validate supplied identity and path fields, while retained pins recheck the filesystem through shared strict identity helpers.
Findings None None.
Security None None.

How this fits together

Directory durability connects filesystem identity checks to directory synchronization after file creation or publication. It accepts paths or previously observed receipts and reports synchronization success only after checking that the pathname still identifies the intended directory.

flowchart TD
  A[Directory path or receipt] --> B[Validate supplied identity]
  B --> C[Retain exact private identity]
  C --> D[Check pathname and descriptor]
  D -->|Identity matches| E[Synchronize directory]
  D -->|Mismatch or unknown| F[Reject operation]
  E --> G[Recheck identity]
  G --> H[Return outcome or rejection]
Loading

Decision needed

Question Recommendation
Should this release intentionally reject unsafe reconstructed numeric receipts and persistently unknown Windows directory identities? Accept the documented safety boundary: Approve the stricter admission behavior once runtime evidence demonstrates supported receipt reuse and bigint migration.

Why: The stricter checks restore the safety contract but can stop existing callers; documentation establishes the proposed behavior, not maintainer acceptance of its release impact.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The reported Linux FAT32 runs provide useful real-setup context, but aggregate outcomes do not expose the directory-pin path rejecting replacement before flushing or demonstrate original-receipt reuse and bigint migration; inspected fault-injection tests remain supplemental. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - Existing callers supplying copied or reconstructed numeric receipts with unsafe identity values will now fail with path-mismatch; Windows directories whose identities remain unknown also stop being accepted. The migration is documented, but maintainer acceptance remains unrecorded.
  • Complete next step (P1) - Attach runtime logs or a diagnostic recording showing original-receipt reuse, replacement rejection before flushing, and bigint migration; redact private paths, endpoints, and credentials. Record maintainer acceptance of the documented compatibility break. Update the PR body to trigger re-review; if it does not run, ask a maintainer to comment @clawsweeper re-review.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test LOC Production +220/−173, net +47; tests +740/−15, net +725 Production growth centralizes exact receipt authority, with focused coverage for identity collisions, mutation, and admission failures.

Merge-risk options

Maintainer options:

  1. Approve strict admission with migration evidence (recommended)
    Record acceptance of the documented refusal cases and inspect runtime evidence that original receipts and bigint observations remain usable.
  2. Wait for consumer migration
    Pause landing if existing consumers cannot yet replace unverifiable numeric receipts.

Technical review

Best possible solution:

Keep exact identity checks fail-closed, preserve original-receipt reuse, and ship the documented bigint migration with explicit compatibility acceptance and observable upgrade evidence.

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

Yes, from source: main compares numeric directory identities, allowing rounded-equal inode values and tolerated Windows zero components to conceal replacement. No runtime reproduction was executed in this read-only review.

Is this the best way to solve the issue?

Yes at the implementation level: reusing strict identity helpers and retaining private exact observations repairs the existing contract without adding a parallel public API; release compatibility still needs explicit acceptance.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 50a23bf99547.

Labels

Label justifications:

  • P2: This is a bounded filesystem durability repair with source-backed identity failure cases and no established widespread outage.
  • merge-risk: 🚨 compatibility: Previously accepted unsafe numeric receipts and persistently unknown Windows identities now fail closed.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The reported Linux FAT32 runs provide useful real-setup context, but aggregate outcomes do not expose the directory-pin path rejecting replacement before flushing or demonstrate original-receipt reuse and bigint migration; inspected fault-injection tests remain supplemental. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Current main still needs the fix: Main uses numeric lstatSync/fstatSync observations and sameFileIdentity for directory receipts and descriptors; it does not retain the proposed exact private identity. (src/directory-durability.ts:168, 50a23bf99547)
  • Latest release retains numeric comparison: The v0.15.0 implementation also performs numeric pathname identity comparison, so the requested repair is not already shipped in the supplied latest release. (src/directory-durability.ts:168, 59f297b1d8d6)
  • Exact authority and admission: Private WeakMaps preserve exact identity and metadata snapshots; new admissions validate supplied identity and path fields, while retained pins recheck the filesystem through shared strict identity helpers. (src/directory-receipt.ts:29, 4090e17954aa)
  • Focused rejection and compatibility coverage: Tests cover physical directory replacement with projected colliding inodes, rejection before flushing, public receipt mutation, original receipt reuse, bigint expected identities, and bounded Windows unknown-identity retries. These are supplemental regressions, inspected but not executed during this read-only review. (test/directory-durability-identity.test.ts:149, 4090e17954aa)
  • Documented upgrade boundary: The documentation explicitly states that persistent unknown Windows identities and reconstructed unsafe numeric identities now reject with path-mismatch; callers retain original library receipts or use bigint expected identities. (docs/durability.md:72, 4090e17954aa)
  • Proof and review continuity: The complete captured body at sourceRevision 04b15ce8b67f32674cae56cd9d2cbb0d5dc34470e69e785e04c176512d3a40c2 reports 210 FAT32 outcomes on Linux with Node 22/24, but supplies no runtime transcript or linked artifact showing the changed pin boundary. The live body matched that content. The previous completed review requested replacement-before-flush, receipt-reuse, bigint-migration evidence and compatibility acceptance; no review approval was returned. (4090e17954aa)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach redacted runtime output showing receipt reuse, replacement rejection before flushing, and bigint migration.
  • Record maintainer acceptance of the documented numeric-receipt and Windows compatibility boundary.

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 (4 earlier review cycles)
  • reviewed 2026-09-18T19:21:32.284Z sha f0c1f1b :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-18T20:13:52.874Z sha e8e317f :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-18T20:36:07.361Z sha 50865bd :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-18T20:50:48.679Z sha e416b8a :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 18, 2026
@steipete
steipete merged commit b44ed19 into main Sep 18, 2026
33 checks passed
@vincentkoc
vincentkoc deleted the codex/directory-pin-exact-identity-20260918 branch September 25, 2026 11:14
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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant