Repository navigation
feat: clarify query paths and add read surfaces - #570
Conversation
Problem: Query and read surfaces overloaded path semantics, forced whole-conversation hydration for recall workflows, and left post-close bot review findings unresolved across CLI, MCP, storage, schema, pipeline, and devtools surfaces. What changed: Rename query-facing path filters to referenced_path while keeping cwd_prefix for working-directory scopes; add paginated message/raw read surfaces; normalize MCP resources and product tool schemas; preserve summary message types; tighten pagination, query, readiness, schema, pipeline, and topology contracts; and fold in the actionable Codex/Copilot audit findings tracked in #544 and #569. Verification: devtools verify --quick passed. devtools verify passed, including pytest ok (194.7s). git diff --check passed. Closes #544 Closes #569
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (26)
📝 WalkthroughWalkthroughThis PR renames path-related filters to Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as Client/CLI
participant Spec as QuerySpec
participant Plan as QueryPlan
participant Runtime as RuntimeFilters
participant Storage as Storage/DB
participant Ops as Operations
participant API as API/MCP
CLI->>Spec: build_query_spec(referenced_path, message_type)
Spec->>Plan: to_plan()
Plan->>Runtime: apply_full_filters(plan)
Runtime->>Storage: list_conversations(referenced_path, message_type)
Storage->>Storage: SQL filter by referenced_path & message_type
Storage-->>Runtime: conversations
Runtime-->>CLI: filtered results
CLI->>API: request get_messages_paginated(conversation_id, message_role, message_type, limit, offset, projection)
API->>Ops: forward to operations
Ops->>Storage: get_messages_paginated(..., content_projection)
Storage->>Storage: SQL filters + LIMIT/OFFSET
Storage-->>Ops: (messages, total)
Ops->>Ops: project_message_content(messages)
Ops-->>API: payload (messages, total)
API-->>CLI: MCPMessagesListPayload
Estimated code review effort🎯 4 (Complex) | ⏱️ ~90 minutes Possibly related PRs
Suggested labels
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1c2a771a7
ℹ️ 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: CI still invoked the removed devtools verify-showcase command, so PR showcase verification failed even though the replacement lab-scenario surface is the supported baseline verifier. What changed: Update the workflow to devtools lab-scenario verify-baselines and refresh the committed tier-0 showcase help baselines for the current CLI surface. Verification: POLYLOGUE_FORCE_PLAIN=1 devtools lab-scenario verify-baselines --update; POLYLOGUE_FORCE_PLAIN=1 devtools lab-scenario verify-baselines.
There was a problem hiding this comment.
Actionable comments posted: 12
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
polylogue/storage/backends/queries/message_query_reads.py (1)
104-133: 🧹 Nitpick | 🔵 TrivialRemove the unused
_post_filter_by_message_typefunction.This function is dead code—it's not called anywhere in the codebase, not exported in
__all__, and the filtering it performed has been moved to SQL-level operations inget_messages_paginated.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@polylogue/storage/backends/queries/message_query_reads.py` around lines 104 - 133, Delete the dead helper function _post_filter_by_message_type from the module (remove its entire async def block) since it is unused and filtering is now implemented in SQL; also clean up any now-unused imports or type references in the same file (e.g., aiosqlite, MessageRecord) that were only used by that function to avoid linter errors.polylogue/storage/backends/queries/filter_builder.py (1)
112-120:⚠️ Potential issue | 🟠 Major | ⚡ Quick winNormalize stored separators and escape wildcards in
referenced_pathSQL.
termis normalized to/, butpath.valueis only lowercased. That makes Windows paths stored asC:\repo\file.pymiss this filter entirely. Also,_and%in real file names are treated asLIKEwildcards here, so the new path surface can return false positives.Suggested fix
if referenced_path: for term in referenced_path: - normalized = str(term).replace("\\", "/").lower() + normalized = ( + str(term) + .replace("\\", "/") + .lower() + .replace("%", "\\%") + .replace("_", "\\_") + ) where_clauses.append( f"EXISTS (SELECT 1 FROM action_events ae " f"JOIN json_each(COALESCE(ae.affected_paths_json, '[]')) path " - f"WHERE ae.conversation_id = {conv_id_col} AND LOWER(path.value) LIKE ?)" + f"WHERE ae.conversation_id = {conv_id_col} " + f"AND REPLACE(LOWER(path.value), '\\\\', '/') LIKE ? ESCAPE '\\')" ) params.append(f"%{normalized}%")🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@polylogue/storage/backends/queries/filter_builder.py` around lines 112 - 120, Normalize separators in the SQL comparison and escape LIKE wildcards: update the WHERE clause built in the referenced_path loop (where_clauses, params, conv_id_col) to compare REPLACE(LOWER(path.value), '\\', '/') against the parameter and add an ESCAPE clause, and when building params escape any '%' or '_' in normalized (str(term).replace("\\", "/").lower()) before wrapping with % for the LIKE pattern; keep the json_each join on action_events (ae) and ensure the same escape character is used in both the SQL ESCAPE and the param escaping.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@devtools/verify_cross_cuts.py`:
- Around line 71-72: The guard currently uses
path.startswith("polylogue/ui/facade") which also matches names like
polylogue/ui/facade_helpers.py; update the conditional that sets
expected.setdefault("api", "async") to only match the actual facade
module/directory by checking for exact module or directory boundaries (e.g.
replace the startswith check with path == "polylogue/ui/facade" or path ==
"polylogue/ui/facade.py" or path.startswith("polylogue/ui/facade/")). Keep the
other branch (path.startswith("polylogue/api/")) unchanged and apply this change
to the conditional involving the variables path and expected in
verify_cross_cuts.py.
In `@polylogue/cli/query_progress.py`:
- Around line 161-165: In the except asyncio.CancelledError block inside
observe_slow_query, after cancelling task and notice_task you must await them to
drain their cleanup and capture any exceptions; replace the current immediate
raise with awaiting both cancelled tasks using asyncio.gather(task, notice_task,
return_exceptions=True) (only include notice_task if not None) and then re-raise
the CancelledError, mirroring the normal-path behavior that awaits cancelled
tasks to avoid unobserved exceptions.
- Around line 147-160: The code currently calls notice_task.result() directly in
observe_slow_query which will propagate exceptions from notice_factory and abort
the command; change this so failures from notice_factory are treated as
non-fatal: wrap the await/inspection of notice_task (the asyncio.Task returned
by notice_factory) in a try/except Exception block (or use contextlib.suppress)
and on exception log the error (use the module logger or click.echo on err) and
continue to await/return the main operation_task/task result; ensure you still
cancel notice_task if operation_task completes early. Also add a regression test
that makes notice_factory raise after the threshold and asserts
observe_slow_query returns the operation result despite the notice failure.
In `@polylogue/lib/query/fields.py`:
- Around line 625-638: The message_type field configuration is wired to durable
storage (record_attr and sql_param) but is still forcing post-hydration
filtering via requires_post_filter=True and requires_content_loading=True;
remove or set both requires_post_filter and requires_content_loading to False on
the message_type Field declaration so queries can be applied in SQL instead of
the post-filter/hydration path (leave record_attr/sql_param/storage_value
as-is); update any tests or callers that assumed post-filter behavior if
necessary.
In `@polylogue/lib/query/runtime_matching.py`:
- Around line 20-28: In matches_referenced_path, affected_paths are only
lowercased so Windows-style backslashes won't match plan.referenced_path; update
the construction of affected_paths (in the loop over
_action_events_for(conversation) for path in action.affected_paths) to normalize
separators like the CLI matcher (e.g., call path.lower().replace("\\", "/") or
equivalent) before using them in the final membership checks so comparisons use
unified "/"-separated, lowercased paths.
In `@polylogue/mcp/server_resources.py`:
- Around line 65-78: The payload currently echoes the caller's conv_id instead
of the resolved canonical id from get_conversation_summary; change the
MCPMessagesListPayload conversation_id to use the canonical id from the resolved
summary (e.g. summary.id or summary.conversation_id) instead of conv_id, keeping
the rest of the logic (calls to get_conversation_summary,
get_messages_paginated, and MCPMessagePayload.from_message) unchanged so the
returned payload contains the canonical conversation id.
In `@polylogue/pipeline/materialization_runtime.py`:
- Around line 265-271: The code currently treats messages with msg.role ==
"tool" as MessageType.TOOL_USE; change the branching so messages with msg.role
== "tool" are classified as MessageType.TOOL_RESULT instead. Specifically, in
the block that sets message_type (where MessageType.MESSAGE is handled and
block_types is inspected), ensure the check for "tool_result" or msg.role ==
"tool" sets message_type = MessageType.TOOL_RESULT, and keep "tool_use" only
tied to the presence of "tool_use" in block_types (so the clause referencing
"tool_use" no longer includes msg.role == "tool"). Update the conditions around
MessageType.TOOL_RESULT and MessageType.TOOL_USE to reflect this distinction.
In `@polylogue/schemas/operator/annotations.py`:
- Around line 58-61: The helper _string_list currently drops object/array enum
members by filtering only None, str, int, float, bool; update it so it preserves
structured JSON values (dicts, lists, etc.) when building enum coverage.
Specifically, keep the early guard (return [] if value is not a Sequence or is a
str/bytes/bytearray) but change the comprehension in _string_list to include any
item except bytes/bytearray (and still allow None), then stringify each item
with str(item) so objects/arrays contribute to total_enum_values and
values_count; reference function name _string_list and the existing
Sequence/isinstance checks when making this change.
In `@polylogue/surfaces/payloads.py`:
- Line 136: The nested getattr expression that computes message_type
(getattr(getattr(message, "message_type", "message"), "value", "message")) fails
when message.message_type is already a string; update the logic where
message_type is derived (the code using message.message_type in payload
construction) to first read raw_type = getattr(message, "message_type", None),
then set message_type = "message" if raw_type is None, elif hasattr(raw_type,
"value") use raw_type.value, else use str(raw_type); replace the single nested
getattr with this branching so both Enum and plain-string message_type values
are handled correctly.
In `@tests/data/witnesses/mcp-tool-schemas.json`:
- Around line 47-55: The published JSON schema allows negative pagination values
because the source argument models for the paginated endpoints expose "limit"
and "offset" as unconstrained integers; update those source models (the fields
named "limit" and "offset" used to generate these schemas) to add lower-bound
validation so the generated schema includes "minimum": set offset >= 0 and limit
>= 1; ensure the models' validators/field constraints (e.g., pydantic Field(...)
/ OpenAPI annotations) are updated wherever the paginated argument model is
defined so all generated schema occurrences (including the instances that
produced the JSON in tests/data/witnesses/mcp-tool-schemas.json and the other
listed ranges) emit the minimum constraints.
In `@tests/unit/devtools/test_topology_projection_witness.py`:
- Line 77: The set comprehension building file_owners treats missing keys and
empty strings the same; change it so missing owner keys default to "stable" but
empty-string owners remain "" (so they will be flagged as malformed later).
Update the comprehension that defines file_owners (currently using
item.get("owner") or "stable") to explicitly distinguish missing keys (e.g., use
item.get("owner", None") or check "owner" in item) and only substitute "stable"
when the key is absent, leaving empty strings untouched.
In `@tests/unit/sources/test_dispatch_payloads.py`:
- Line 13: The test asserts only value equality for _payload_sequence(payload)
which allows Decimal vs numeric regressions to slip; update the test to assert
the converted numeric types explicitly by checking that elements inside the
returned sequence have the expected numeric types (e.g., Decimal for precise
fields) and values — locate the helper/_payload_sequence function used in tests
and the test variable payload in tests/unit/sources/test_dispatch_payloads.py
and add assertions that the "whole" and "fraction" fields are instances of the
expected numeric class (and still equal the expected numeric values) rather than
relying on loose equality alone.
---
Outside diff comments:
In `@polylogue/storage/backends/queries/filter_builder.py`:
- Around line 112-120: Normalize separators in the SQL comparison and escape
LIKE wildcards: update the WHERE clause built in the referenced_path loop
(where_clauses, params, conv_id_col) to compare REPLACE(LOWER(path.value), '\\',
'/') against the parameter and add an ESCAPE clause, and when building params
escape any '%' or '_' in normalized (str(term).replace("\\", "/").lower())
before wrapping with % for the LIKE pattern; keep the json_each join on
action_events (ae) and ensure the same escape character is used in both the SQL
ESCAPE and the param escaping.
In `@polylogue/storage/backends/queries/message_query_reads.py`:
- Around line 104-133: Delete the dead helper function
_post_filter_by_message_type from the module (remove its entire async def block)
since it is unused and filtering is now implemented in SQL; also clean up any
now-unused imports or type references in the same file (e.g., aiosqlite,
MessageRecord) that were only used by that function to avoid linter errors.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 5b400a28-b86d-4c57-ab15-f8a3e32e7f0d
📒 Files selected for processing (113)
.githooks/pre-commit.github/dependabot.ymlCHANGELOG.mddevtools/coverage_gate.pydevtools/render_topology_status.pydevtools/verify.pydevtools/verify_cross_cuts.pydevtools/verify_migrations.pydocs/cli-reference.mddocs/library-api.mddocs/plans/topology-target.yamldocs/topology-status.mddocs/verification-catalog.mdpolylogue/api/archive.pypolylogue/cli/click_app.pypolylogue/cli/commands/products.pypolylogue/cli/messages.pypolylogue/cli/query_progress.pypolylogue/cli/query_semantic.pypolylogue/cli/query_verbs.pypolylogue/cli/shared/check_models.pypolylogue/cli/shared/check_rendering_json.pypolylogue/cli/shared/check_workflow.pypolylogue/cli/shared/product_command_contracts.pypolylogue/lib/filter/builder.pypolylogue/lib/message/models.pypolylogue/lib/message/types.pypolylogue/lib/pricing.pypolylogue/lib/query/fields.pypolylogue/lib/query/plan.pypolylogue/lib/query/retrieval_candidates.pypolylogue/lib/query/runtime.pypolylogue/lib/query/runtime_filters.pypolylogue/lib/query/runtime_matching.pypolylogue/lib/query/spec.pypolylogue/lib/semantic/content_projection.pypolylogue/mcp/server_maintenance_tools.pypolylogue/mcp/server_product_tools.pypolylogue/mcp/server_prompts.pypolylogue/mcp/server_resources.pypolylogue/mcp/server_tools.pypolylogue/operations/archive.pypolylogue/pipeline/materialization_runtime.pypolylogue/pipeline/prepare_transform.pypolylogue/pipeline/run_execution.pypolylogue/pipeline/semantic_capture.pypolylogue/pipeline/services/ingest_batch.pypolylogue/pipeline/services/ingest_worker.pypolylogue/protocols.pypolylogue/schemas/operator/annotations.pypolylogue/schemas/runtime_registry.pypolylogue/schemas/sampling_sessions.pypolylogue/schemas/synthetic/build_wire_formats.pypolylogue/schemas/synthetic/relation_solver_runtime.pypolylogue/schemas/tooling_registry.pypolylogue/schemas/validator_resolution.pypolylogue/sources/dispatch.pypolylogue/sources/parsers/base_models.pypolylogue/sources/parsers/claude/code_parser.pypolylogue/storage/backends/queries/conversations_reads.pypolylogue/storage/backends/queries/conversations_search.pypolylogue/storage/backends/queries/filter_builder.pypolylogue/storage/backends/queries/mappers_archive.pypolylogue/storage/backends/queries/message_query_reads.pypolylogue/storage/backends/queries/message_query_writes.pypolylogue/storage/backends/queries/session_product_profile_reads.pypolylogue/storage/backends/schema_ddl.pypolylogue/storage/backends/schema_ddl_archive.pypolylogue/storage/fts/fts_lifecycle.pypolylogue/storage/hydrators.pypolylogue/storage/products/session/aggregates.pypolylogue/storage/products/session/records.pypolylogue/storage/query_models.pypolylogue/storage/repository/archive/queries.pypolylogue/storage/runtime/archive/records.pypolylogue/storage/search/runtime.pypolylogue/surfaces/payloads.pytests/baselines/showcase/help-bulk-export.txttests/baselines/showcase/help-main.txttests/data/witnesses/mcp-tool-schemas.jsontests/infra/semantic_facts.pytests/unit/cli/__snapshots__/test_terminal_snapshots.ambrtests/unit/cli/test_check_support_runtime.pytests/unit/cli/test_click_app.pytests/unit/cli/test_products_command_runtime.pytests/unit/cli/test_query_exec.pytests/unit/cli/test_query_exec_laws.pytests/unit/cli/test_query_progress_runtime.pytests/unit/cli/test_query_support_runtime.pytests/unit/core/test_operator_annotations.pytests/unit/core/test_pricing.pytests/unit/core/test_query_fields.pytests/unit/core/test_schema_validation.pytests/unit/devtools/test_coverage_gate.pytests/unit/devtools/test_render_topology_status.pytests/unit/devtools/test_topology_projection_witness.pytests/unit/devtools/test_verify_cross_cuts.pytests/unit/devtools/test_verify_migrations.pytests/unit/lib/test_filter_executor.pytests/unit/lib/test_query_runtime_filters.pytests/unit/lib/test_query_runtime_matching.pytests/unit/mcp/test_server_surfaces.pytests/unit/mcp/test_tool_contracts.pytests/unit/pipeline/test_differential_paths.pytests/unit/pipeline/test_ingest_batch.pytests/unit/pipeline/test_run_sources.pytests/unit/proof/test_evidence_runners.pytests/unit/sources/test_compaction.pytests/unit/sources/test_dispatch_payloads.pytests/unit/sources/test_parsers_base.pytests/unit/storage/test_retrieval_readiness_laws.pytests/unit/storage/test_scale.pytests/unit/storage/test_store_ops.py
💤 Files with no reviewable changes (1)
- polylogue/schemas/synthetic/build_wire_formats.py
Problem: PR #570 exposed stale local and CI assumptions after the interface cleanup. Integration tests still exercised the retired configured inbox source, affected-obligations path mode still inspected the default master ref in shallow CI checkouts, and the new read helpers had gaps around partial-id resolution and filter ordering. What changed: Route integration ingestion tests through explicit run --input paths, bypass ref inspection when affected-obligations receives explicit --path values, resolve conversation tokens before message/raw reads, and apply since-session filtering before message-type filtering. Added focused unit and integration coverage for the new messages/raw surfaces, diagnostics helpers, query normalizers, message types, run-state payloads, archive helpers, and message-query reads. Verification: POLYLOGUE_FORCE_PLAIN=1 uv run pytest tests/unit/storage/test_run_state_models.py tests/unit/operations/test_archive_helpers.py tests/unit/core/test_message_types.py tests/unit/storage/test_message_query_reads.py tests/unit/cli/test_diagnostics.py tests/unit/cli/test_messages.py tests/unit/core/test_facade_api.py::TestPolylogueReadSurfaces -q; POLYLOGUE_FORCE_PLAIN=1 HYPOTHESIS_PROFILE=ci uv run devtools coverage-gate; POLYLOGUE_FORCE_PLAIN=1 uv run devtools verify --quick.
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@polylogue/api/archive.py`:
- Around line 269-271: The method currently returns None when summary is
missing; instead return an empty paginated result to keep the shape consistent.
Replace the early return after calling await
self.operations.get_conversation_summary(conversation_id) so that when summary
is None the method returns an empty page (e.g., ([], 0)) — matching how
polylogue/operations/archive.py and get_raw_records_for_conversation normalize
unresolved conversation ids — so callers of this method don't need to
special-case None.
In `@polylogue/lib/query/runtime_filters.py`:
- Around line 148-149: The since_session_id filter is being applied to the
already-filtered results, so if earlier predicates removed the anchor
conversation the constraint is lost; change the logic to compute the
since-session set by calling _apply_since_session on the full conversations
collection (not results) when plan.since_session_id is present, then intersect
that returned set with the current results (e.g., replace results =
_apply_since_session(results, plan.since_session_id) with computing since_scope
= _apply_since_session(conversations, plan.since_session_id) and then set
results = results ∩ since_scope) so the since_session_id constraint survives
other filters.
In `@tests/integration/test_cli_query_mode.py`:
- Around line 113-123: The test currently only asserts payload["total"] == 1 but
not the returned array lengths, which can mask pagination regressions; update
the assertions around messages_payload and raw_payload (the block that uses
messages_payload, raw_result/run_cli, and raw_payload) to also assert
len(messages_payload["messages"]) == 1 and len(raw_payload["records"]) == 1,
keeping the existing checks for roles/text and raw_id so the test verifies both
reported totals and actual returned page sizes.
In `@tests/unit/cli/test_diagnostics.py`:
- Around line 116-119: The assertion is too broad because assert "2" in rendered
matches "1.2s"; update the test in tests/unit/cli/test_diagnostics.py to target
the turns cell specifically: after building rendered from
_console_print(env).call_args_list, locate the final data row (e.g.,
splitlines() and pick the last non-empty line) or parse the table columns and
assert the turns column equals "2" (or use a regex with word boundaries like
r"\b2\b") instead of a loose substring check; reference the rendered variable
and the _console_print(env) call to find where to change the assertion.
In `@tests/unit/storage/test_message_query_reads.py`:
- Around line 89-97: Add a test case that verifies pagination with a non-zero
offset when filtering by message_type: create at least two messages with
message_type="summary" in the "conv-message-reads" conversation, then call
get_messages_paginated(conn, "conv-message-reads", message_type="summary",
limit=1, offset=1) and assert that total equals the full count of "summary"
messages and that the single returned message is the second message's
message_id; this ensures get_messages_paginated applies the message_type filter
before LIMIT/OFFSET.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 925463fe-f559-4551-b66c-f7f7c8dd5bd7
📒 Files selected for processing (29)
.github/workflows/ci.ymldevtools/affected_obligations.pypolylogue/api/archive.pypolylogue/lib/query/runtime_filters.pytests/baselines/showcase/help-bulk-export.txttests/baselines/showcase/help-diagnostics-pace.txttests/baselines/showcase/help-diagnostics-tools.txttests/baselines/showcase/help-diagnostics-turns.txttests/baselines/showcase/help-diagnostics.txttests/baselines/showcase/help-main.txttests/baselines/showcase/help-messages.txttests/baselines/showcase/help-raw.txttests/baselines/showcase/help-run-publish.txttests/baselines/showcase/help-run.txttests/integration/test_chronology_extremes.pytests/integration/test_cli_query_mode.pytests/integration/test_ingestion_chaos.pytests/integration/test_ingestion_interrupts.pytests/unit/cli/test_click_app.pytests/unit/cli/test_diagnostics.pytests/unit/cli/test_messages.pytests/unit/core/test_content_projection.pytests/unit/core/test_facade_api.pytests/unit/core/test_message_types.pytests/unit/core/test_query_fields.pytests/unit/lib/test_query_runtime_filters.pytests/unit/operations/test_archive_helpers.pytests/unit/storage/test_message_query_reads.pytests/unit/storage/test_run_state_models.py
Problem: CodeRabbit and Codex surfaced final correctness gaps on PR #570 after the CI fix push, including message-type SQL routing, since-session composition, canonical MCP ids, stricter MCP pagination schemas, FTS readiness, and slow-query cancellation/notice handling. What changed: Keep message_type on the SQL-backed query path, compute since-session scope from the full candidate set, canonicalize MCP message/raw resource ids, add lower-bound MCP pagination schemas, restore full FTS readiness checks before search, harden path matching and LIKE escaping, classify tool-role messages as tool results, and remove the dead content-block post-filter helper. Added or tightened regression coverage for these review findings. Verification: POLYLOGUE_FORCE_PLAIN=1 uv run pytest tests/unit/cli/test_query_progress_runtime.py tests/unit/devtools/test_verify_cross_cuts.py tests/unit/lib/test_query_runtime_matching.py tests/unit/lib/test_query_runtime_filters.py tests/unit/mcp/test_tool_schema_witness.py tests/unit/mcp/test_server_surfaces.py tests/unit/mcp/test_tool_contracts.py tests/unit/pipeline/test_ingest_batch.py tests/unit/core/test_operator_annotations.py tests/unit/sources/test_dispatch_payloads.py tests/unit/storage/test_message_query_reads.py tests/integration/test_cli_query_mode.py::test_cli_messages_and_raw_routes_read_conversation_records tests/unit/cli/test_diagnostics.py tests/unit/core/test_facade_api.py::TestPolylogueReadSurfaces -q; POLYLOGUE_FORCE_PLAIN=1 HYPOTHESIS_PROFILE=ci uv run devtools coverage-gate; POLYLOGUE_FORCE_PLAIN=1 uv run devtools verify --quick; git diff --check.
## Summary Clarifies the query/read interface by splitting referenced-file filters from working-directory filters, adds dedicated paginated read surfaces, and folds in the completed post-close bot-review fixes. ## Problem The archive surfaces overloaded `path` terminology across referenced files and working-directory prefixes, recall workflows had to hydrate whole conversations to read messages, and the closed-issue bot-review audit had accumulated actionable correctness findings across CLI, MCP, storage, pipeline, schema, and devtools contracts. ## Solution - Rename query-facing file-reference filters to `referenced_path` / `--referenced-path` / `.referenced_path()` while retaining `cwd_prefix` for working-directory filtering, and remove the old query `path`/`path_terms` surfaces. - Add consistent `offset` support and dedicated message/raw read surfaces across CLI and MCP, with `get_conversation` and conversation resources becoming header-only. - Add shared message-type classification and preserve summary/tool/thinking message types as queryable stored message facets. - Normalize MCP resources, MCP product tool schemas, generated references, docs, witnesses, and CLI baselines to match the new surfaces. - Address #544/#569 review findings around product filters, MCP signatures, payload Decimal handling, cost exactness, readiness checks, pipeline contracts, topology/proof/devtools checks, schema/operator handling, and query/test robustness. ## Verification ```text pytest -q tests/unit/mcp/test_tool_schema_witness.py tests/unit/mcp/test_tool_contracts.py tests/unit/mcp/test_server_surfaces.py tests/unit/devtools/test_coverage_gate.py tests/unit/devtools/test_verify_cross_cuts.py tests/unit/core/test_operator_annotations.py tests/unit/core/test_pricing.py tests/unit/sources/test_dispatch_payloads.py tests/unit/cli/test_products_command_runtime.py # 135 passed in 13.98s devtools verify --quick # verify: all checks passed devtools verify # verify: all checks passed; pytest ok (194.7s) git diff --check # passed pre-push hook # devtools verify --quick passed ``` Closes #544 Closes #569 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Message-type support across storage, APIs, CLI and payloads; content projection for message-level filtering; new diagnostics/messages/raw CLI verbs and pagination offset support * Blob-store JSON report included in check output * **Changed** * Renamed path filters to referenced-path across CLI and APIs; conversation reads split into summaries + paginated messages; DB schema version bumped; query and search readiness checks relaxed/tightened as appropriate * **Documentation** * CLI reference, help text, and API docs updated to reflect new flags and names <!-- end of auto-generated comment: release notes by coderabbit.ai --> ## Final Verification - `POLYLOGUE_FORCE_PLAIN=1 uv run pytest tests/unit/cli/test_query_progress_runtime.py tests/unit/devtools/test_verify_cross_cuts.py tests/unit/lib/test_query_runtime_matching.py tests/unit/lib/test_query_runtime_filters.py tests/unit/mcp/test_tool_schema_witness.py tests/unit/mcp/test_server_surfaces.py tests/unit/mcp/test_tool_contracts.py tests/unit/pipeline/test_ingest_batch.py tests/unit/core/test_operator_annotations.py tests/unit/sources/test_dispatch_payloads.py tests/unit/storage/test_message_query_reads.py tests/integration/test_cli_query_mode.py::test_cli_messages_and_raw_routes_read_conversation_records tests/unit/cli/test_diagnostics.py tests/unit/core/test_facade_api.py::TestPolylogueReadSurfaces -q` — `158 passed` - `POLYLOGUE_FORCE_PLAIN=1 HYPOTHESIS_PROFILE=ci uv run devtools coverage-gate` — `5937 passed, 2 xfailed`, coverage `90.05%` - `POLYLOGUE_FORCE_PLAIN=1 uv run devtools verify --quick` — `verify: all checks passed` - GitHub PR checks passed: lint, typecheck, showcase-verify, tests on Python 3.11/3.12/3.13, actionlint, Nix, CodeQL, GitGuardian, CodeRabbit, PR metadata.
|
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
Clarifies the query/read interface by splitting referenced-file filters from working-directory filters, adds dedicated paginated read surfaces, and folds in the completed post-close bot-review fixes.
Problem
The archive surfaces overloaded
pathterminology across referenced files and working-directory prefixes, recall workflows had to hydrate whole conversations to read messages, and the closed-issue bot-review audit had accumulated actionable correctness findings across CLI, MCP, storage, pipeline, schema, and devtools contracts.Solution
referenced_path/--referenced-path/.referenced_path()while retainingcwd_prefixfor working-directory filtering, and remove the old querypath/path_termssurfaces.offsetsupport and dedicated message/raw read surfaces across CLI and MCP, withget_conversationand conversation resources becoming header-only.Verification
Closes #544
Closes #569
Summary by CodeRabbit
New Features
Changed
Documentation