Skip to content

fix(query): cover API facade names in descriptors - #698

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/api-query-descriptor-parity
May 2, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/api-query-descriptor-parity

Conversation

@Sinity

@Sinity Sinity commented May 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds API-facing query-name ownership to the query descriptor registry and tests the public facade query/read signatures against the query/read descriptor catalogs.

Problem

#621 is about making one descriptor vocabulary own the public query/read surface. MCP query names were already covered, but the Python facade still had implicit mappings like search(source=...) selecting providers without any descriptor-level ownership. That leaves API names outside the drift guard even though they are part of the public surface.

Solution

  • Added api_names to QueryFieldDescriptor and exposed api_query_field_names().
  • Recorded API names for the facade search/list query concepts: query, provider aliases provider/source, since, and query limit.
  • Added tests that inspect PolylogueArchiveMixin.search() and list_conversations() and require every public parameter to be covered by query or read descriptors.
  • Added tests that inspect point-read facade methods (get_conversation, get_conversations, get_messages_paginated, get_raw_artifacts_for_conversation, and resume_brief) and require every read parameter to be covered by read descriptors.

Ref #621

Verification

  • pytest tests/unit/core/test_query_fields.py tests/unit/core/test_query_read_fields.py -q → 12 passed.
  • ruff format --check polylogue/archive/query/fields.py tests/unit/core/test_query_fields.py tests/unit/core/test_query_read_fields.py → 3 files already formatted.
  • ruff check polylogue/archive/query/fields.py tests/unit/core/test_query_fields.py tests/unit/core/test_query_read_fields.py → all checks passed.
  • devtools verify --quick → all checks passed.
  • Pre-push devtools verify --quick → all checks passed.

Summary by CodeRabbit

  • Tests
    • Added validation tests ensuring comprehensive API parameter coverage for query methods

Problem: #621 requires public query/read names to be owned by descriptors across CLI, MCP, API, and storage. MCP names were covered, but API facade names like search(source=...) still mapped to query concepts implicitly.\n\nWhat changed: add API-facing query names to QueryFieldDescriptor, expose api_query_field_names(), and assert the facade query/read method signatures are covered by query and read descriptors.\n\nVerification: pytest tests/unit/core/test_query_fields.py tests/unit/core/test_query_read_fields.py -q; ruff format --check polylogue/archive/query/fields.py tests/unit/core/test_query_fields.py tests/unit/core/test_query_read_fields.py; ruff check polylogue/archive/query/fields.py tests/unit/core/test_query_fields.py tests/unit/core/test_query_read_fields.py
Copilot AI review requested due to automatic review settings May 2, 2026 11:54
@coderabbitai

coderabbitai Bot commented May 2, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a5d34170-1d56-491a-8922-f21c1c7be883

📥 Commits

Reviewing files that changed from the base of the PR and between 2d42f29 and 8603332.

📒 Files selected for processing (3)
  • polylogue/archive/query/fields.py
  • tests/unit/core/test_query_fields.py
  • tests/unit/core/test_query_read_fields.py

📝 Walkthrough

Walkthrough

The PR extends QueryFieldDescriptor with an api_names tuple field, populates it for several key descriptors (query_terms, providers, since, limit), introduces api_query_field_names() aggregation function, and adds tests validating API method parameters are fully covered by field descriptors.

Changes

API Field Coverage Validation

Layer / File(s) Summary
Data Shape
polylogue/archive/query/fields.py
QueryFieldDescriptor gains api_names: tuple[str, ...] field with empty default.
Descriptor Population
polylogue/archive/query/fields.py
api_names populated for query_terms ("query"), providers ("provider", "source"), since ("since"), and limit ("limit") descriptors.
Aggregation Function
polylogue/archive/query/fields.py
api_query_field_names() introduced to collect all descriptor.api_names across QUERY_FIELD_DESCRIPTORS and return as frozenset[str].
Export
polylogue/archive/query/fields.py
api_query_field_names added to __all__.
Test Coverage
tests/unit/core/test_query_fields.py, tests/unit/core/test_query_read_fields.py
Two tests added: one validates PolylogueArchiveMixin.search and list_conversations parameters against combined api_query_field_names() and read_field_names_for_surface("api"); the other validates individual API method parameter coverage.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 The fields now have names so API-bright,
Descriptors labeled left and right,
Aggregation brings them all to bear,
Tests confirm that coverage is fair! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/api-query-descriptor-parity

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.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Polylogue Proof Pack

Refs: origin/master..HEAD
Changed paths: 3

Affected Domains

  • none with affected claims

Focused Gates

  • none

Required PR Gates

  • devtools verify --quick — full PR gate remains explicit
  • devtools verify — full PR gate remains explicit

Optional Confidence Gates

  • devtools build-package — deployment readiness gate; run when packaging or release confidence matters
  • nix flake check — deployment readiness gate; run when packaging or release confidence matters

Known Gaps

  • none for domains with affected claims

Oracle / Cost

  • oracle mix: {}
  • cost tier: {}
  • stable affected obligations: 0
  • agent judgment cells: 0

@Sinity
Sinity merged commit e4d42b0 into master May 2, 2026
10 of 15 checks passed
@Sinity
Sinity deleted the feature/fix/api-query-descriptor-parity branch May 2, 2026 11:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the query descriptor registry to explicitly own API-facing query parameter names (in addition to existing MCP names) and adds drift-guard tests that ensure the public Python facade’s query/read method signatures stay fully covered by the query/read descriptor catalogs (Ref #621).

Changes:

  • Add api_names to QueryFieldDescriptor plus api_query_field_names() for API name inventory.
  • Record API aliases for key facade query params (query, provider/source, since, limit) in the query descriptor catalog.
  • Add unit tests that introspect PolylogueArchiveMixin method signatures and assert all public parameters are covered by query/read descriptors.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
polylogue/archive/query/fields.py Adds API-name ownership to query descriptors and exposes api_query_field_names() for drift-guarding.
tests/unit/core/test_query_fields.py Adds coverage test ensuring search() / list_conversations() facade params are owned by query/read descriptor vocabularies.
tests/unit/core/test_query_read_fields.py Adds coverage test ensuring point-read facade method params are owned by read descriptors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

for method_name in method_names:
params = set(signature(getattr(PolylogueArchiveMixin, method_name)).parameters)
params.discard("self")
assert params - covered == set()
for method_name in method_names:
params = set(signature(getattr(PolylogueArchiveMixin, method_name)).parameters)
params.discard("self")
assert params - covered == set()
Sinity added a commit that referenced this pull request May 7, 2026
## Summary

Adds API-facing query-name ownership to the query descriptor registry and tests the public facade query/read signatures against the query/read descriptor catalogs.

## Problem

#621 is about making one descriptor vocabulary own the public query/read surface. MCP query names were already covered, but the Python facade still had implicit mappings like `search(source=...)` selecting providers without any descriptor-level ownership. That leaves API names outside the drift guard even though they are part of the public surface.

## Solution

- Added `api_names` to `QueryFieldDescriptor` and exposed `api_query_field_names()`.
- Recorded API names for the facade search/list query concepts: `query`, provider aliases `provider`/`source`, `since`, and query `limit`.
- Added tests that inspect `PolylogueArchiveMixin.search()` and `list_conversations()` and require every public parameter to be covered by query or read descriptors.
- Added tests that inspect point-read facade methods (`get_conversation`, `get_conversations`, `get_messages_paginated`, `get_raw_artifacts_for_conversation`, and `resume_brief`) and require every read parameter to be covered by read descriptors.

Ref #621

## Verification

- `pytest tests/unit/core/test_query_fields.py tests/unit/core/test_query_read_fields.py -q` → 12 passed.
- `ruff format --check polylogue/archive/query/fields.py tests/unit/core/test_query_fields.py tests/unit/core/test_query_read_fields.py` → 3 files already formatted.
- `ruff check polylogue/archive/query/fields.py tests/unit/core/test_query_fields.py tests/unit/core/test_query_read_fields.py` → all checks passed.
- `devtools verify --quick` → all checks passed.
- Pre-push `devtools verify --quick` → all checks passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants