feat(cli): add issues rm so a deleted project leaves nothing behind - #23
Merged
Conversation
Withdrawing a repo announcement orphaned its issues rather than removing them: kind:1621 is immutable and not addressable, so the coordinate soft-delete `repos rm` uses cannot reach it. The events stayed on the relay, invisible but permanent. `buzz issues rm --issue <event id>` deletes the issue by event id, and its comments (kind:1) and status events (kind:1630-1633) first. Two relay constraints shape this: a kind:5 must carry exactly one target, so a batch deletion is not expressible and this is one event per target; and the author is enforced, so the descendant query is filtered to our own pubkey rather than failing the whole purge on someone else's comment. Children before parent, so a failure partway through never leaves a comment anchored to an issue that is gone. A duplicate deletion is success, not a conflict — that is how a partial purge is retried.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
repos rm(#20) withdraws a repo announcement, but orphans its issues rather than removing them. kind:1621 is immutable and not addressable, so the coordinate soft-delete thatrepos rmuses cannot reach it. The events stay on the relay — invisible once the project is gone, and permanent.Change
buzz issues rm --issue <event id>deletes the issue by event id, and everything published under it first: comments (kind:1) and status events (kind:1630-1633), both anchored bye.Two relay constraints shape the implementation, and both are pinned by tests:
ingest.rsrejects any deletion whosee+atag count is not 1 ("deletion events must reference exactly one target via e or a tag"). A batch deletion is not expressible, so this is one deletion event per target.validate_standard_deletion_eventrefuses with "must be event author". The descendant query is therefore filtered to our own pubkey; otherwise someone else's comment fails the entire purge instead of being skipped.Children go before the parent, so a failure partway through never leaves a comment anchored to an issue that is gone. A
duplicateresponse counts as success — that is how a partially failed purge is retried.Deliberately not reusing
repos::validate_write_response: it mapsduplicateto a "repository changed concurrently, retry" conflict, which here is both wrong and alarming.Unlike
repos rm, this is not reversible — an issue cannot be re-announced under the same id. The ERP is the source of truth for the content either way.Test plan
cargo test -p buzz-cli --lib→ 278 passed (3 new)etag and noatagcargo clippy -p buzz-cli --all-targetsclean