Repository navigation
refactor: trim unused internal switches and reuse error helpers - #794
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 maintainer review before merge. Reviewed October 1, 2026, 3:27 AM ET / 07:27 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR removes unused internal filesystem options and type exports, reuses equivalent error helpers, and corrects archive staging and file publication comments. Merge readiness✅ Ready for maintainer review This remains a useful, bounded cleanup that current main has not adopted. No introduced correctness or security defect was found, and the prior review contained no findings to carry forward. Priority: P3 Review scores
Verification
How this fits togetherfs-safe guards filesystem operations for applications handling untrusted paths. These internal adapters support atomic replacement, secret creation, producer handoff, and cleanup while retaining file and directory identity checks. flowchart TD
A[Requested file operation] --> B[Path and identity guards]
B --> C[Internal filesystem adapter]
C --> D[Stage and publish file]
D --> E[Guarded cleanup]
C --> F[Shared error handling]
E --> G[Result or preserved failure]
F --> G
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep the smaller internal implementation while preserving guarded mutation, existing scheduling boundaries, and the public package contract. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR proposes behavior-preserving cleanup rather than fixing a reported runtime failure. Is this the best way to solve the issue? Yes: removing unused internal parameters and reusing exactly equivalent helpers is a narrow solution; inspected callers and package exports support the stated compatibility boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 74cf375d1807. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
What Problem This Solves
A few internal switches, an injected filesystem parameter, and a type re-export lost their last real use when #772 consolidated the atomic writers; two modules still hand-wrote error checks that existing helpers implement; and two comments described the code inaccurately.
User Impact
No user-visible change. Branch selection, sync/async boundaries,
rmoptions, error codes, messages and causes are unchanged.Why This Change Was Made
Net -12 production lines:
atomic-io.ts:lstat,stat, andstatExactdrop asynchronousBuiltin = trueparameter no caller passes (sotrue && xbecomesx);removedrops aforce = trueoption whose only caller passedtrue;SyncFchmodis no longer re-exported through a shim nobody imports.file-cleanup.ts:removeOwnedPathbecomes module-private and loses the injected filesystem whose only caller passedfs/promises; it keeps the synchronouslstatand awaitedunlinkit already used.private-producer-handoff.tsuseserrorCauseOptions;secret-file.tsuseshasNodeErrorCodefor two exactly equivalentENOENTguards.publish-copy-stage.tsno longer claims readers can never observe two names (a synchronous callback and other processes can);archive-staging.tsno longer claims staging is left for OS cleanup or that identity change is the only failure.Evidence
Per method, the omitted-argument default was verified to select the same branch as the simplified condition.
tsc,lint:file-size,lint:fs-boundary,docs:check,check-pack(public API snapshot unchanged): pass.55 focused files (atomic, copy fallback, cleanup authority, producer handoff, secret files, archive staging): 1,448 passed, 0 failed.
Codex autoreview (P0-P2): scoped-clean.
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