Repository navigation
feat(hooks): expose per-session hook-event read model - #3295
Conversation
Problem: polylogue-31r1's original bug (hook events ingested as standalone sessions, inflating the archive ~4.7x) was fixed weeks ago (PR #3265). The bead stayed open for one named fast-follow: hook events are now persisted correctly as raw_hook_events linked to their originating session, but no read surface exposed "how many/which hook events happened during session X" - polylogue/cli/commands/hooks.py only covered hook-harness install/status. What changed: ArchiveStore.hook_event_summary_for_session() is a new read model joining raw_hook_events to a session by (origin, native_id) - hook rows have no raw_id link, since they attach to the session identity, not to any one raw acquisition record. It returns per-event- type counts plus first/last observed timestamps. Exposed via a new `hooks` CLI read-view (`polylogue read <session> --view hooks`), following the same registration pattern as the existing messages/raw views. Verification: tests/unit/core/test_facade_api.py (archive-layer summary correctness including missing-session/no-hooks cases), tests/unit/cli/test_messages.py (CLI JSON/YAML/missing-session), tests/unit/api/test_facade_contracts.py (registers the new facade method in READ_BY_ID_NONE_METHODS). 328 tests passed across the three files. mypy --strict clean on all 8 changed source files. ruff check + format clean. devtools render all --check clean (topology projection regenerated). Ref polylogue-31r1
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 27 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (13)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
ArchiveStore.hook_event_summary_for_session()read model joiningraw_hook_eventsto a session by(origin, native_id).hooksCLI read-view (polylogue read <session> --view hooks), following the existing messages/raw view registration pattern.Problem
polylogue-31r1's original bug (hook events ingested as standalone sessions, inflating the archive ~4.7x) was fixed weeks ago (PR #3265). The bead stayed open for one named fast-follow: hook events are now persisted correctly as
raw_hook_eventslinked to their originating session, but no read surface exposed "how many/which hook events happened during session X" —polylogue/cli/commands/hooks.pyonly covered hook-harness install/status.Solution
hook_event_summary_for_session()returns per-event-type counts plus first/last observed timestamps. Hook rows have noraw_idlink since they attach to the session identity, not to any one raw acquisition record, so the join is by(origin, native_id).Verification
tests/unit/core/test_facade_api.py(archive-layer summary correctness including missing-session/no-hooks cases)tests/unit/cli/test_messages.py(CLI JSON/YAML/missing-session)tests/unit/api/test_facade_contracts.py(registers the new facade method inREAD_BY_ID_NONE_METHODS)mypy --strictclean on all 8 changed source filesruff check+format: cleandevtools render all --check: clean (topology projection regenerated)Ref polylogue-31r1