Repository navigation
fix(hooks): scrub errors before warning - #541
Conversation
Review: PR #541 — fix(hooks): scrub errors before warning (tier:micro, #485)Full review seat (combined correctness + process; disclosed as such). Head Scope
The two contractsConsole line (changed). Receipt (unchanged, deliberately class-only). Import cycle
Consumer blast radius
The two loop guards the ticket touches on were verified as claimed: Scrub probe (scratch, deleted)Called a Base (leak — the defect, full message via the raw object): Head (scrubbed + capped): Redaction and the 200-char cap behave exactly as the stated contract. Fail-beforeHead test file against base Full suite
Zero drift; the +1 expect call on head is the new warn assertion. CI green: lint, test, test-windows, smoke. ProseThe touched test title — "a guarded failure lands in the evidence file as hook_error, class only" — is unchanged invariant wording; the added assertion tests the console contract inside it without incident narration anywhere in shipped titles or comments. Accept. VerdictAPPROVE. Two-file scope, the console/receipt split is exactly what the code does, the receipt provably unchanged, no import cycle, no broken consumers, real fail-before, suite identical. The PR's deviation from the ticket's equality premise is the right call and is well-argued in the code's own comments. |
|
🎉 This PR is included in version 0.37.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #485.
guarded()now sends the shared redacted, bounded error message to the console instead of the raw error object. The regression test checks the warning with a synthetic credential and confirms the durablehook_errorreceipt still records only the error class.The issue's console/receipt equality check assumes the receipt already records a message. In the current code it deliberately stores only the class because hook errors can carry conversation content. The console therefore uses the sanitized diagnostic while the receipt retains its existing class-only contract.
The regression failed before the fix. All 29 Windows hook and evidence-policy tests passed after the review follow-up. Typecheck, changed-file Biome checks, and comment lint passed. Claude Opus independently checked the failure, the existing receipt policy, and the import graph before publication.