Repository navigation
feat(api): expose annotation batch import - #2782
Conversation
Problem: annotation-batch import was available through CLI and MCP but Python callers had to bypass the documented facade and import the product operation directly.\n\nWhat changed: bind the shared import operation to Polylogue and cover the real schema, live-reference, and user-tier persistence route.\n\nRef polylogue-9e5.16.\n\nCo-Authored-By: Claude <[email protected]>
|
Warning Review limit reached
Next review available in: 8 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 62cc332758
ℹ️ 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".
| return await import_annotation_batch(cast("Polylogue", self), request) | ||
| return await import_annotation_batch(cast("Polylogue", self), request, registry=registry) |
There was a problem hiding this comment.
Honor active archive root when importing annotations
When a Polylogue is opened with db_path pointing at a different archive root than archive_root (a supported mode in this facade), this delegation passes self straight to the importer. The importer persists to Path(poly.archive_root) / "user.db", while resolve_ref and the rest of the archive facade resolve/read against _active_archive_root(self.config), so the import can validate against the active archive but write the batch/assertions into the configured root instead. In that setup the call reports success, but subsequent API reads against the active archive will not see the imported annotations.
Useful? React with 👍 / 👎.
Problem: a facade opened with a db path under a different archive root validated annotation references against the active archive but persisted user state under the configured root.\n\nWhat changed: bind the importer to the facade's active archive root while retaining real facade reference resolution, and cover the split-root route.\n\nRef polylogue-9e5.16.\n\nCo-Authored-By: Claude <[email protected]>
Problem: the facade import test asserted only an admitted candidate, so it\ncould not prove schema and live-reference rejection.\n\nWhat changed: include invalid enum and unresolved evidence rows in the real\nfacade route, then assert both failure causes and partial persistence.\n\nRef polylogue-9e5.16.
|
Adversarial review iteration 1 Findings and fixes:
Verification:
What survived scrutiny:
Ref polylogue-9e5.16. |
Problem: the facade's default registry branch was not exercised.\n\nWhat changed: import a candidate through the production delegation schema\nwithout a registry argument, proving the importer default remains selected.\n\nRef polylogue-9e5.16.
|
Adversarial review iteration 2 Finding fixed:
Verification:
What survived scrutiny:
Ref polylogue-9e5.16. |
|
Adversarial review iteration 3 — zero new findings Completed the required hostile pass: fetched A fresh independent cold reviewer reported: No code change was required in this iteration. The API route remains covered by the split-root custom-registry validation/evidence test and the default production-registry test. Ref polylogue-9e5.16. |
|
Final acceptance-criteria matrix for
No criterion is misframed. The tractable in-lane runtime gap is satisfied by commits Ref polylogue-9e5.16. Ref polylogue-s1kr. |
…800,2781 2ilz (origin-interop, PR #2794), 3v1.1 (capture-hardening, PR #2785), and qqyg (hooks-capture, PR #2781) fully satisfied — closed. 9e5.16 (api-parity, PR #2782), 57rp/5k5l (capture-hardening, PR #2785), and 7fj (beads-ingest, PR #2800) partially satisfied — noted with disposition, left open. Co-Authored-By: Claude <[email protected]>
Summary
This PR audits the Python facade against the current CLI and MCP operation
surface, fixes the confirmed typed annotation-batch import gap, and records the
remaining work as proposals rather than claiming unimplemented governance.
Problem
Polyloguelackedimport_annotation_batch, although both CLI and MCP exposedthe bounded shared operation. The library therefore required callers to bypass
the promised facade. The audit also found that the existing parity manifest
cannot govern semantic operation bindings or API documentation drift.
Solution
Polylogue.import_annotation_batch(request, *, registry=None).when
db_pathand configuredarchive_rootdiffer.candidate persistence, and the split-root write boundary.
Capability matrix
A dash means no equivalent implementation was found in that surface. It is not
an intention claim without a governed binding. Operation names are source-audit
identifiers; they must become a checked-in generated manifest in the follow-up.
Shared archive/query/read
find/readsearch,list_sessions,archive_get_sessionsearch,list_sessions,get_sessionread --view messagesget_messagesget_messages_paginated,bulk_get_messagesread --view rawraw_artifactsget_raw_artifacts_for_sessionget_session_tree,get_session_topologyget_logical_sessionread --view neighbors/correlationneighbor_candidates,correlate_*find … then readquery_unitsquery_unitsfind --explain,config query-completions,facetsstatus,analyze,ops statusstats,readiness_checkstats,health_checkread --view context-image,continuebuild_context_image,compose_context_preamblecontext_image_payload,context_preamble_payloadimport --explainexplain_importexplain_importUser state and annotations
marklist/add/remove,bulk_tag_sessionsread,mark,deletelist_annotations,save_annotation,delete_annotationannotations importimport_annotation_batchimport_annotation_batchannotations joinjoin_typed_annotationsmark candidates *read,mark,deletecontinue,dashboard,deleteagents *,agents handoffInsights, index, and maintenance
analyze insights *analyze insights *,analyze usageanalyze pace/turns,continueops insights *analyze toolssession_tool_timingops maintenance,ops embed *importparse_file,parse_sourcesops maintenance *deletedelete_sessiondelete_session_safeExplicit surface-specific inventory
CLI-only interaction, credentials, lifecycle, backup, reset, GC, and destructive
maintenance commands remain terminal guardrails. MCP-only prompts/resources and
role-gated maintenance wrappers are agent-protocol concerns. Python lifecycle,
raw cursor/write primitives, repository vectors, and
SessionFilterarelower-level library mechanics rather than CLI/MCP capability promises.
Bead acceptance-criteria status
review artifact, not a rendered checked-in source of truth.
fixes annotation-batch import; governed bindings and absences still need the
follow-up manifest.
and devtools proposal.
docs/library-api.mdaccurate against the facade: deferred; it does notyet list this new method.
Follow-up proposals
explicit intentional absences; render and drift-check the matrix. Unknown or
unbound live entries must fail.
session-tool-timingcontract, then bindfacade and MCP through it.
verification to the docs/devtools surface, including mutation-sensitive tests.
ArchiveStorereads behind the facade where DTOsemantics already match.
Verification
TMPDIR=/realm/tmp POLYLOGUE_PYTEST_BASETEMP_ROOT=/realm/tmp/polylogue-pytest nix develop --command devtools test tests/unit/api/test_facade_contracts.py::test_facade_import_annotation_batch_persists_candidate_provenance1 passed in 11.11sdevtools verify --quickAnti-vacuity: the test drives the real facade, importer, custom schema registry,
live ref resolver, and
user.dbwriter. Removing facade delegation, enumvalidation, live evidence-ref resolution, or active-root persistence makes an
assertion fail.
Ref polylogue-9e5.16.