Skip to content

fix(write): retain disk-full diagnostics through disposal - #833

Merged
steipete merged 1 commit into
mainfrom
codex/pinned-write-enospc-20261004
Oct 4, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/pinned-write-enospc-20261004

Conversation

@steipete

@steipete steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes misleading file-type errors when Root.copyIn() runs out of disk space during native publication and async disposal preserves an uncertain stage.

User Impact

Consumers see ENOSPC and the retained publication/cleanup receipt. The documented invalid-path/policy compatibility classification and already-classified errors remain unchanged. An uncertain rename still cannot authorize removing the stage or retrying the write.

Why This Change Was Made

The existing write-resource diagnostic owner traversed suppressed and aggregate failures for descriptor exhaustion but omitted disk exhaustion. Extend that same owner, preserving the original cause graph and EMFILE/ENFILE precedence. Native publication, cleanup, identity checks, and retry policy are unchanged.

Evidence

Three regression cases failed before the change, including native public Root.copyIn() failures before and after rename dispatch. The repaired cases pass, retain staged or published bytes, and close descriptors. Full pnpm check passed: 14,828 tests passed and 2,854 platform/optional tests skipped, plus static guards, TypeScript/WASM builds, documentation, and installed-package checks. Independent P0–P2 review is scoped-clean.

Production delta: +5 lines by extending the existing owner; tests +60, docs/changelog +7. No new public error codes, configuration, dependencies, or fallback paths.

  • Tests added or updated when behavior changed
  • Security and compatibility impact considered
  • CHANGELOG.md updated when release-relevant
  • No credentials, private paths, private hosts, or sensitive contents included

@steipete
steipete requested a review from a team as a code owner October 4, 2026 17:32
@clawsweeper

clawsweeper Bot commented Oct 4, 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. 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 Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 1:34 PM ET / 17:34 UTC.

ClawSweeper review

What this changes

Preserve disk-full diagnostics, original causes, and cleanup receipts when guarded writes fail during both publication and disposal.

Merge readiness

✅ Ready for maintainer review

Keep open: the combined disk-full failure remains on current main and in v0.23.0, and this focused repair has no identified correctness defect. The member-authored PR also requires explicit maintainer handling.

Priority: P2
Reviewed head: e3da7c91cf75d7c653843b2908cc4b4975b3e5fd

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with suitable regression coverage and preserved safety contracts; no blocking patch defect was identified.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary contributor-proof gate is exempt for this member-authored PR. Reported regression runs exercise the changed diagnostic handler through native Root.copyIn before and after injected rename failure; this reviewer inspected their assertions without rerunning them. No stored-data contract or material authority change is introduced.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary contributor-proof gate is exempt for this member-authored PR. Reported regression runs exercise the changed diagnostic handler through native Root.copyIn before and after injected rename failure; this reviewer inspected their assertions without rerunning them. No stored-data contract or material authority change is introduced.
Evidence reviewed 7 items Verified introduced change: The pinned main-to-head delta changes only the diagnostic handler, two regression suites, error documentation, and the Unreleased changelog. Publication, identity checks, cleanup policy, dependencies, and exported error-code definitions are untouched.
Still necessary on main and latest release: Read the complete main and v0.23.0 versions of src/root-errors.ts. Both traverse combined failures only for EMFILE/ENFILE; an unclassified SuppressedError containing ENOSPC reaches the generic regular-file diagnostic. Direct ENOSPC diagnostics already exist, but do not solve the combined-failure case.
Release inspection: Inspected git show v0.23.0:src/root-errors.ts; the latest release retains descriptor-only traversal and does not contain this repair.
Findings None None.
Security None None.

How this fits together

fs-safe provides confined filesystem operations for Node.js applications. Its write-error handler converts failures from staged publication and disposal into diagnostics that callers can inspect without losing publication or cleanup evidence.

flowchart TD
 A[Root write or copy] --> B[Guarded staged publication]
 B --> C[Publication failure]
 C --> D[Resource disposal]
 D --> E[Combined error graph]
 E --> F[Write diagnostic handler]
 F --> G[Error with causes and receipts]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test growth production +5 net lines, tests +60 net lines, docs/changelog +7 lines Production growth is justified by extending the existing diagnostic owner, with focused coverage for combined failures.

Technical review

Best possible solution:

Extend the existing diagnostic traversal while preserving error classifications, boundary precedence, and indeterminate-publication receipts.

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

Yes, from source: Root.copyIn can combine an ENOSPC publication failure with preserved-stage disposal, while main's diagnostic traversal recognizes only descriptor exhaustion. Execution was not repeated in this read-only review.

Is this the best way to solve the issue?

Yes. Extending the existing traversal is a narrow repair, and the patch preserves classified errors, descriptor precedence, causes, and cleanup receipts without changing filesystem decisions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 29f13fdeacc0.

Labels

Label changes:

  • add P2: This repairs misleading diagnostics on a bounded write-failure path without changing publication or cleanup behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary contributor-proof gate is exempt for this member-authored PR. Reported regression runs exercise the changed diagnostic handler through native Root.copyIn before and after injected rename failure; this reviewer inspected their assertions without rerunning them. No stored-data contract or material authority change is introduced.

Label justifications:

  • P2: This repairs misleading diagnostics on a bounded write-failure path without changing publication or cleanup behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary contributor-proof gate is exempt for this member-authored PR. Reported regression runs exercise the changed diagnostic handler through native Root.copyIn before and after injected rename failure; this reviewer inspected their assertions without rerunning them. No stored-data contract or material authority change is introduced.

Evidence

What I checked:

  • Verified introduced change: The pinned main-to-head delta changes only the diagnostic handler, two regression suites, error documentation, and the Unreleased changelog. Publication, identity checks, cleanup policy, dependencies, and exported error-code definitions are untouched. (src/root-errors.ts:40, e3da7c91cf75)
  • Still necessary on main and latest release: Read the complete main and v0.23.0 versions of src/root-errors.ts. Both traverse combined failures only for EMFILE/ENFILE; an unclassified SuppressedError containing ENOSPC reaches the generic regular-file diagnostic. Direct ENOSPC diagnostics already exist, but do not solve the combined-failure case. (src/root-errors.ts, 29f13fdeacc0)
  • Release inspection: Inspected git show v0.23.0:src/root-errors.ts; the latest release retains descriptor-only traversal and does not contain this repair. (src/root-errors.ts, 223a30531ea8)
  • Focused regression coverage: The new public Root.copyIn cases inject ENOSPC before and after real native rename dispatch, assert preserved staged or published bytes, prohibit removal, and check descriptor counts. Diagnostic tests additionally cover suppressed and aggregate failures, classified-error identity, boundary precedence, cycles, and descriptor-exhaustion precedence. The PR reports three pre-fix failures and a passing full pnpm check; these runs were not repeated during this read-only review. (test/staged-file-error-settlement.test.ts:33, e3da7c91cf75)
  • Publication safety remains independent of diagnostics: Traced Root.copyIn through native staged publication and async disposal. NativeStagedFile records indeterminate publication before inspecting rename errors, preserves uncertain entries, and closes owned descriptors; normalization happens afterward. The patch changes neither authority nor those final filesystem decisions. (src/native-staged-file.ts:314, e3da7c91cf75)
  • Related merged history and routing: GitHub verified fix(write): report descriptor exhaustion accurately #742 as merged at c7eb1a2 with author steipete. Main-path logs and raw commit records also connect Peter Steinberger to earlier write diagnostics and staged-error settlement. That merged work handles descriptor exhaustion, whereas this PR adds combined disk exhaustion. (src/root-errors.ts, c7eb1a2f6ba3)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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.

@steipete
steipete merged commit 4c0a828 into main Oct 4, 2026
47 checks passed
@steipete
steipete deleted the codex/pinned-write-enospc-20261004 branch October 4, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant