fix(relay): tombstone workflow definition events on NIP-09 a-tag deletion - #6989
Open
mbradaschia wants to merge 1 commit into
Open
fix(relay): tombstone workflow definition events on NIP-09 a-tag deletion#6989mbradaschia wants to merge 1 commit into
mbradaschia wants to merge 1 commit into
Conversation
…tion A kind:5 a-tag deletion of a workflow (30620:<pubkey>:<uuid>) removed the execution-side workflows row but deliberately skipped the events-row soft-delete the generic NIP-33 branch performs, so `workflows list`/`get` and Buzz Desktop — which replay kind:30620 events over REQ — kept returning deleted workflows. The workflow branch now tombstones the definition event by coordinate after its bespoke deletion, mirroring the kind:30023 fix from issue block#714. Name-based a-tags tombstone the coordinate resolved from the workflow's UUID, since definition events carry the UUID as their d-tag. Repeat deletions are now an idempotent no-op: delete_workflow_for_owner returns Ok(None) when no row matched instead of Err(NotFound), so a second delete no longer fails the side effect with a hard 'not found'. Fixes block#6986 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Marcelo Bradaschia <mbradaschia@gmail.com>
🔐 Codex Security Review
|
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.
Summary
NIP-09 a-tag deletion of a workflow (kind:5 with
a=30620:<pubkey>:<uuid>) removed the execution-sideworkflowsrow but left the kind:30620 definition event live in the event store: the workflow branch ofhandle_a_tag_deletiondeliberately skipped the events-row soft-delete that the generic NIP-33 branch performs for every other addressable kind (that generic branch was itself the fix for the same bug on kind:30023 in #714 — workflows were the one kind left out). Sincebuzz workflows list/getand Buzz Desktop replay kind:30620 events over REQ, deleted workflows kept appearing.Changes:
soft_delete_by_coordinateafter its bespoke workflows-row deletion, with the same created_at scoping as the generic branch. Name-based a-tags tombstone the coordinate resolved from the workflow's UUID, since definition events carry the UUID as their d-tag.delete_workflow_for_ownerreturnsOk(None)when no row matched instead ofErr(NotFound), so a repeat delete is an idempotent no-op rather than a failed side effect loggingERROR Side effect failed: … not found.Related issue
Fixes #6986
Testing
test_workflow_a_tag_deletion_tombstones_definition(mirrorstest_long_form_a_tag_deletionfrom relay: NIP-09 a-tag deletion is a no-op for kind:30023 (and all non-workflow addressables) #714): create def → visible via REQ → kind:5 a-tag delete → REQ returns nothing → repeat delete (distinctcreated_at, so it isn't dedup-masked) stays accepted and the def stays gone. Red before the fix (got 1 events), green after.soft-deleted workflow definition event, repeat delete hits both idempotent no-op branches, zero ERROR lines.e2e_relay(46 passed) +e2e_long_form(8 passed, generic-branch behavior unchanged) against a locally built relay;buzz-relay/buzz-dbunit suites. Two failures are pre-existing in my environment —mesh_demo::demo_join_forwarded_arm_round_trips_echoandtest_unarchive_emits_member_added_notificationfail identically on unmodifiedmain(verified by stash → rebuild → rerun).workflows list→[]andworkflows get→nullafter delete; repeatworkflows deleteexits 0.cargo fmt+cargo clippy --all-targetsclean on touched crates.🤖 Generated with Claude Code