Repository navigation
refactor(commands): use native missing-file lstat handling - #166385
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 6, 2026, 10:09 PM ET / October 7, 2026, 02:09 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR replaces two private missing-file helpers in Doctor’s SQLite compaction commands with Node’s native lstat option and removes their obsolete assertion-baseline entries. Merge readiness✅ Ready for maintainer review The PR remains useful and has no identified blocking defect. Source inspection resolves the prior compatibility concern: the introduced change preserves file admission and does not alter stored data or migration behavior. Priority: P3 Review scores
Verification
How this fits togetherDoctor’s compaction commands inspect session and shared-state database files before running protected SQLite maintenance. They report missing databases as skipped and reject non-regular files before compaction. flowchart TD
A[Doctor compaction request] --> B[Resolve database path]
B --> C[Inspect file without following symlinks]
C --> D[Report missing database]
C --> E[Reject non-regular file]
C --> F[Protected SQLite maintenance]
F --> G[Report compaction results]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -22, Other -2. Total -24 across 3 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Use Node’s existing filesystem contract while retaining Doctor’s current missing-file reports, symlink refusal, and protected maintenance operations. Do we have a high-confidence way to reproduce the issue? Not applicable: this is behavior-preserving cleanup rather than a reported bug; source and Node’s implementation establish the equivalent missing-file contract. Is this the best way to solve the issue? Yes: the native option removes duplicate error handling while preserving the existing admission checks and maintenance boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 07e9a2519420. 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)
|
|
Merged via squash.
|
…166385) Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
The session and state SQLite compaction commands each define a private lstat wrapper solely to return undefined for ENOENT.
User Impact
No intended behavior change. Use Node's existing
fs.lstatSync(path, { throwIfNoEntry: false })option at the same call sites. Missing-file reports and symlink refusal stay unchanged; ENOTDIR and other filesystem errors still propagate.Why This Change Was Made
The built-in owns this exact contract, and the sibling session verification code already uses it. Remove both wrappers and the two assertion-safety baseline entries made obsolete by their removal.
Production LOC: +2 / -24 (22 fewer lines). The baseline loses two metadata lines; no test source changes. Total diff: 28 changed lines.
Evidence
640848a1864bb0149d0b622bfc5263bed9472113. Hosted exact-head CI and native landing gates remain separate.Data-Model Compatibility
No schema, schema-version, persisted row shape, SQL write path, migration, backfill, or recovery policy changes. Whole-file reconstruction confirms the only production changes are the two same-position lstat calls and removal of their private wrappers. Node's lstat option suppresses only ENOENT, retaining the original file admission before all existing maintenance and compaction operations.
The retained 32-case production-entrypoint proof includes
compacts pre-bootstrap-column v6 state without migrating it, schema-role/version refusal before mutation, integrity checks, compaction across existing vacuum modes, and migration-manifest recovery. These tests and their assertions are unchanged. The path-based stored-data warning therefore does not identify a data-model change in this diff; the existing compatibility coverage applies.Current main separately changed the session maintenance lease implementation. The two affected complete suites were therefore run on the native prepared composition of main
07e9a251942099b22f16813e36ada02f2b76ab91plus this unchanged signed head: session compaction 9 and recovery 8, all 17 passed with the same ordered cases and zero failed, skipped, or todo. Node 24.19.0/Linux x64, one worker; composition diff check and source restoration passed. The original state suite and full gates remain frozen-base evidence. Exact-head hosted CI also passed.