fix(sdk,desktop): keep self-targeted p tags on issue assignment and the generic signer - #6516
Open
sumit-m wants to merge 1 commit into
Open
fix(sdk,desktop): keep self-targeted p tags on issue assignment and the generic signer#6516sumit-m wants to merge 1 commit into
sumit-m wants to merge 1 commit into
Conversation
nostr removes a p tag naming the event author unless allow_self_tagging is set, so assigning or unassigning yourself published an event with no assignee: the comment read "Assigned this issue to ..." while the list stayed empty. Messages and forum comments already opted in; the assignment and recipient-note builders and the generic signer did not. Signed-off-by: sumit-m <33051892+sumit-m@users.noreply.github.com>
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.
Fixes the self-referential
ptag strip (#4326) at the point where it keepsrecurring, and covers the case that is visible in the UI.
What is broken today
In Buzz Desktop, open any task in a project and click Assign to me. Nothing
happens. Click Unassign on yourself and nothing happens either — the
operation reports success, a comment appears in the task's history reading
"Assigned this issue to …" / "Unassigned … from this task", and the Assignees
row is unchanged.
Assigning or unassigning anyone else works.
Why
Assignment is modelled as a kind:1 note whose
ptags are the assignees.nostr'sEventBuilder::build_with_ctxremoves anyptag matching theauthor's public key unless
allow_self_tagging()was called, so when theassignee is the signer the published event carries no
ptag at all. Thereducer that derives assignees from those notes then adds or removes nobody,
while the human-readable content still names the person.
The event id hashes over the tags that were actually signed, so this is not a
relay-side strip — the tag never existed on the wire.
What this changes
Three call sites, all of which build
ptags as payload rather than asmentions:
buzz-sdk:build_git_issue_assignee_operation— the assign/unassignbuilder used by the CLI and by Desktop's managed-owner path.
desktop:build_labeled_recipient_note_event— Desktop's labelledrecipient notes, which also covers review requests.
desktop: thesign_eventcommand — the generic signer used from theTypeScript side, which is the path the Assignees row actually goes through.
The third is the one worth arguing about, and I think it is the real defect. A
generic signing command's contract is to sign the tags it was given. Silently
discarding one makes it lie to every caller, and each new builder inherits the
trap — which is why this issue keeps being fixed one builder at a time
(#4975 merged for messages and forum notes; #4338, #4484, #3384 open for
membership and PR status). A caller that does not want a self
ptag simplydoes not add one.
Tests
Two regression tests in
buzz-sdk, mirroring the existingmessage_preserves_self_mention_p_tagpattern: a self-assignment and aself-unassignment each keep the assignee's
ptag through signing.Verification
Reproduced and fixed against a local relay: before, clicking Assign to me
published an event with tags
["e", "a", "t", "prior"]and no assigneeappeared; after, the same click keeps the
ptag and the name sticks. Existingevents are not repaired — the reducer replays history, and those events
genuinely carry no assignee — so a task assigned before the fix needs
reassigning once.