Skip to content

feat(claims): bulk clear for auto-approved claims (#433)#434

Merged
plind-junior merged 3 commits into
vouchdev:testfrom
dripsmvcp:feat/bulk-clear-auto-claims
Jul 10, 2026
Merged

feat(claims): bulk clear for auto-approved claims (#433)#434
plind-junior merged 3 commits into
vouchdev:testfrom
dripsmvcp:feat/bulk-clear-auto-claims

Conversation

@dripsmvcp

@dripsmvcp dripsmvcp commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

what changed

adds a way to bulk-clear auto-saved claims while keeping human-reviewed knowledge intact. a new clear_claims() lifecycle op filters durable claims by auto-approval status and an optional --before date, then archives (never deletes) the matches under a single audit event. exposed on all three surfaces: vouch claims-clear (cli), kb.clear_claims (mcp + jsonl), and registered in capabilities.METHODS. two additive fields on the claim model — auto_approved and proposed_by — record provenance at approval time so the filter has something to key on (auto_approved is set when the approver equals the proposer, i.e. trusted-agent mode).

why

when review.approver_role: trusted-agent is enabled, an agent can approve its own proposals, so a bad calibration run can silently pile up low-quality claims the user never actually reviewed. today there's no way to walk that back short of hand-archiving each one. this gives users a reset button that is precise (only auto-approved claims by default), reversible (archive, not delete), previewable (--dry-run), and fully audited. closes #433.

proof

captured from a live run of the shipped cli against a fresh kb in trusted-agent mode — three auto-approved claims cleared, the human-reviewed claim left as working, one claim.bulk_clear audit event written:

what might break

  • on-disk claim shape changes (additive). Claim gains auto_approved: bool = false and proposed_by: str | none = none. existing claims load fine — the defaults apply — so no migration is required.
  • not retroactive. claims approved before this change carry auto_approved: false, so claims-clear --auto-only will not catch historical auto-approvals; only claims approved after upgrade are flagged. a backfill could be a follow-up.
  • new kb.* method + new audit event. kb.clear_claims joins the method surface and claim.bulk_clear is a new audit-log event type. adapters that enumerate methods or parse the audit stream will see both.
  • no files move; no existing field changes shape; no existing method changes behaviour.

vep

this touches the surface (new kb.* method, new on-disk fields, new audit event), which per the template needs an accepted vep first. flagging it — happy to write one up if this should be gated on that before review.

tests

  • new behaviour has a test — tests/test_clear_claims.py, 6 cases: auto-only filter, --before date filter, dry-run makes no changes, already-archived skipped, auto_only=false clears all, audit event shape
  • make check passes locally — the new suite is green, but test_capabilities fails in my env because the embeddings extras aren't installed (pre-existing surface-parity gaps), and mypy/ruff weren't runnable without the venv tooling. needs a clean run before merge.
  • CHANGELOG.md updated under ## [Unreleased] — not done yet.
vouch-433-proof

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 74e83987-a7de-4964-b4f0-1b5602943c20

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added cli command line interface mcp mcp, jsonl, and http surfaces storage kb storage, migrations, schemas, and proposals tests tests and fixtures size: M 200-499 changed non-doc lines labels Jul 7, 2026
@dripsmvcp dripsmvcp changed the title feat(claims): add bulk clear for auto-approved claims feat(claims): bulk clear for auto-approved claims (#433) Jul 7, 2026
@plind-junior

Copy link
Copy Markdown
Member

Update the webapp as well and attach the screenshot of the webapp with cli

@github-actions github-actions Bot added schemas json schemas and generated schema assets retrieval context, search, synthesis, and evaluation embeddings embedding-backed retrieval size: XL 1000 or more changed non-doc lines review-ui browser review ui and removed size: M 200-499 changed non-doc lines labels Jul 7, 2026
@dripsmvcp dripsmvcp force-pushed the feat/bulk-clear-auto-claims branch from 303ef12 to fae7d0d Compare July 10, 2026 01:17
@github-actions github-actions Bot added docs documentation, specs, examples, and repo guidance ci github actions and automation labels Jul 10, 2026
enables users to bulk clear auto-saved claims while preserving manually
reviewed knowledge. when auto-approval is enabled (review.approver_role:
trusted-agent), users can reset by clearing auto-approved claims in bulk.

implemented:
- new lifecycle function: clear_claims() filters by auto-approval status
  and optional date range, archives matching claims
- added Claim.auto_approved and Claim.proposed_by fields
- updated approval logic to set auto_approved flag when approver == proposer
- cli command: vouch claims-clear [--auto-only] [--before DATE] [--confirm]
- mcp tool: kb_clear_claims() with dry-run support
- jsonl handler for kb.clear_claims in jsonl_server
- registered in capabilities.METHODS for parity
- comprehensive test suite covering filters, dry-run, audit trail

design:
- archives rather than deletes to preserve audit history
- single bulk audit event logs all affected claim ids
- no review gate (consistent with supersede/archive)
- dry-run support for preview before confirmation

fix: vouchdev#433
adds a "clear" view to the browser review-ui that mirrors
`vouch claims-clear`: a GET renders a dry-run preview of every
auto-approved durable claim (optionally filtered by a --before date),
and a POST archives them under a single `claim.bulk_clear` audit event.

routes through `lifecycle.clear_claims`, so the audit trail is identical
to the cli and mcp surfaces — no parallel data path. auto_only is fixed
on, so the console can only ever clear auto-approved calibration cruft,
never human-reviewed knowledge. progressive-enhancement friendly (plain
form posts) with a js confirm() guard and a hub refresh broadcast.
@dripsmvcp dripsmvcp force-pushed the feat/bulk-clear-auto-claims branch from fae7d0d to 0321c13 Compare July 10, 2026 01:21
@github-actions github-actions Bot added size: L 500-999 changed non-doc lines and removed docs documentation, specs, examples, and repo guidance ci github actions and automation retrieval context, search, synthesis, and evaluation embeddings embedding-backed retrieval schemas json schemas and generated schema assets size: XL 1000 or more changed non-doc lines labels Jul 10, 2026
the bulk-clear feature landed with three ruff violations in the
`claims-clear` cli handler (B904 missing `raise ... from`, E501 long
line, SIM102 nested `if`) and an unused `claim2` binding in the test
(F841), plus stale committed schemas — the additive `auto_approved` /
`proposed_by` claim fields and the `delete` proposal kind weren't
reflected in `schemas/`. regenerate via `scripts/gen_schemas.py` and
clear the lint errors so the ci lint/type/drift gates pass.
@github-actions github-actions Bot added the schemas json schemas and generated schema assets label Jul 10, 2026
@plind-junior plind-junior merged commit bb8335f into vouchdev:test Jul 10, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli command line interface mcp mcp, jsonl, and http surfaces review-ui browser review ui schemas json schemas and generated schema assets size: L 500-999 changed non-doc lines storage kb storage, migrations, schemas, and proposals tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants