Skip to content

fix(desktop): resolve typed @name mentions on send (parity with CLI/relay) - #3991

Open
HyperfocuSam wants to merge 1 commit into
block:mainfrom
HyperfocuSam:fix/desktop-resolve-typed-mentions
Open

fix(desktop): resolve typed @name mentions on send (parity with CLI/relay)#3991
HyperfocuSam wants to merge 1 commit into
block:mainfrom
HyperfocuSam:fix/desktop-resolve-typed-mentions

Conversation

@HyperfocuSam

Copy link
Copy Markdown

What

Hand-typed @Name mentions in the desktop composer (typed in full instead of selected from the autocomplete picker) send with no p tag — the mention renders as plain text and the target is silently never notified. The relay's workflow sink and the CLI already resolve typed names ("uniquely resolved member names still notify"); the desktop send path was the one surface without this behavior.

How

  • Extracted resolve_mention_pubkeys from buzz-relay/src/workflow_sink.rs into shared buzz-core/src/mentions.rs (with its full test suite); relay now consumes the shared copy.
  • send_channel_message (desktop) resolves typed @Name tokens against channel members via the existing member/profile hydration path and merges resolved pubkeys into the mention list — deduplicated against picker-resolved mention_pubkeys — across all three build paths (stream message, forum post, forum comment).
  • Fail-open: member-lookup failure falls back to explicit mentions only; content without @ skips resolution.

Semantics preserved exactly: case-insensitive, longest-name-first, left-boundary anchor, ambiguous display names wake no one, first-appearance dedup, unicode-safe folding.

Testing

  • cargo test -p buzz-core: 254 passed (includes the moved resolver suite + new cases)
  • cargo test -p buzz-desktop --lib: 2004 passed, 0 failed (includes new merge/dedupe send-path tests)
  • cargo test -p buzz-relay --lib: 775 passed; the 10 failures in api::admin/api::media/api::mesh_demo reproduce identically on untouched main (infra-tier tests, pre-existing)
  • cargo clippy -p buzz-core --all-targets -- -D warnings clean; cargo fmt --check clean

Out of scope by design: a composer preview pill for typed mentions (frontend UX) — this PR is backend parity only.

…elay)

Signed-off-by: Sam Wong <hyperfocusam@gmail.com>
@HyperfocuSam
HyperfocuSam requested a review from a team as a code owner July 31, 2026 19:21
technicallybrantley added a commit to technicallybrantley/buzz that referenced this pull request Aug 2, 2026
The mobile composer only collected mention pubkeys from the map populated
when a suggestion is tapped (insertMention), so a mention typed by hand —
never selected from the suggestion list — went out as plain text: no p
tag, no notification, silently. Desktop already handles this case:
extractMentionPubkeys in useMentions.ts scans the outgoing text against
channel-member candidates at send time.

Mirror that member scan at send time: _selectedMentionCandidates (in
compose_bar/helpers.dart, keeping compose_bar.dart under the mobile
file-size ratchet) collects picker-selected mentions, then matches
remaining channel-member display names against the text with the
existing hasMention matcher. Suggestion picks keep precedence for a
name, and the scan is members-only, so it can never trigger the
non-member invite prompt on its own.

Adds a widget test that types a member mention without touching the
suggestion list and asserts the pubkey reaches onSend.

Duplicate search: no existing PR or issue covers send-time extraction of
typed mentions on mobile. Desktop's equivalent gap was fixed in block#3991;
adjacent autocomplete-discovery issues (block#4187, block#4128, block#3971, block#2508) do
not cover this.

No UI changes — the composer renders identically; only the outgoing
event's tags change. Screenshots not applicable.

Manual test: on a debug build, type '@<member name> hi' into a channel
composer without tapping the suggestion popup and send; the recipient
now gets a mention notification and the raw event carries their p tag.

Local validation (Flutter 3.41.7, Windows): dart format clean, analyzer
clean, mobile file-size ratchet clean, mobile suite green except one
failure in channel_detail_page_test.dart (follow-mode) that fails
identically on the untouched base commit and is unrelated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: technicallybrantley <bprice23@outlook.com>
Signed-off-by: technicallybrantley <bprice23@outlook.com>
@Chessing234

Copy link
Copy Markdown
Contributor

heads up — #4506 adds warn logging for ambiguous workflow @mentions on the same resolve path you're extracting into buzz-core. if your tip lands first, the warn should move with the shared helper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants