Repository navigation
feat(assertions): persist finding candidates - #2812
Conversation
|
Warning Review limit reached
Next review available in: 4 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 |
Problem: detector claims with query and result-set evidence had no durable lifecycle-safe representation, so they could not be judged or promoted. What changed: - add finding.v1 candidate assertions with deterministic provenance identity - register findings in claim, candidate-review, audit, and generated schemas - preserve opaque provenance refs for the rxdo substrate contract Compatibility/migration: AssertionKind is stored in schema-free TEXT; no user-tier migration is required. Ref polylogue-rxdo.4 Co-Authored-By: Claude <[email protected]>
f22e7c6 to
1772b9d
Compare
Merge-conductor rebase noteRebased onto master, which already had a minimal partial rxdo.4 delivery
Verification: focused suite (test_archive_tiers_assertions.py + |
…6,2817,2818 th0 (test-harness-2 #2817) and 212.9.1 (fable-demo-2 #2814) fully satisfied — closed. ra3w/s7ae.8/20d.2 (basetemp-fix #2815, live-performance continuation #2816) supplementary progress noted on already-open beads. rxdo.9 (analysis-rigor #2818, program adoption only), rxdo.4 (rxdo-lifecycle #2812, fuller FINDING implementation but resolve-proof/provenance projection still deferred), rxdo.2/rxdo.3 (rxdo-substrate #2813, explicitly incomplete per its own adversarial review) noted with disposition. Co-Authored-By: Claude <[email protected]>
…ne, frontier labels, design enrichment From the 2026-07-13 open-set characterization (504 open, 355 ready): raise mhx.2 P4->P2 (gated all three P2 flagship demos + 7yk5 — largest inversion in the graph; demand-driven policy slice noted); demote 27m<-b5l blocks to related (blue-green rebuild is operational quality, not hard correctness ordering — un-blocks the P1 excision lane); release rxdo.4 stale in_progress claim and narrow remaining scope to the two deferred items (#2812 delivered the writer); add horizon:frontier to the 10 ready P0/P1s lacking horizon labels; write grounded design fields for 9e5.8.4, of39, 9rw0, 09rn. Graph lint clean (no cycles, no missing AC). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_013v95mgEuw3uo9AsnpvhDbm
… provenance (rxdo cluster) (#2899) ## Summary Advances the rxdo epic's core query/evidence-contract substrate: a real (non-test-double) production `CanonicalPlanEvaluator`, wired as the default daemon standing-query evaluator; a lossless predicate round-trip that makes it possible; `finding:<id>` refs resolving to a queryable provenance projection; and a declarative improvement-loop registry. ## Problem Prior PRs (#2813, #2826, #2812, #2791) landed substantial rxdo schema and contract substrate but explicitly flagged the same real gap in their own closing notes: `CanonicalPlanEvaluator` had exactly one kind of implementation anywhere in the repo — hand-rolled fakes inside test files. `make_default_convergence_stages()` called `make_standing_query_stage(db_path)` with no evaluator at all, so the standing-query convergence stage was permanently inert in production. `record_query_run()` (ops.db telemetry writer) had zero production callers. `resolve_ref("finding:<id>")` returned the generic substrate-pending stub even though findings have been real queryable assertion rows since PR #2812. rxdo.11 asked for a declared loop registry that didn't exist. ## Solution - **`polylogue/archive/query/predicate.py`**: `predicate_from_payload()` — a lossless round trip colocated with each predicate dataclass's own `to_payload()`. Not a reverse-compiler over free-form text; every branch inverts one dataclass's own projection. - **`polylogue/archive/query/production_evaluator.py`**: `ArchiveCanonicalPlanEvaluator`, the first real evaluator implementation. Reconstructs a typed predicate from a durable `query:<hash>` definition's canonical AST, binds field context through the existing planner-internal `_bind_predicate_context` seam, executes through the same `SessionFilter` every surface uses, and records a bounded `ops.db` `query_runs` row (`surface="daemon-internal"`) per evaluation — a genuine production caller of `record_query_run`. Legacy protocol-v0 identities and non-session grains fail closed with named errors. - **`polylogue/daemon/convergence_stages.py`**: `make_default_convergence_stages` now injects `ArchiveCanonicalPlanEvaluator` by default — the named remaining item from rxdo.5's notes. - **`polylogue/storage/sqlite/finding_provenance.py`** + **`polylogue/surfaces/payloads.py`** (`FindingProvenancePayload`): `compute_finding_provenance()` re-derives a finding's declared `query_ref`/`result_set_ref`/`baseline_ref`/`current_ref` plus generic `evidence_refs`, resolves each live, and reports a current/stale/unknown staleness verdict. - **`polylogue/api/archive.py`**: `resolve_ref("finding:<id>")` dispatches to the new resolver instead of the pending-kind stub. - **`polylogue/insights/improvement_loops.py`**: `LOOP_REGISTRY` declaring all 13 loop instances from the rxdo.11 design as the 5-tuple (watch/measure/propose/judge/artifact). Every entry is `status="horizon"` — no scheduler exists yet, and a dedicated test asserts `active_loops()` stays empty until one does. ## Non-goals / explicitly deferred - Cross-surface (CLI/MCP/daemon-web/API) query-run recording parity — only the daemon-internal evaluator surface records today. - `from result-set:<id>` / `from query:<hash>` DSL execution wired into the CLI (rxdo.6) — the evaluator this needed now exists, but CLI/MCP command-surface wiring is a separate, larger change against `cli/archive_query.py` (2500+ lines) deferred to a follow-up. - Cohort resolution (`resolve_cohort` raises `NotImplementedError`). - rxdo.8 (DB-native analysis recipes): needs a new user-tier schema migration slot, and polylogue-60i5's corrective contract requires a declared window + two-consumer stabilization before any new durable table lands. Not attempted here. - rxdo.11's two active pilots (L1/L2 executing through a shared scheduler): blocked on polylogue-37t.17 (L1's read-access log) and an L2 classifier-residue detector, neither of which exist. Only the declaration registry landed. ## Verification - `devtools test tests/unit/archive/query/test_production_evaluator.py tests/unit/archive/query/test_predicate_payload_roundtrip.py tests/unit/daemon/test_standing_queries_default_evaluator.py tests/unit/insights/test_improvement_loops.py tests/unit/api/test_facade_contracts.py tests/unit/daemon/test_standing_queries.py tests/unit/archive/query/test_evaluator.py tests/unit/daemon/test_convergence_stages.py tests/unit/daemon/test_convergence_final_state.py` — 351 passed, 6 pre-existing failures. Those 6 (`test_archive_tiers_api_timeline_insights_read_index_tier`, `test_facade_judges_candidate_assertion_in_user_tier`, `test_archive_tiers_api_session_costs_read_index_tier`, `test_archive_tiers_api_tag_rollups_read_index_and_user_tiers`, `test_archive_tiers_api_latency_profiles_read_index_tier`, `test_archive_tiers_api_archive_coverage_reads_index_tier`) were independently confirmed present with identical count/names on unmodified master (verified via a temporary `git stash` + rerun of `tests/unit/api/test_facade_contracts.py` alone). - `mypy --strict` over all touched source + test files: clean. - `ruff check` / `ruff format`: clean. - `devtools render all --check`: clean (topology projection regenerated for the 3 new modules). - `devtools verify --quick`: exit 0 (ran automatically on push via the pre-push hook). ## Anti-vacuity `test_evaluate_matches_real_archive_rows` depends on the actual predicate reconstruction + `SessionFilter` execution: removing `predicate_from_payload()` or the `SessionFilter.list_summaries()` call breaks it, since the assertion checks the archive actually filtered by origin against real ingested rows (not a toy replica). `test_evaluate_records_a_production_query_run` depends on the `record_query_run` call: removing it breaks the test, since it reads the row back from a real `ops.db`. `test_default_stage_set_evaluates_a_watched_query_without_an_injected_fake` depends on the `make_default_convergence_stages` wiring: it injects no fake evaluator at all, only the production one reached through the real factory function. Ref polylogue-rxdo.2, polylogue-rxdo.3, polylogue-rxdo.4, polylogue-rxdo.5, polylogue-rxdo.6, polylogue-rxdo.8, polylogue-rxdo.11 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Finding references now display detailed provenance, evidence resolution status, and staleness information. - Canonical archive queries can be executed with exact session results and safeguards against self-triggering evaluations. - Query predicates can be reconstructed reliably from saved representations. - Added a registry for tracking planned improvement loops. - **Documentation** - Updated topology documentation and status totals to reflect newly registered components. - **Tests** - Added coverage for finding provenance, query execution, predicate restoration, and default standing-query behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude <[email protected]>
Summary
Adds
AssertionKind.FINDINGand apolylogue.finding.v1writer that stores detector claims in the existing candidate/judge/promotion lifecycle.Problem
Detector results with denominators, statistics, and query/result evidence had no durable claim row, so they could not be reviewed, judged, or cited through the assertion lifecycle.
Solution
FindingAssertion, deterministic identity over claim, target, canonical value, sorted evidence, and detector ref, plus theupsert_findings_as_assertionswriter.query_ref,result_set_ref), optional delta baseline/current refs, and an additiveexpectedshape for later rigor work.assertions.kindis schema-freeTEXT.Acceptance criteria
upsert_findings_as_assertionsand idempotency testjudge_assertion_candidateunchangedVerification
TMPDIR=/realm/tmp POLYLOGUE_PYTEST_WORKERS=1 devtools test tests/unit/storage/test_archive_tiers_assertions.py tests/unit/storage/test_archive_tiers_user_audit.py→30 passed.TMPDIR=/realm/tmp devtools verify --quick→ all 15 steps passed.devtools render all --check→ exit 0; noout of syncoutput.Anti-vacuity: the new lifecycle test invokes the production writer against a real user-tier SQLite database, then sends its resulting candidate through the production judgment function. Removing candidate coercion, evidence propagation, or deterministic identity makes that test fail.
Adversarial review notes
Iteration 1: no legitimate gaps found across all 5 ACs.
Ref polylogue-rxdo.4