Repository navigation
test: strengthen hook lifecycle and transcript boundaries - #33015
Conversation
Walkthrough
Priority: Merge Risk:
|
There was a problem hiding this comment.
🧹 Nitpick comments: 1
src/shared/agent-hook-listener-transport.test.ts: 1
265-271: 🎯 Functional Correctness |Trivial | ⚡ Quick win Restore positive checks for the uncovered routes.
The characterization tests cover
opencode2,mimo-code,prime-agent, andhermesthroughresolveHookSource. No routing test coverscursor,antigravity,grok,pi,omp, orcommand-code. If one of those route entries becomes invalid, the server returns404and the current tests do not detect it.Suggested fix
it('rejects root and unknown hook routes', () => { + expect(resolveHookSource('/hook/cursor')).toBe('cursor') + expect(resolveHookSource('/hook/antigravity')).toBe('antigravity') + expect(resolveHookSource('/hook/grok')).toBe('grok') + expect(resolveHookSource('/hook/pi')).toBe('pi') + expect(resolveHookSource('/hook/omp')).toBe('omp') + expect(resolveHookSource('/hook/command-code')).toBe('command-code') expect(resolveHookSource('/hook/unknown')).toBeNull() expect(resolveHookSource('/')).toBeNull() })

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
6540fccc-5dc5-4224-bbcd-3fa972563e4a
Files selected for processing: 5-
src/shared/agent-hook-listener-session-replacement.test.tssrc/shared/agent-hook-listener-transport.test.tssrc/shared/agent-hook-listener/claude-settled-permission-requests.test.tssrc/shared/agent-hook-listener/reverse-file-region-scan.test.tssrc/shared/agent-hook-request-body-memory.test.ts
Files with no reviewable changes: 1-
- src/shared/agent-hook-request-body-memory.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
-
Hook tests could pass after replay identity checks, session continuity, or transcript ordering and offsets broke. Strengthen those assertions, exercise route resolution through hook normalization, and require unsafe endpoint refusal to leave no files behind.
Consolidate the standalone one-byte body test into the transport suite, retaining its buffer-growth coverage and listener cleanup. Narrow titles that claimed memory retention, atomic publication, or unreadable-file behavior without observing them. All 51 test declarations remain; production code is unchanged.
Validation: 74 focused cases passed with no skips; Node typecheck, changed-code quality, formatting, and whitespace checks passed. Isolated production regression probes confirmed the repaired gaps and retained coverage.