Repository navigation
feat(annotations): seed ontology schemas and governed bootstrap lifecycle - #3059
Conversation
|
Warning Review limit reached
Next review available in: 43 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 (16)
✨ 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: e8668378ea
ℹ️ 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".
…ycle Problem: polylogue-dve1 asks for versioned seed annotation schemas (activity, goal-event, outcome-evidence, knowledge-artifact, reusability) plus a governed archive-local ontology bootstrap where informal tags can only ever nominate candidates, never mutate directly into formal ontology facts. Solution: five new AnnotationSchema definitions registered as immutable v1 rows in BUILTIN_ANNOTATION_SCHEMAS, replayed data-only on fresh and same-version user.db (no USER_SCHEMA_VERSION bump -- annotation_schemas is already the versioned registry and assertions.kind is plain TEXT, verified against current storage/sqlite/archive_tiers/user.py). Adds an OntologyCandidateNomination/OntologyCandidateGovernance state machine (nominate -> accept/rename/split/reject) that runs the full read/judge/register/receipt sequence inside one BEGIN IMMEDIATE, reusing the existing judge_assertion_candidate lifecycle. Two new AssertionKind values (ONTOLOGY_CANDIDATE, ONTOLOGY_GOVERNANCE) wired through enums.py, user_write.py candidate admission, user_audit.py exhaustive audit, and the OpenAPI/CLI-output generated schemas. Originated as external-agent packet ann-01-ontology-seed-r01 (GPT Pro wave 2, snapshot 536a53e). Verified independently rather than trusting the packet's own claims: reconciled two real defects the packet's sandboxed environment could not catch -- docs/plans/layering.yaml was missing the new persist_builtin_annotation_schemas entrypoint declaration (verify layering failed clean on master, confirmed by stash-testing baseline), and mypy --strict found 17 real errors (redundant JSONValue casts, a list[str] vs list[JSONValue] dict-item mismatch, and 8 test call sites indexing into JSONValue | None without narrowing -- fixed via require_json_document instead of suppressing with type: ignore). Verification: - devtools test tests/unit/annotations/ tests/unit/storage/test_archive_tiers_assertions.py -> 155 passed - devtools test tests/unit/annotations/test_schema.py tests/unit/annotations/test_write.py tests/unit/storage/test_archive_tiers_user_audit.py tests/unit/devtools/test_render_openapi.py tests/unit/cli/test_cli_output_schemas.py tests/unit/storage/test_archive_tiers_ddl.py -> 154 passed (includes the two sqlite-vec round-trip tests the packet's sandbox could not run) - devtools verify --quick -> exit 0 (ruff format/check, mypy --strict, render all --check, layering, all lab checks) Ref polylogue-dve1 Co-Authored-By: Claude <[email protected]>
e866837 to
ba59da7
Compare
|
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
Implements polylogue-dve1: five versioned v1 seed annotation schemas
(activity, goal-event, outcome-evidence, knowledge-artifact,
reusability) plus a governed archive-local ontology candidate/bootstrap
lifecycle (nominate -> accept/rename/split/reject), landed on the
existing typed-annotation substrate (annotation_schemas,
annotation_batches, assertions).
Problem
polylogue-dve1 asks for packaged seed ontologies plus an ontology
bootstrap loop where informal tags/affinity can nominate ontology
candidates but never become formal ontology facts without a judged
annotation batch/schema. No such packaged vocabulary or governance
state machine existed yet.
Solution
polylogue/annotations/schema.py: five newAnnotationSchemaconstants (
seed.activity@v1,seed.goal-event@v1,seed.outcome-evidence@v1,seed.knowledge-artifact@v1,seed.reusability@v1), added toBUILTIN_ANNOTATION_SCHEMASalongside the pre-existing
delegation.discourse@v1.polylogue/storage/sqlite/archive_tiers/user_annotations.py:persist_builtin_annotation_schemas()replays the six built-in rowsidempotently; wired into
bootstrap.pyfor both fresh-DB init andsame-version replay on an already-current
user.db. NoUSER_SCHEMA_VERSIONbump -- verified against currentarchive_tiers/user.pythatannotation_schemasis already theimmutable versioned registry and
assertions.kindis plainTEXTwith no
CHECKconstraint, so new vocabulary is pure data.polylogue/annotations/write.py:OntologyCandidateNomination/nominate_ontology_candidate()writes a private, non-injectedAssertionKind.ONTOLOGY_CANDIDATErow carrying source tag refs,affinity, classifier definition, multi-view proposals/agreement, and
privacy/excision refs, kept structurally separate from
confidence.OntologyCandidateGovernance/govern_ontology_candidate()runsthe full read/judge/register/receipt sequence in one
BEGIN IMMEDIATE, reusingjudge_assertion_candidate()for the durablelifecycle and writing a deterministic
AssertionKind.ONTOLOGY_GOVERNANCEreceipt. Schema persistence failure rolls back the whole transaction.
AssertionKindvalues wired throughcore/enums.py,user_write.py(candidate-review queue admission),user_audit.py(exhaustive per-kind audit), and regenerated
docs/openapi/search.yaml/docs/schemas/cli-output/query-unit-envelope.schema.json.polylogue/annotations/importer.py: the existingAnnotationBatchImportRequestroute now resolves archive-local(operator-promoted) schemas via a one-schema local registry, without
polluting the process-global registry.
Provenance and independent verification
This originated as external-agent packet
ann-01-ontology-seed-r01(GPT Pro wave 2, snapshot
536a53efac0cbe4a2473ad379e4db49ef3fce74d,unreviewed). I treated its claims adversarially rather than trusting
its own
TESTS.md:assertions.kindis unconstrainedTEXTandannotation_schemasisthe existing immutable versioned registry -- no user-tier DDL/migration
needed,
USER_SCHEMA_VERSIONstays 9.git apply --checkagainst currentorigin/master(12 commitsahead of the packet's snapshot): clean, one 23-line hunk offset.
sandbox couldn't catch:
devtools verify layeringfailed (writer_module_entrypoint_inventory_mismatch)because
docs/plans/layering.yamlwasn't updated for the newpersist_builtin_annotation_schemasentrypoint. Confirmed this isa real regression, not pre-existing, by stash-testing the baseline
(
masteralone:No layering violations found).mypy --strictfound 17 real errors: redundantcast(JSONValue, ...)calls, onelist[str]assigned into adict[str, JSONValue]dict-item position, and 8 test call sites indexing
JSONValue | Nonewith# type: ignore[index]comments thatdidn't even match the mypy version's actual error code
(
call-overload). Fixed viarequire_json_document()narrowinginstead of suppressing.
sqlite-vec-dependent round-trip tests(
test_write.py::TestAnnotationRoundtripWithQueryAndJudge) thepacket's bare container couldn't execute -- both pass here.
Verification
Not run: the full non-quick
devtools verify(testmon inner loop) andthe post-merge heavy CI
testsuite; per-PR CI intentionally skips it.Ref polylogue-dve1