Skip to content

refactor: drop provider vocabulary from public read surfaces (#1810) - #1901

Merged
Sinity merged 3 commits into
masterfrom
feature/refactor/provider-origin-sweep-1810
Jun 15, 2026
Merged

Sinity merged 3 commits into
masterfrom
feature/refactor/provider-origin-sweep-1810

Conversation

@Sinity

@Sinity Sinity commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

Removes Provider-token vocabulary from the public CLI/MCP/daemon read surfaces, leaving them origin-only (#1810). Provider-wire surfaces (schema packages) are intentionally retained.

Problem

Provider (lab/product-wire identity) leaked onto public read surfaces that should speak Origin (source-origin: claude-code-session, chatgpt-export, …). #1810's anti-goal: no provider wording on public filters/payloads.

Solution (3 sites)

  • cli/archive_query.py: dropped the dead provider/exclude_provider→origin fallback in _resolve_origins/_resolve_excluded_origins (no --provider flag exists on the query surface — the fallback was API/dead). Public root query is origin-only.
  • mcp/server_insight_tools.py: provider param → origin on the public read tool.
  • daemon/http.py: provider facet label → origin (label-only change).
  • core/sources.py: small helper for the origin/provider boundary mapping where internal contracts still need a provider token.
  • Added tests/unit/core/test_public_surface_origin_vocabulary.py — guard asserting no provider vocabulary on these public read surfaces.

Retained (correctly): schema.py's --provider flags — schema generate/promote/audit operate on provider-wire schema packages, a #1810-exempt surface.

Verification

devtools test test_archive_query test_public_surface_origin_vocabulary   # 116 passed
devtools verify --quick   # exit 0 (mypy --strict, render-all --check, ...)

Ref #1810

Sinity and others added 2 commits June 15, 2026 14:12
Public CLI/MCP/daemon read surfaces must speak the origin vocabulary
only; the provider-wire Provider enum had leaked into three of them.

- cli/archive_query.py: remove the dead provider/exclude_provider root
  query fallbacks and the _PROVIDER_TO_ARCHIVE_ORIGIN map. The root CLI
  only exposes --origin/--exclude-origin, so the provider branches were
  unreachable.
- daemon/http.py, mcp/server_insight_tools.py: route the insight
  source_name -> origin projection through a new shared helper instead of
  importing the Provider enum locally.
- core/sources.py: add source_name_to_origin(), the canonical bridge that
  projects a stored source_name (origin token or provider-wire token) onto
  the public origin vocabulary.
- guard test asserting these three surfaces never bind the Provider enum
  and that origin resolution no longer honors provider tokens.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 15, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 42 minutes and 42 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: bccf421c-f48e-4ab9-89c0-e8c227c1f4d5

📥 Commits

Reviewing files that changed from the base of the PR and between a7f7ce5 and 9cdb041.

📒 Files selected for processing (6)
  • polylogue/cli/archive_query.py
  • polylogue/core/sources.py
  • polylogue/daemon/http.py
  • polylogue/mcp/server_insight_tools.py
  • tests/unit/cli/test_archive_query.py
  • tests/unit/core/test_public_surface_origin_vocabulary.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/provider-origin-sweep-1810

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

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

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 837c9a9933

ℹ️ 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".

Comment thread polylogue/core/sources.py Resolved
…n bridge (#1810)

Codex P2 on #1901: source_name_to_origin fed Source.family tokens through
Provider.from_string; families like gemini-export/drive-takeout are not
provider values, so they normalized to unknown and grouped sessions under
unknown-export instead of their real origin. Map family tokens via
_FAMILY_TO_PROVIDER first, then fall back to provider-wire parsing. +test.

Co-Authored-By: Claude <[email protected]>
@Sinity

Sinity commented Jun 15, 2026

Copy link
Copy Markdown
Owner Author

Fixed in the latest push: source_name_to_origin now maps source-family tokens (gemini-export, drive-takeout, …) via _FAMILY_TO_PROVIDER before the provider-wire fallback, so those sessions project to their real origin (e.g. aistudio-drive) instead of unknown-export. Added a regression test asserting family tokens resolve to the same origin as their provider equivalent and never to unknown. Good catch.

@Sinity
Sinity merged commit 5a38a0b into master Jun 15, 2026
13 checks passed
@Sinity
Sinity deleted the feature/refactor/provider-origin-sweep-1810 branch June 15, 2026 13:05
Sinity added a commit that referenced this pull request Jun 15, 2026
…1818) (#1907)

## Summary
Converges the CLI's 6 ad-hoc `{mode:"mutation",...}` JSON outputs onto
the shared typed `MutationResultPayload` (the contract MCP and the
daemon already use), completing #1818 P4. Also fixes 3 unrelated
master-red tests (see below).

## Problem
The CLI emitted hand-rolled mutation dicts (`archive_query.py`),
diverging from the `MutationResultPayload` MCP/daemon use — #1818 wants
one machine-output mutation contract.

## Solution (option A — additive)
- `surfaces/payloads.py`: `MutationResultPayload` gains two optional
fields, both default `None` so MCP/daemon `exclude_none=True` dumps are
**byte-unchanged** (no mcp/daemon call site touched): `operation: str |
None` (bulk-mutation discriminator) and `session_ids: tuple[str,...] |
None` (dry-run enumeration). `status` docstring notes the new
`preview`/`aborted` CLI values.
- `cli/archive_query.py`: all 6 sites build `MutationResultPayload` and
emit `.to_json(exclude_none=True)` (one finite JSON value). Mappings:
`changed→affected_count`, `matched→session_count`,
`deleted→affected_count`, `dry_run/aborted→status`, combined tag+meta →
`tag_count`+`applied_count` (documented inline).

## Bundled fix (master-red, #1810 regression)
3 tests in `test_query_exec_laws.py` were left red on master by the
#1810 provider sweep (#1901) — they fed `{provider: codex}` expecting
origin mapping that was intentionally removed; PR CI missed it (test job
is PR-skipped). Their inputs are updated to `origin`/`exclude_origin`.
Bundled here because this PR already edits that file (avoids a
conflict).

## Verification
```
devtools test test_query_exec_laws test_verb_cardinality   # 99 passed (3 ex-red now green)
devtools verify --quick   # exit 0
```
No snapshots/baselines pin the mutation shape (confirmed).

Ref #1818

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **New Features**
* Mutation operations now support additional status indicators for
dry-run previews and user-aborted confirmations.

* **Refactor**
  * Standardized response format for mutation and deletion operations.
* Updated archive filtering parameters to use `origin` instead of
`provider`.

* **Tests**
  * Updated test suite to match revised operation response formats.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 63.F021 / P2: fixed-already at the checked revision: source_name_to_origin checks _FAMILY_TO_PROVIDER before provider-wire parsing at polylogue/core/sources.py:449-451. Canonical gemini-export and drive-takeout family tokens no longer fall through to the unknown provider.

Only the rows listed above are dispositioned. Held findings remain open.

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.

1 participant