fix(sdk): preserve self-mention p tags in message and forum event builders - #4975
Open
BradGroux wants to merge 2 commits into
Open
fix(sdk): preserve self-mention p tags in message and forum event builders#4975BradGroux wants to merge 2 commits into
BradGroux wants to merge 2 commits into
Conversation
…lders nostr 0.44's EventBuilder strips p tags matching the signer's pubkey by default. build_message, build_forum_post, and build_forum_comment did not opt in via allow_self_tagging(), so an explicit --mention <sender-pubkey> was silently removed from the signed event. The CLI returned accepted:true with empty mention_pubkeys — a silent-success failure. Add .allow_self_tagging() to all three builders, matching the pattern already used by build_archive_identity_request and build_unarchive_identity_request. Add regression tests that sign with the same key whose pubkey is in the mentions list and assert the p tag survives. Refs block#4906 Co-authored-by: Brad Groux <bradgroux@hotmail.com> Signed-off-by: Brad Groux <bradgroux@hotmail.com> Signed-off-by: npub17q2gdupkvswvk5kprwc7plergm4gn295uw6fe4mjyjv53ahuhtnq02jd3f <f01486f036641ccb52c11bb1e0ff2346ea89a8b4e3b49cd772249948f6fcbae6@digitalmeld.communities.buzz.xyz>
Co-authored-by: Brad Groux <bradgroux@hotmail.com> Signed-off-by: Brad Groux <bradgroux@hotmail.com> Signed-off-by: Brad Groux <3053586+BradGroux@users.noreply.github.com>
Author
|
Review traced the CLI send path through the SDK builders and checked At that head, rustfmt, all 257 |
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.
What users saw
buzz messages sendsilently removed an explicitly supplied self-mention. The caller passed--mention <sender-pubkey>and receivedaccepted:true, but the signed event had no matchingptag andmention_pubkeyswas empty.Why it happened
nostr0.44 stripsptags matching the signer's pubkey by default. The codebase already opts out with.allow_self_tagging()for identity archive and unarchive requests, but the message and forum builders that accept mentions did not. The library therefore removed the tag during signing after the CLI had validated the explicit mention.What changed
Added
.allow_self_tagging()to all three event builders that accept mention tags:build_message(kind 9)build_forum_post(kind 45001)build_forum_comment(kind 45003)An explicit mention now survives signing even when it matches the sender.
How this was tested
Added one regression test per builder. Each test signs with the same key included in the mention list and asserts that the resulting event preserves the self-referential
ptag.Validation at
cd0f30bca:All 257
buzz-sdktests and all 321buzz-clitests passed, and formatting and strict Clippy checks completed successfully.Scope and non-goals
normalize_mention_pubkeys, which is not used by the messages-send path.Closes #4906.