Skip to content

fix: tolerate doctor archive churn - #2378

Merged
chubes4 merged 1 commit into
mainfrom
fix-2336-doctor-archive-churn
Aug 25, 2026
Merged

fix: tolerate doctor archive churn#2378
chubes4 merged 1 commit into
mainfrom
fix-2336-doctor-archive-churn

Conversation

@chubes4

@chubes4 chubes4 commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Treat only ENOENT at the per-entry archive stat/header-read boundary as benign concurrent churn.
  • Preserve inspection, malformed archive, I/O, permission, and archive-root enumeration failures instead of swallowing them.
  • Keep existing checked/invalid semantics and add an aggregate skipped count without exposing vanished paths.
  • Add deterministic regression coverage to the required check gate for post-enumeration disappearance and a still-present inspection error.

Root Cause

archiveCheck() enumerated archive paths and then called stat() and archive header validation without a per-entry disappearance boundary. A cache/runtime cleanup racing that inspection could remove an enumerated entry, allowing ENOENT to escape and replace the doctor report with wp-codebox/cli-failure/v1.

Error Boundary

inspectArchivePath() wraps only the individual entry's stat() and header read. ENOENT returns a skipped result; every other exception is rethrown. Root opendir() failures also remain surfaced.

Output Compatibility

The wp-codebox/doctor/v1 schema, statuses, messages, and existing checked/invalid fields are unchanged. Archive details gain only a numeric skipped field; vanished paths are not reported.

Verification

  • npx tsx tests/doctor-archive-inspection.test.ts
  • npx tsx scripts/doctor-command-smoke.ts
  • npx tsc -b packages/cli --pretty false
  • npm run build
  • npm run check (102-command gate passed; Docker-dependent MySQL E2E explicitly skipped because Docker is unavailable)

No release or deployment occurred. No changelog, version, or generated release artifact was changed.

Fixes #2336

@chubes4
chubes4 merged commit 019f7c7 into main Aug 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doctor archive scan fails when cache entries vanish concurrently

1 participant