Repository navigation
fix(query): reject terminal-only unit selectors (#2006) - #2161
Conversation
Problem: runtime-transform unit sources such as runs, observed-events, and context-snapshots are executable terminal row queries, but they do not have durable SQL lowerers for session-selector EXISTS predicates. Letting them enter the session compiler either produced an unlowerable predicate or weaker parse behavior.\n\nWhat changed: session-selector compilation now raises a typed terminal-only error for those runtime-transform unit sources while preserving parse_unit_source_expression for CLI/API/MCP/daemon terminal query-unit routes. docs/search.md documents runs alongside the terminal units and states the structural boundary explicitly. The branch also registers context_pack_payload in the archive facade route catalog after the seed run exposed the #2160 coverage drift.\n\nVerification: focused parser/daemon query-unit tests, facade catalog tests, status snapshot update/rerun, devtools verify --quick, detached devtools verify --seed-testmon --skip-slow, default devtools verify, and git diff --check all passed.\n\nRef #2006
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe PR adds Changesruns terminal-unit compile error and docs
context_pack_payload facade route registration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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: b78606ee37
ℹ️ 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".
|
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
This tightens the #2006 query grammar boundary for runtime-transform unit sources.
runs where ...,observed-events where ..., andcontext-snapshots where ...remain valid terminal row queries, but session-selector paths now reject them with a typed error instead of manufacturing an unlowerable or ambiguousexists ...predicate. The branch also registers thecontext_pack_payloadAPI method added by #2160 in the archive facade route catalog, which the broad seed surfaced.Problem
The full query DSL issue distinguishes terminal row sources from structural session selectors. Runtime-transform units are generated from recovery/run projections today; they do not have durable SQL lowerers that can support
exists run(...),exists observed-event(...), orexists context-snapshot(...)session predicates. Before this change,runs where ...could leak into the session compiler as anEXISTSpredicate that storage cannot lower, while observed-event/context-snapshot forms could fall through to weaker parse behavior.#2160 also added a public async
Polylogue.context_pack_payload(...)method without updating the archive-route catalog used bypolylogue ops status, so facade coverage and the JSON status snapshot drifted.Solution
polylogue.archive.query.expressionfor runtime-transform unit sources used as session selectors.parse_unit_source_expression(...)behavior intact for terminal CLI/API/MCP/daemon query-unit routes.runsalongside the existing terminal units and clarify that runtime-transform units are terminal-only until real durable lowerers exist.context_pack_payloadas an index-routed archive facade method and refresh the affected status snapshot.Verification
nix develop --command devtools test tests/unit/cli/test_query_expression.py tests/unit/daemon/test_web_reader.py -k 'terminal_only_unit_sources_do_not_compile_to_session_selectors or session_list_rejects_terminal_only_unit_query or parse_run_source_expression_preserves_terminal_unit or query_units_endpoint_returns_run_rows'nix develop --command devtools test tests/unit/cli/test_status.py::test_archive_facade_route_catalog_covers_public_async_facade tests/unit/api/test_facade_contracts.py::test_no_undiscovered_async_methodsnix develop --command devtools test tests/unit/cli/test_plain_cli_snapshots.py::test_json_status_snapshot --snapshot-updatenix develop --command devtools test tests/unit/cli/test_plain_cli_snapshots.py::test_json_status_snapshotnix develop --command devtools verify --quickgit diff --checknix develop --command devtools verify --seed-testmon --skip-slow(detached to avoid foreground session SIGTERM): 11,504 selected, 11,503 passed, 1 xfailed; peak pytest RSS 3,168 MiB.nix develop --command devtools verify: 7 affected tests passed; peak pytest RSS 125 MiB.Closes part of #2006.
Summary by CodeRabbit
New Features
runsas a selectable terminal unit alongside other units.context_pack_payloadmethod to the facade API.Bug Fixes
Documentation
runsexamples and expanded structural unit coverage.