fix(relay): retire the kind:30620 event on workflow delete (#2879) - #3392
fix(relay): retire the kind:30620 event on workflow delete (#2879)#3392bonpiedlaroute wants to merge 1 commit into
Conversation
Signed-off-by: bonpiedlaroute <noel.tchidjo@hotmail.com>
|
Flagging an overlap I should have caught before opening this: #2489 (open since #2489 is the broader fix: one transaction under the kind:30620 coordinate This PR is the minimal version: reuse the existing Maintainers should take whichever fits the review budget — I'm happy to close |
Fixes #2879.
Summary
buzz workflows deleteremoved the workflow row and invalidated the enginecache, but left the kind:30620 definition event live.
workflows listandworkflows getboth read that event, so every inspection surface keptreporting a workflow that
workflows triggerrejected withinvalid: workflow not found. The only way to discover the deletion hadlanded was to trigger it.
Cause
handle_a_tag_deletion'sKIND_WORKFLOW_DEFarm returns afterdelete_workflow_for_owner+invalidate_channel_workflows, so the genericNIP-33 arm below it — the only caller of
soft_delete_by_coordinate— is neverreached for kind:30620. Every other addressable kind, kind:30023 included, is
soft-deleted so REQs stop returning it.
Change
Extract the soft-delete block into
soft_delete_addressable_coordinateandcall it from both arms. No new logic: the behaviour already existed, it was
just unreachable for kind:30620.
The comment above the generic arm stated the current behaviour was deliberate
("doesn't soft-delete the
eventsrow by design — that's a separate concern").It is rewritten, since it would otherwise assert the opposite of what the code
does. My reading is that the concern it deferred is workflow row deletion
semantics, not the visibility of the definition event. Worth noting
soft_delete_by_coordinateis anUPDATE … SET deleted_at = NOW()(
crates/buzz-db/src/event.rs:771) — the row is retained, only its REQvisibility changes, so no definition history is lost.
If the intent really was for the kind:30620 event to outlive the workflow, the
fix belongs in
cmd_list_workflows/cmd_get_workflowinstead, filtering outdefinitions with no live workflow. Happy to switch to that shape.
Authorization
No new surface. Ownership of the a-tag coordinate is already enforced by
validate_standard_deletion_event(
crates/buzz-relay/src/handlers/side_effects.rs:234-253), which runs fromingest.rs:1967before the event is stored and before any side effect —it requires
target_pubkey == actor || is_agent_owner(...), otherwisemust be event author. The check is identical for both arms.Testing
New e2e test
test_workflow_delete_retires_definition_event, mirroringtest_long_form_a_tag_deletionwhich covers this path for kind:30023.Verified it is a real regression guard:
FAILED — workflow deletion should retire the definition event (got 1 events)ok