deepseek-harness/packages/hooks/hook-protocol/tests
Tianyi Cui 9428acdc96 fix(hook-protocol): discard a discriminator-less hookSpecificOutput block
Address review on the hook-protocol PR: the event-scope guard only rejected a
`hookSpecificOutput` block whose `hookEventName` NAMED a different event than
the firing one. A block with NO `hookEventName` slipped through and applied its
event-scoped permission fields to whatever event was firing. Under the keyed
Claude Code schema (where `hookEventName` is part of the block) a missing
discriminator is as malformed as a mismatched one — a Stop/UserPromptSubmit
hook emitting a bare `{ permissionDecision: 'deny' }` could deny the current
point.

Drop the `eventName !== undefined` clause so the guard fires on both a
mismatch and an omission when the caller passes `expectedEventName`; the
opt-out (no expectedEventName) still applies a discriminator-less block as-is.
Flipped the test that pinned the old behavior (it documented an artifact, not
a contract) and proved the corrected one red on the old guard.
2026-07-02 17:13:42 +08:00
..
codec.spec.ts fix(hook-protocol): discard a discriminator-less hookSpecificOutput block 2026-07-02 17:13:42 +08:00
events.spec.ts feat(hooks): dsh-hook-protocol — shared Claude Code / Codex hook wire-protocol core 2026-07-01 00:41:53 +08:00
matcher.spec.ts feat(hooks): dsh-hook-protocol — shared Claude Code / Codex hook wire-protocol core 2026-07-01 00:41:53 +08:00
merge.spec.ts fix(hooks): merge surfaces the WINNING decision's reason, not only deny's 2026-07-01 02:20:12 +08:00
runner.spec.ts fix(hook-protocol): discard a hookSpecificOutput block whose hookEventName mismatches the firing event 2026-07-01 10:45:58 +08:00