Repository navigation
refactor(storage): share run projection relation reads - #2523
Conversation
|
Warning Review limit reached
Next review available in: 51 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 Run ID: 📒 Files selected for processing (6)
✨ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b86a3b4d6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Problem: run, observed-event, and context-snapshot reads had two query substrates. ArchiveStore terminal queries synthesized source rows from sessions/blocks, while repository/query-store reads selected only the materialized session_* cache tables. The duplicated SQL also meant absent cache tables failed even when source evidence was enough to answer the query. What changed: add a shared run_projection_relations module with source-derived relation builders, optional materialized branches, and row mappers. Route ArchiveStore terminal queries, structural exists selectors, and async query-store list APIs through that shared relation. Keep materialized subagent/enrichment rows when the cache tables exist, while direct repository reads still return source rows when the tables are empty or absent. Verification: ruff format/check on touched files; python -m py_compile for archive/query/shared modules; mypy on the shared and async query modules; devtools test tests/unit/insights/test_run_projection_materialization.py tests/unit/cli/test_query_expression.py::TestBooleanQueryExpression::test_exists_run_projection_predicates_select_sessions tests/unit/cli/test_query_expression.py::TestBooleanQueryExpression::test_exists_run_projection_predicates_use_source_relations -> 6 passed in 76.2s.
5b86a3b to
dbbed3b
Compare
## Summary Remove four literal-zero-coverage modules that have no remaining production reachability. Refresh the generated topology projection. ## Problem The coverage audit exposed fully unexecuted files. Static imports, dynamic import registries, and CLI/MCP/API registrations showed these were stale implementations, not live behavior lacking tests. ## Solution - `archive/semantic/outlook.py`: dead; replaced by the registered `cost.outlook` surface. - `context/assertion_claims.py`: dead after the context-image refactor. - `publication/__init__.py`: isolated and unregistered. - `mappers_run_projection.py`: dead; #2523 moved active hydration to `run_projection_relations.py`. The generated topology projection and status now omit the removed paths. ## Verification - `nix develop --command devtools test tests/unit/insights/test_run_projection_materialization.py` — 6 passed. This existing real-route test exercises `session_insight_run_projection_reads` through `run_projection_relations`; removing its active mapper/hydration path would fail it. - `nix develop --command devtools verify --quick` — all 15 checks passed. - Pre-push reran `devtools verify --quick` for each commit; all checks passed. ## Acceptance criteria `polylogue-kp4q`: satisfied. All four files are verdict `dead/delete`; no untested-but-live or unwired files remained. ## Adversarial review notes - Iteration 1: independent cold review of the fetched full branch diff, Bead AC, import/registration reachability, and PR feedback found no legitimate gaps. - No substantive automated-review comments were present; CodeRabbit was rate-limited and Codex posted no suggestions. Ref polylogue-kp4q. --------- Co-authored-by: Codex <[email protected]> Co-authored-by: Claude <[email protected]>
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Run-projection reads now use one shared source-derived SQLite relation substrate instead of separate ArchiveStore and repository/query-store implementations. The direct repository read APIs return useful source rows even when the materialized cache tables are empty or absent, while existing materialized subagent/enrichment rows still participate when those tables exist.
Problem
The
run,observed-event, andcontext-snapshotterminal lowerers already synthesized rows from durablesessionsandblocksevidence, but repository/query-store reads selected only fromsession_runs,session_observed_events, andsession_context_snapshots. That split made the cache tables more load-bearing than they should be and duplicated a large SQL relation insidearchive.py.Internal task: Bead
polylogue-x5l.Solution
Added
polylogue/storage/sqlite/run_projection_relations.pyas the shared relation and row-mapping module for run-projection reads. ArchiveStore terminal queries, structuralexists run/observed-event/context-snapshot(...)selectors, and async query-storelist_*APIs now compose through the same source-derived CTEs with optional materialized branches guarded by table existence where the read path can inspect it.The old archive-local relation constants and mappers were removed. The generated topology projection was refreshed to register the new storage module.
Verification
ruff format/ruff checkon touched files.python -m py_compile polylogue/storage/sqlite/run_projection_relations.py polylogue/storage/sqlite/queries/session_insight_run_projection_reads.py polylogue/storage/sqlite/archive_tiers/archive.pymypy polylogue/storage/sqlite/run_projection_relations.py polylogue/storage/sqlite/queries/session_insight_run_projection_reads.pydevtools test tests/unit/insights/test_run_projection_materialization.py tests/unit/cli/test_query_expression.py::TestBooleanQueryExpression::test_exists_run_projection_predicates_select_sessions tests/unit/cli/test_query_expression.py::TestBooleanQueryExpression::test_exists_run_projection_predicates_use_source_relations-> 6 passed in 76.2s.devtools verify --quickat5b86a3b4d6c1f8578e6cabd8c0448c20ad3609ee-> passed in 11.57s.Changelog
Skipped: internal storage/query refactor.
Risks and Follow-ups
The materialized cache tables still exist and are still written by rebuild/materialization; this PR only makes read paths less dependent on them. Follow-up Bead
polylogue-dabowns removing the cache write/readiness/DDL surface after parity is fully established.