Repository navigation
feat(insights): emit pathology findings as candidate assertions (#2383) - #2450
Conversation
…ions (Ref #2383) Problem: the pathology detectors (#2448) and the distribution view (#2449) surfaced findings only as a computed report. #2383's final acceptance criterion is that detector output is emitted as Assertion(kind=pathology) candidate rows queryable via the #2006 assertion lifecycle and promotable through the existing accept/reject/defer flow — with no auto-injection. Solution: - core/enums.py: add AssertionKind.PATHOLOGY. assertions.kind is plain TEXT with no DB CHECK, so this is schema-free (no user-tier version bump). - storage/.../user_write.py: add assertion_id_for_pathology_finding (a deterministic id over session/kind/detector-version/detail/evidence) and upsert_pathology_findings_as_assertions, which mirrors each PathologyFinding as a PRIVATE, non-injected (context_policy inject=False) CANDIDATE assertion. An operator-promoted candidate (status != CANDIDATE) is never downgraded. Register PATHOLOGY in ASSERTION_CLAIM_KINDS so it appears in default claims. - storage/.../user_audit.py: register the "pathologies" overlay surface so the every-kind audit invariant holds. - api/archive.py: add Polylogue.materialize_pathology_assertions(spec, *, limit) — runs the detectors over a matched scope (mirroring pathology_report, including the truncation warning) and upserts the candidates in one user.db transaction, returning the count. Map "pathology" support to "inference". The loop is complete and consumed: materialize → list_assertion_claims( kinds="pathology") (existing MCP/CLI/API query) → mark candidates accept/reject (existing promotion lifecycle). Nothing flows into agent context automatically. Verification: - devtools test tests/unit/storage/test_archive_tiers_assertions.py → 25 passed (round-trip: emit → query candidates → idempotent re-emit → promoted-not-downgraded) - devtools test tests/unit/storage/test_archive_tiers_user_audit.py → 2 passed - devtools test tests/unit/cli/test_archive_maintenance_cli.py → 26 passed - devtools test tests/unit/cli/test_assertion_candidates.py → 3 passed - devtools test tests/unit/insights/test_postmortem.py → 27 passed - mypy clean on all changed files Ref #2383 Co-Authored-By: Claude <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
More reviews will be available in 22 minutes and 54 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 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 credits. 🚦 How do rate 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 see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ 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 |
Summary
Closes the final acceptance criterion of #2383: the deterministic pathology
detectors now emit their findings as
Assertion(kind=pathology)candidate rowsthat are queryable through the existing #2006 assertion-claims surface and
promotable through the standard accept/reject/defer lifecycle — with no
auto-injection into agent context.
Problem
#2448 shipped the detectors and #2449 shipped the distribution view, but both
surfaced findings only as a computed report. #2383's last AC requires detector
output to be queryable via #2006 (
assertions where kind:pathology) and torequire explicit promotion (Ref #2182). Until now there was no persisted,
promotable representation of a pathology finding.
Solution
core/enums.py: addAssertionKind.PATHOLOGY. Theassertions.kindcolumn is plain
TEXTwith no DBCHECK, so this is schema-free — nouser-tier
SCHEMA_VERSIONbump.storage/.../user_write.py:assertion_id_for_pathology_finding(...)— a deterministic id over(session, kind, detector_version, detail, evidence)so rebuilds areidempotent.
upsert_pathology_findings_as_assertions(...)— mirrors eachPathologyFindingas a PRIVATE, non-injected(
context_policy={"inject": False, "promotion_required": True})CANDIDATE assertion. An operator-promoted candidate
(
status != CANDIDATE) is never silently downgraded.PATHOLOGYinASSERTION_CLAIM_KINDSso it appears in thedefault claims query.
storage/.../user_audit.py: register thepathologiesoverlay surfaceso the "every AssertionKind has a surface" audit invariant holds.
api/archive.py:Polylogue.materialize_pathology_assertions(spec, *, limit)— runs the detectors over a matched scope (mirroringpathology_report, including the truncation warning) and upserts thecandidates in one
user.dbtransaction, returning the count written. Mapspathologywork-packet support toinference.docs/openapi/search.yamlanddocs/schemas/cli-output/query-unit-envelope.schema.json(the AssertionKindenum is embedded in both).
The loop is complete and consumed:
materialize_pathology_assertions→list_assertion_claims(kinds="pathology")(existing MCP/CLI/API query) →mark candidates accept/reject(existing promotion lifecycle).Verification
devtools test tests/unit/storage/test_archive_tiers_assertions.py→ 25 passed(new round-trip: emit → query candidates → idempotent re-emit →
promoted-candidate-not-downgraded; plus deterministic-id stability)
devtools test tests/unit/storage/test_archive_tiers_user_audit.py→ 2 passeddevtools test tests/unit/cli/test_archive_maintenance_cli.py→ 26 passeddevtools test tests/unit/cli/test_assertion_candidates.py→ 3 passeddevtools test tests/unit/insights/test_postmortem.py→ 27 passeddevtools render all --check→ exit 0mypyclean on all changed files#2383 status
All acceptance criteria now satisfied:
EvidenceRefs (feat(insights): deterministic agent-workflow pathology detectors #2448 + this PR)Ref #2383
🤖 Generated with Claude Code