Skip to content

test: strengthen hook lifecycle and transcript boundaries - #33015

Merged
OrcaWin merged 1 commit into
mainfrom
OrcaWin/comprehensive-test-audit-23
Oct 24, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
OrcaWin/comprehensive-test-audit-23

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​69 $\color{#cf222e}{\Huge{\mathbf{−}}}$​62 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​7
Prod 0 0 0 0

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.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The changes update tests for session replacement, hook routing and request-body parsing, settled permission requests, and reverse file-region scanning. They add checks for cron-gate retention, agent type and session matching, request-body parsing in one-byte chunks, and scan order and byte offsets. The standalone request-body test file is removed.

Priority: Low

Merge Risk: Low · up to 5a77a

The change is mergeable with follow-up, but restoring these route checks would help catch regressions that could make supported hooks unavailable.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description explains the test changes and reports validation results, but it omits the required template sections, including ELI5, Linked Issue, Visual Proof or N/A, structured Testing, Review, No… Complete the required pull request template. Add an ELI5 summary, explicit What Changed and Why sections, an actual linked issue under Fixes #, Visual Proof or N/A with a reason, structured Testing details, AI Disclosure if applicable, Revi…
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title is concise and accurately summarizes the main change: stronger hook lifecycle and transcript boundary tests.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4 files.

Full details: Description check

Explanation

The description explains the test changes and reports validation results, but it omits the required template sections, including ELI5, Linked Issue, Visual Proof or N/A, structured Testing, Review, Notes, and Checklist confirmations.

Resolution

Complete the required pull request template. Add an ELI5 summary, explicit What Changed and Why sections, an actual linked issue under Fixes #, Visual Proof or N/A with a reason, structured Testing details, AI Disclosure if applicable, Review and Notes, and the required checklist confirmations.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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, and hermes through resolveHookSource. No routing test covers cursor, antigravity, grok, pi, omp, or command-code. If one of those route entries becomes invalid, the server returns 404 and 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
Commits

Reviewing files that changed from the base of the PR and between 82534d0 and 5a77a8d.

Files selected for processing: 5
  • src/shared/agent-hook-listener-session-replacement.test.ts
  • src/shared/agent-hook-listener-transport.test.ts
  • src/shared/agent-hook-listener/claude-settled-permission-requests.test.ts
  • src/shared/agent-hook-listener/reverse-file-region-scan.test.ts
  • src/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.

@OrcaWin
OrcaWin merged commit e12e8ba into main Oct 24, 2026
32 checks passed
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.

1 participant