cascade option for propose_delete: page-cited claims are undeletable
what you're trying to do
removing an approved claim from the console usually fails with
cannot delete claim <id>: referenced by page '<page>'. the block is
correct — referenced_by() in src/vouch/proposals.py:1113 refuses a
delete while anything still points at the target — but in a compiled kb it
means most claims are permanently undeletable. this kb has 1638 claims
across 107 pages, and pages cite claims in bulk, so a large fraction of
claims are page-referenced and there is no supported way to remove them.
two cases are worse than "just referenced":
- supersede pairs are mutually locked. if b supersedes a, then a is
blocked (b lists it in
supersedes) and b is blocked (a'ssuperseded_bypoints at b). no delete ordering escapes it, so neither end of a supersede chain can ever be removed. same forcontradicts. - the relation check is kind-blind.
proposals.py:1131-1136compares the claim id against bare relation endpoints, which carry no kind tag, so a relation about a same-slug entity or page blocks an unrelated claim. the existing comment defers this to the spec's slug-collision caveat, but it shows up here as an unexplainable refusal.
what you've tried
kb.propose_deleteon the claim — refused at propose time, and again at approve time (proposals.py:1211).kb.supersede— the right move when there is a replacement claim, but it does not help when the claim is simply wrong noise that should not exist. it also creates a new permanently-undeletable pair.- hand-editing the page's
claims:list to drop the reference first — works, but it is exactly the "parallel data path that bypassesproposals.approve()" the north star forbids.
suggested shape
keep the gate. make the referrers part of the proposal, so the reviewer sees and approves the whole cascade as one unit.
kb.propose_delete(target_kind, target_id, cascade=false)— new optional flag, default off (today's behaviour is unchanged).- with
cascade=true,propose_deletewalksreferenced_by()and records the required referrer edits in the payload alongside the existingsnapshot, e.g.cascade: [{kind: "page", id: "...", unlink_claims: ["..."]}, {kind: "relation", id: "...", action: "delete"}]. pages and claims get their pointer removed (unlink); relations, being edges with no inbound refs of their own, get deleted. _approve_deleteapplies the cascade first, re-deriving it at approve time the way refs are re-checked today, then deletes the target. a reviewer-visible diff of every referrer touched, one decision, one audit event chain.- cli mirror:
vouch propose-delete <kind> <id> --cascade, and the refusal message should name the flag so the dead end is discoverable. - console:
DeleteArtifactButtonshows the referrer list in the confirm step and offers "delete with cascade" when the plain delete is refused.
fixing the kind-blind relation match is a smaller separate change — compare endpoints only when the endpoint's kind resolves to the target's kind — and could land first.
compatibility considerations
additive. cascade defaults to false, so every existing caller and every
existing kb behaves exactly as it does now. it touches the kb.* surface
(a new optional parameter on an existing method plus a new payload field
on decided delete proposals), so it likely wants a vep. no storage
migration: the payload is already free-form, and unlinking is a normal
put_page / put_claim write.
the four registration sites still apply even though no new method is
added — the parameter has to appear in server.py, jsonl_server.py, and
cli.py in step, and test_capabilities will not catch a missing cli
flag.
alternatives
- an
unlinkproposal kind —kb.propose_unlink(page, claim)as its own reviewable write, then delete the claim separately. more granular and more auditable, but it turns a one-claim cleanup into n+1 review rounds. - soft delete /
status: retired— hide the claim from search and context without removing the file, leaving referrers intact. cheapest to build and never breaks a reference, but it does not answer "get this out of my kb" and the storage keeps growing. - allow deleting a page-cited claim and let the page dangle — the console already renders a broken reference for a missing claim, so it would not crash. rejected: silently corrupting pages is worse than the refusal.