Skip to content

feat(#1504): a dropped error leaves a trace — noteSuppressed() counts into the run log, batch-executor's 25 silent catches converted - #1564

Merged
admarble merged 4 commits into
mainfrom
feature/1504-feat-run-a-dropped-error-leaves-a-trace-notesuppre
Oct 20, 2026
Merged

admarble merged 4 commits into
mainfrom
feature/1504-feat-run-a-dropped-error-leaves-a-trace-notesuppre

Conversation

@admarble

@admarble admarble commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The run now counts every error it drops. src/lib/workflow/suppressed.ts adds noteSuppressed(scope, err, context?): it counts by scope, writes one line to stderr when verbose, and never throws. LogWriter.initialize() resets the count and finalize() writes suppressed: { total, byScope } into every run log, total: 0 included. The field is optional, so the schema stays version: 1. All 25 empty catches in batch-executor.ts now call it, and each still continues as before.

Pre-PR AC Verification

AC Description Status Evidence
AC-1 Helper counts by scope, never throws, resets per run ✅ suppressed.test.ts: 5 passed
AC-2 Run log carries the count ✅ grep -c suppressed run-log-schema.ts → 1; schema test: old logs still parse
AC-3 version: z.literal(1) unchanged ✅ grep → 1
AC-4 No empty catch left in batch-executor ✅ health-report --json → 0
AC-5 Fault injection on the real fs ✅ 3 passed (state at EACCES, progress, writable-dir control); no fs mock
AC-6 Baseline moves down ✅ --check exits 0; emptyCatch.total → 92 (≤ 94)

Baseline rise recorded: functions.longest.lines 1050 → 1071 (runIssueWithLogging). Each of its 21 converted catches gains one code line; the metric skips comment-only lines, so this cannot be avoided without touching more than the catch bodies.

Mutation-verified: AC-5 — deleted every noteSuppressed("state"…) call; the state test failed; restored.
Mutation-verified: AC-5 — deleted every noteSuppressed("progress"…) call; the progress test failed; restored.
Mutation-verified: AC-1 — removed the try guard around the sink; the never-throws test failed; restored.
Also: dropping the directory chmod (only state.json at 0444) fails the AC-5 state test, and deleting finalLog.suppressed = … fails both AC-5 tests.

Files changed

  • New: suppressed.ts, suppressed.test.ts, batch-executor.suppressed.integration.test.ts, docs/adr/0018-suppressed-error-counter.md (Proposed)
  • Edited: batch-executor.ts (catch bodies plus one import), log-writer.ts, run-log-schema.ts and their tests, health-baseline.json, docs/adr/README.md, CHANGELOG.md (### Added)

Checks

  • npm run build ✅ · npm run lint ✅ · npm run lint:health ✅ ("no metric rose above the baseline") · knip: nothing new
  • Affected tests, run with SEQUANT_* unset: npx vitest run --changed origin/main as 3 shards, 114 files, 2,345 tests, all passed.
  • Extra set: the 8 tests that read the changed CHANGELOG, ADR or baseline files, tautology-detector-cli.test.ts and both new test files: 11 files, 170 tests, all passed.
  • CLI wiring: N/A (no option fields added).

Pre-PR Confidence Check

  • Weakest part: the counter is module-level, so two runs in one process would share it. No caller does this today; ADR-0018 records it.
  • Coverage gaps: none for the changed source files. All four have tests (the batch-executor changes are covered by the integration test).

Quality Plan

Fixes #1504

QA verdict: AC_MET_BUT_NOT_A_PLUS — acceptance criteria met, but not A+. The run broke to this PR for review rather than entering the quality loop; see the QA review comment for improvement notes.

Runner verification (2026-10-19)

The runner re-ran AC-1..AC-6 verbatim:

  • AC-1: 5 passed
  • AC-2: 1
  • AC-3: 1
  • AC-4: 0
  • AC-5: 3 passed
  • AC-6: 92
  • Lint green; 159 tests across batch-executor, suppressed and the integration file pass.

AC-5 mutation repeated: deleting every noteSuppressed("state"…) call fails the state fault-injection test. Restored.

Added by the runner: updateAutoWait(...).catch(() => {}) dropped a state error uncounted (QA's open finding). It now calls noteSuppressed("state", err, "updateAutoWait"). There is no direct test: the auto-wait path needs a live wait.

Owner ruling (2026-10-19): functions.longest.lines rises from 1050 to 1072. Each of the 21 converted catches gains one code line, plus 1 for the fix above. This is accepted in exchange for emptyCatch.total falling from 117 to 92. #1506/#1507 split runIssueWithLogging next. ADR-0018 is Proposed; acceptance is the owner's (D-4).


🤖 Generated with Claude Code

Entire-Checkpoint: c7d1e4ff940c
… same class as the converted catches)

Entire-Checkpoint: 6ec69a855491
…rted catches + updateAutoWait)

Entire-Checkpoint: 04cef4900f08
@admarble
admarble merged commit 10fe972 into main Oct 20, 2026
9 of 10 checks passed
@admarble
admarble deleted the feature/1504-feat-run-a-dropped-error-leaves-a-trace-notesuppre branch October 20, 2026 02:53
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.

feat(run): a dropped error leaves a trace — noteSuppressed() counts into the run log, batch-executor's 25 silent catches converted

1 participant