Skip to content

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

Open
dripsmvcp wants to merge 4 commits into
vouchdev:testfrom
dripsmvcp:feat/bulk-clear-auto-claims
Open

feat(claims): bulk clear for auto-approved claims (#433)#434
dripsmvcp wants to merge 4 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

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
@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: 4a21b26c-cb24-46e7-945a-d5efa6352fa9

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

regenerate schemas/claim.schema.json for the new auto_approved /
proposed_by fields, and clear ruff findings in the claims-clear command
(B904 raise-from, E501 line length, SIM102 nested-if) and its test
(F841 unused binding).
@github-actions github-actions Bot added the schemas json schemas and generated schema assets label Jul 7, 2026
the test branch carries main's test suite but a heavily gutted src/
tree — cli.py alone was missing ~3.4k lines (why/trace/impact/fsck and
more), plus large deletions across health, server, jsonl_server,
context, storage, bundle, index_db and sessions. the result was 334
failing tests and 31 mypy errors on the base, none related to the
bulk-clear feature.

restore the affected modules from origin/main (the healthy reference)
so the branch's code matches the tests it ships, then re-apply the
vouchdev#433 bulk-clear feature on top. also restores the provenance subsystem
(prov_edges table + index_db helpers) the deletions had orphaned.

result: mypy clean, ruff clean, full non-embeddings suite green.
@github-actions github-actions Bot added retrieval context, search, synthesis, and evaluation embeddings embedding-backed retrieval size: XL 1000 or more changed non-doc lines and removed size: M 200-499 changed non-doc lines labels Jul 8, 2026
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.
@github-actions github-actions Bot added the review-ui browser review ui label Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli command line interface embeddings embedding-backed retrieval mcp mcp, jsonl, and http surfaces retrieval context, search, synthesis, and evaluation review-ui browser review ui schemas json schemas and generated schema assets size: XL 1000 or more 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