Repository navigation
refactor: add query field descriptor catalog (#363) - #363
Conversation
Problem: query field semantics were duplicated across spec descriptions, plan descriptions, runtime capability checks, storage pushdown, and stats-join detection. Keeping those lists aligned made query changes risky and obscured which layer owned each field fact. What changed: introduced a shared query field descriptor catalog and wired existing spec, plan, search-hit, runtime capability, and storage stats-join paths through it without changing the CLI/MCP/facade query contract. Added descriptor tests covering descriptions, filter presence, SQL pushdown params, record-query shape, and stats metadata. Verification: ruff check on touched files; mypy on touched files and full polylogue tree; focused query, MCP, and storage pytest slices; devtools render-all --check; devtools verify. Closes #321
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 34 minutes and 44 seconds. ⌛ 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 (8)
✨ 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 |
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary: Adds a shared query field descriptor catalog and uses it to drive existing query-spec, query-plan, runtime capability, search-hit routing, and storage pushdown metadata paths. Problem: #321 tracked semantic duplication found in #315: query fields were restated across spec descriptions, plan descriptions, filter presence checks, runtime capability checks, storage record-query mapping, SQL pushdown parameters, and stats-join detection. That made adding or changing one query field require hand-updating several parallel inventories. Solution: Introduced `polylogue/lib/query_fields.py` as the shared descriptor catalog for query field facts: spec/plan attributes, active predicates, descriptions, record-query and SQL parameter mappings, stats-join requirements, runtime post-filter/content-loading flags, SQL-count blockers, action-event stats blockers, and search-hit evidence blockers. Wired existing consumers through the catalog without changing CLI/MCP/facade signatures: - `query_spec.py` now delegates descriptions and filter-presence checks to descriptors. - `query_plan_description.py` delegates plan descriptions and presence checks. - `query_plan.py` delegates record-query and SQL pushdown mapping. - `query_runtime_plan.py` delegates runtime capability predicates. - `query_search_hits.py` delegates simple-message-hit blockers. - `storage/backends/queries/filter_builder.py` delegates stats-join detection. Added descriptor tests covering spec/plan descriptions, active field names, SQL pushdown params, record-query tuple/list shape, and stats-join metadata. Verification: - `ruff check polylogue/lib/query_fields.py polylogue/lib/query_spec.py polylogue/lib/query_plan.py polylogue/lib/query_plan_description.py polylogue/lib/query_runtime_plan.py polylogue/lib/query_search_hits.py polylogue/storage/backends/queries/filter_builder.py tests/unit/core/test_query_fields.py` - `mypy polylogue/lib/query_fields.py polylogue/lib/query_spec.py polylogue/lib/query_plan.py polylogue/lib/query_plan_description.py polylogue/lib/query_runtime_plan.py polylogue/lib/query_search_hits.py polylogue/storage/backends/queries/filter_builder.py tests/unit/core/test_query_fields.py` - `pytest -q tests/unit/core/test_query_fields.py tests/unit/lib/test_filter_executor.py tests/unit/core/test_filters_props.py -q` - `pytest -q tests/unit/cli/test_query_exec.py tests/unit/cli/test_click_app.py tests/unit/mcp/test_tool_contracts.py tests/unit/core/test_query_retrieval_candidates.py` (`175 passed`) - `pytest -q tests/unit/storage/test_store_ops.py tests/unit/storage/test_scale.py tests/unit/storage/test_search_misc.py tests/unit/storage/test_query_mappers.py` (`119 passed`) - `mypy polylogue/ tests/unit/core/test_query_fields.py` - `devtools render-all --check` - `devtools verify` (`all checks passed`) - push hook: `devtools verify --quick` (`all checks passed`) Closes #321
Summary
Adds a shared query field descriptor catalog and uses it to drive existing query-spec, query-plan, runtime capability, search-hit routing, and storage pushdown metadata paths.
Problem
#321 tracks semantic duplication found in #315: query fields were restated across spec descriptions, plan descriptions, filter presence checks, runtime capability checks, storage record-query mapping, SQL pushdown parameters, and stats-join detection. That made adding or changing one query field require hand-updating several parallel inventories.
Solution
Introduced
polylogue/lib/query_fields.pyas the shared descriptor catalog for query field facts: spec/plan attributes, active predicates, descriptions, record-query and SQL parameter mappings, stats-join requirements, runtime post-filter/content-loading flags, SQL-count blockers, action-event stats blockers, and search-hit evidence blockers.Wired existing consumers through the catalog without changing CLI/MCP/facade signatures:
query_spec.pynow delegates descriptions and filter-presence checks to descriptors.query_plan_description.pydelegates plan descriptions and presence checks.query_plan.pydelegates record-query and SQL pushdown mapping.query_runtime_plan.pydelegates runtime capability predicates.query_search_hits.pydelegates simple-message-hit blockers.storage/backends/queries/filter_builder.pydelegates stats-join detection.Added descriptor tests covering spec/plan descriptions, active field names, SQL pushdown params, record-query tuple/list shape, and stats-join metadata.
Verification
ruff check polylogue/lib/query_fields.py polylogue/lib/query_spec.py polylogue/lib/query_plan.py polylogue/lib/query_plan_description.py polylogue/lib/query_runtime_plan.py polylogue/lib/query_search_hits.py polylogue/storage/backends/queries/filter_builder.py tests/unit/core/test_query_fields.pymypy polylogue/lib/query_fields.py polylogue/lib/query_spec.py polylogue/lib/query_plan.py polylogue/lib/query_plan_description.py polylogue/lib/query_runtime_plan.py polylogue/lib/query_search_hits.py polylogue/storage/backends/queries/filter_builder.py tests/unit/core/test_query_fields.pypytest -q tests/unit/core/test_query_fields.py tests/unit/lib/test_filter_executor.py tests/unit/core/test_filters_props.py -qpytest -q tests/unit/cli/test_query_exec.py tests/unit/cli/test_click_app.py tests/unit/mcp/test_tool_contracts.py tests/unit/core/test_query_retrieval_candidates.py(175 passed)pytest -q tests/unit/storage/test_store_ops.py tests/unit/storage/test_scale.py tests/unit/storage/test_search_misc.py tests/unit/storage/test_query_mappers.py(119 passed)mypy polylogue/ tests/unit/core/test_query_fields.pydevtools render-all --checkdevtools verify(all checks passed)devtools verify --quick(all checks passed)Closes #321