Files
Claude e759e1a028 fix(hook-runtime): name the thrown cause when a hook fails to load
`main` is red: `catch (err)` at src/hook-runtime.ts:498 never used `err`, so
`@typescript-eslint/no-unused-vars` fails `lint` and the whole `check` job with
it. Arrived in the merge 236615e (fix inject hook resilience); reproduced on a
clean checkout of origin/main before touching anything, so it is the base, not
any one PR.

CONSIDERED AND REJECTED: `catch {`. It silences the rule and keeps the defect.
The comment three lines above promises the failure will "name the real cause",
and today it names one only when the merge-conflict heuristic fires — every
other load failure reads a bare "cannot be loaded", which is a diagnosis that
sends the reader looking in the wrong place. That is a defect this runtime has
already shipped twice (the spec loader that advised `npm run build` when the
answer was `npm install`). `catch (err)` plus a comment about naming the cause
reads as an author who meant to use it, so it is now used.

The thrown message is APPENDED, not substituted: the existing assertion
`/guard\.mjs cannot be loaded/` in src/hook.test.ts still matches, and it should
— "cannot be loaded" is the claim, the thrown text is the evidence for it.

Gates: npm run check 18/18 (lint 0 errors, was 1) · coverage 3972 passed, 0
failed. The 99.94% statement gate fails locally on src/mock-model.ts (untouched;
25 tests skip locally), green on CI.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 00:06:24 +00:00
..