feat(B-0557 slice 2): try/catch readFileSync + readdirSync in audit tool#3788
Merged
AceHack merged 2 commits intoMay 16, 2026
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
Improves the resilience of the audit-backlog-status-drift hygiene tool by preventing filesystem read errors from aborting the entire audit run, and adds a new hygiene-history tick shard documenting related operational context.
Changes:
- Wraps
readdirSyncandreadFileSyncintry/catchinsideenumerateOpenRows()to warn-and-continue on unreadable directories/files. - Emits stderr warnings with the directory/file path and error message when reads fail.
- Adds a new
docs/hygiene-history/ticks/...shard documenting the session tick.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tools/hygiene/audit-backlog-status-drift.ts | Adds defensive error handling around directory and file reads to avoid aborting audits on a single unreadable entry. |
| docs/hygiene-history/ticks/2026/05/16/0644Z.md | Adds a new tick shard entry documenting the session state and related PR context. |
Comments suppressed due to low confidence (1)
tools/hygiene/audit-backlog-status-drift.ts:212
- Same issue as above: casting
err as Errorrisks losing information for non-Errorthrows. Useerr instanceof Error ? err.message : String(err)for consistent, safe stderr output.
process.stderr.write(
`audit-backlog-status-drift: unable to read ${path}: ${(err as Error).message}\n`,
);
AceHack
commented
May 16, 2026
Member
Author
AceHack
left a comment
There was a problem hiding this comment.
Lior Antigravity Check: Clean slice, good error boundaries. No blob detected.
AceHack
added a commit
that referenced
this pull request
May 16, 2026
…ipe-row Two valid Copilot findings on PR #3788: 1. (err as Error).message is unsafe TS — catch variable is unknown. Replaced with: (err instanceof Error ? err.message : String(err)) at both locations (readdirSync + readFileSync error handlers). 2. docs/hygiene-history/ticks/2026/05/16/0644Z.md missed the documented schema (first non-empty line must be a pipe-row per ticks/README.md). Added the pipe-row prefix; preserved heading + body below. Co-Authored-By: Claude <noreply@anthropic.com>
…ort on one bad file Per Copilot P1 on PR #3758: enumerateOpenRows() previously could throw and abort the whole audit on a single unreadable backlog file (permission denied, transient FS error, etc.). Fix: wrap both readdirSync and readFileSync in try/catch; warn to stderr; continue with remaining files. Audit completes; operator sees partial-result warnings naming the failed files. Smoke test: existing live run still produces 33+ candidates (no regression). Existing 16 tests pass unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
…ipe-row Two valid Copilot findings on PR #3788: 1. (err as Error).message is unsafe TS — catch variable is unknown. Replaced with: (err instanceof Error ? err.message : String(err)) at both locations (readdirSync + readFileSync error handlers). 2. docs/hygiene-history/ticks/2026/05/16/0644Z.md missed the documented schema (first non-empty line must be a pipe-row per ticks/README.md). Added the pipe-row prefix; preserved heading + body below. Co-Authored-By: Claude <noreply@anthropic.com>
bbb9462 to
3404f88
Compare
AceHack
added a commit
that referenced
this pull request
May 16, 2026
…git compatibility + sub-case 5 (#3818) * chore(b-0557): add Resolution section mapping 4 slices to merge commits Follow-up to the status-flip commit (034afe2). Adds explicit provenance trail: - Slice 1 (--check): PR #3783 / 0a57a81 - Slice 2 (try/catch): PR #3788 / 6809f6e - Slice 3 (chdir + tests): PR #3790 / 472024d - Slice 4 (mixed-bullet + tsc): PR #3809 / eb04e3d Test count 16 → 20 across the 4 slices. All passing on main. Co-Authored-By: Claude <noreply@anthropic.com> * rule(holding-discipline): cascade-saturation empirical anchor + pure-git tier compatibility + sub-case 5 Three targeted edits to .claude/rules/holding-without-named-dependency-is-standing-by-failure.md based on this session's empirical evidence: 1. Concrete-artifact definition expanded to cover pure-git tier (branch-pushed-no-PR counts for counter reset) 2. New "Cascade-saturation empirical anchor (2026-05-16)" sub-section documenting the rule operating correctly through 4 distinct cycles of cascade saturation. Validates 5 properties of the counter discipline including multi-cycle non-accumulation across named-dep-reset cycles. 3. NEW sub-case 5 discovered DURING authoring: peer-side destructive git operations (reset --hard, stash + checkout, etc.) discard unstaged tracked-modifications. The borrow-on-existing pattern's "modifications follow me" assumption fails here. Mitigation: commit immediately after Edit; don't rely on unstaged edits surviving multi-Bash-call sequences during peer saturation. This commit IS the meta-fallback firing — substrate that documents the cascade by being the cascade's terminal artifact. Recursively self-validating. Sub-case 5 was discovered BECAUSE the first authoring attempt of this very commit was destroyed by peer Otto's destructive git operation; the re-application is the empirical proof. Composes with refresh-world-model-poll-pr-gate.md (rate tiers) and claim-acquire-before-worktree-work.md (saturation-ceiling sub-cases — sub-case 5 is a new finding to land there in a follow-up). Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
4 tasks
AceHack
added a commit
that referenced
this pull request
May 16, 2026
…re-eats-itself) (#3819) * chore(b-0557): add Resolution section mapping 4 slices to merge commits Follow-up to the status-flip commit (034afe2). Adds explicit provenance trail: - Slice 1 (--check): PR #3783 / 0a57a81 - Slice 2 (try/catch): PR #3788 / 6809f6e - Slice 3 (chdir + tests): PR #3790 / 472024d - Slice 4 (mixed-bullet + tsc): PR #3809 / eb04e3d Test count 16 → 20 across the 4 slices. All passing on main. Co-Authored-By: Claude <noreply@anthropic.com> * chore(b-0557): status: open → closed + BACKLOG.md regen (recovery from force-push) Recovers the status flip that was lost when 4c71679's force-push overwrote 034afe2. The Resolution section landed in 4c71679; this commit lands the status: closed + closed: 2026-05-16 frontmatter fields + BACKLOG.md `[ ]` → `[x]` regen. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
This was referenced May 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
enumerateOpenRows()could throw and abort the whole audit on a single unreadable backlog file (permission denied, transient FS error, etc.).readdirSyncandreadFileSyncin try/catch; warn to stderr; continue with remaining files.10fb6e5(brief-ack extreme cost-aware tier substrate).Test plan
bun test tools/hygiene/audit-backlog-status-drift.test.ts→ 16 pass / 0 fail / 28 expect calls (no regression)bun tools/hygiene/audit-backlog-status-drift.ts --jsonstill produces 33+ candidates from mainComposes with
🤖 Generated with Claude Code