Repository navigation
feat(assertions): add candidate judgment workflow (#2182) - #2204
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughAdds a complete candidate assertion judgment workflow. The storage tier gains ChangesCandidate Assertion Judgment
Sequence Diagram(s)sequenceDiagram
participant Operator
participant CLI as polylogue ops state candidates
participant Facade as PolylogueArchiveMixin
participant Storage as user_write.py (user.db)
Operator->>CLI: accept <candidate_ref> --reason TEXT
CLI->>Facade: judge_assertion_candidate(candidate_ref, decision="accept", reason=...)
Facade->>Storage: _archive_judge_assertion_candidate → judge_assertion_candidate(conn, ...)
Storage->>Storage: validate decision, resolve candidate
Storage->>Storage: _promote_candidate_assertion (status→active, evidence+supersedes wiring)
Storage->>Storage: upsert JUDGMENT assertion (deterministic id, evidence refs)
Storage-->>Facade: ArchiveAssertionJudgmentEnvelope
Facade-->>CLI: AssertionJudgmentResultPayload
CLI-->>Operator: JSON or text (candidate → resulting_assertion_ref)
sequenceDiagram
participant Operator
participant DebtCLI as polylogue ops debt list
participant ArchiveDebt as archive_debt_list
participant CandidateRows as _assertion_candidate_rows
participant Storage as user_write.py (user.db)
Operator->>DebtCLI: --kind assertion-candidate --only-actionable
DebtCLI->>ArchiveDebt: archive_debt_list(kind="assertion-candidate")
ArchiveDebt->>CandidateRows: _assertion_candidate_rows(user.db path)
CandidateRows->>Storage: list_assertion_candidates(conn)
Storage-->>CandidateRows: list[ArchiveAssertionEnvelope]
CandidateRows-->>ArchiveDebt: list[ArchiveDebtRowPayload] (kind=assertion-candidate, stage=candidate-judgment)
ArchiveDebt-->>DebtCLI: ArchiveDebtListPayload
DebtCLI-->>Operator: formatted debt rows
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 Completes the candidate-judgment follow-up surfaced by the broad verification pass after #2204: command help aliases, facade status routing, assertion audit coverage, and generated showcase baselines now include the new candidate judgment surface. ## Problem The #2182 implementation merged cleanly through CI, but a seed-testmon verification run immediately afterward exercised broader catalog checks and found stale surfaces: two `--limit` options lacked the expected `-l` alias, the archive facade status route catalog did not know the new async candidate/explain methods, the user-tier audit omitted `AssertionKind.JUDGMENT`, and the SQL interpolation audit line keys had shifted. ## Solution - Added `-l` aliases to `polylogue ops debt list --limit` and `polylogue ops state candidates list --limit`. - Registered `explain_import`, `list_assertion_candidates`, and `judge_assertion_candidate` in the facade route catalog. - Added judgment assertions to the user overlay audit map. - Updated the audited SQL line keys for the assertion projection f-strings. - Regenerated the two affected showcase help baselines. ## Verification - `devtools test tests/unit/cli/test_theme_aliases_help_markdown.py::test_flag_aliases_consistent tests/unit/cli/test_status.py::test_archive_facade_route_catalog_covers_public_async_facade tests/unit/storage/test_archive_tiers_user_audit.py::test_user_overlay_audit_covers_every_assertion_kind tests/unit/storage/test_no_string_interpolated_sql.py::test_no_unaudited_string_interpolated_sql tests/unit/storage/test_no_string_interpolated_sql.py::test_audited_sites_are_real_violations -q` -> `5 passed` - `devtools render all --check` -> pass - `devtools lab scenario verify-baselines` -> `Ran 102 exercises; All baselines match.` - `devtools verify --quick` -> exit_code 0 Closes #2182
Summary
Adds the explicit candidate-assertion judgment workflow: candidate rows can be listed, accepted, rejected, deferred, or superseded through the assertion substrate, exposed through CLI and Python API, and surfaced as actionable archive debt.
Problem
#1883 made assertions a real substrate and transform candidates can now exist as private candidate rows, but those candidates had no durable operator workflow. A candidate could be stored and queried, yet there was no first-class judgment record, no promotion path into an active assertion, and no operator cockpit row showing that a candidate needed review. That left model/transform confidence too close to durable truth.
Solution
polylogue/storage/sqlite/archive_tiers/user_write.pywithjudgmentassertions pluslist_assertion_candidates()andjudge_assertion_candidate()helpers.AssertionJudgmentPayload/AssertionJudgmentResultPayloadmodels inpolylogue/surfaces/payloads.py.Polylogue.list_assertion_candidates()andPolylogue.judge_assertion_candidate().polylogue ops state candidates {list,accept,reject,defer,supersede}without creating a new root command.polylogue ops debt list --kind assertion-candidateas actionable user-owned debt rows.docs/search.mdand regenerates generated CLI/schema/quality surfaces.Judgments are assertion rows, not a second truth system.
acceptandsupersedecreate active assertions with evidence pointing back to the candidate andsupersedes=("assertion:<candidate>",).rejectanddeferpreserve a judgment reason and leave candidate lifecycle state durable. Candidate rows remain private/no-inject unless explicitly promoted or requested by a later surface.Acceptance Matrix
list_assertion_candidates, API wrapper, CLI JSON list test.ops state candidatesand Python API.assertion-candidatedebt rows and projection test.docs/search.mdnow documents candidate, judgment, active, rejected, deferred, and superseded lifecycle semantics.Closes #2182.
Verification
Focused behavior suite:
Generated surfaces:
Quick gate:
Summary by CodeRabbit
Release Notes
New Features
polylogue ops state candidatescommand group with subcommands to manage candidate assertions: accept, reject, defer, supersede, and list.polylogue ops debt list --kind assertion-candidate.Documentation
state candidatescommand documentation.