Skip to content

perf(workflows): bound verified mention alias cost - #1

Closed
brow wants to merge 1 commit into
cshtdd:camilos/fix-workflow-verified-mentionsfrom
block:fix-9624-mention-cost
Closed

brow wants to merge 1 commit into
cshtdd:camilos/fix-workflow-verified-mentionsfrom
block:fix-9624-mention-cost

Conversation

@brow

@brow brow commented Nov 19, 2026

Copy link
Copy Markdown

Follow-up to block#9624 (verified profile aliases in workflow mentions), targeting its branch.

block#9624 makes every workflow send_message load each channel member's full kind:30382 verified-profile event, parse it into a nostr::Event while holding the writer connection, and scan the message for about five times as many names, on a tokio worker. That cost lands on every workflow send, including ones that mention no one. It also reads verified names even when the community no longer advertises verified profiles, so leftover profile heads can make an ordinary @Name ambiguous after an operator turns the feature off.

This keeps the same output tags and:

  • Skips mention resolution when the rendered text has no @. No @ means no p or buzz:workflow-mention tag can result, so the member and alias reads are skipped.
  • Projects only the three name tags in SQL (display_name, username, full_name, the same jsonb_path_query_first expression profile search uses) instead of shipping and parsing whole events. Identical case-folded names for one member are deduplicated. A malformed head no longer fails the send.
  • Tries names only at mention anchors. The resolver collects the positions of @ at a left boundary once and matches each name only there, so its cost is names × mentions instead of names × characters. Matching rules are unchanged.
  • Reads verified names only where the community advertises them, using the same verified_profiles::discovery check as profile search. Otherwise the heads join is skipped.

Validation

  • Extended the existing workflow alias test (workflow_send_message_binds_authority_to_authored_mentions): it now runs with verified profiles advertised, adds a message with no @, and repeats two cases on the same roster without the advertisement (@alex notifies no one, @Alex Example notifies the ordinary member).
  • The existing resolver unit tests cover the anchor-only scan.

Regressions

None expected. Output tags are identical for every advertised community. In a community that does not advertise verified profiles, workflow mentions fall back to ordinary names, which is what they matched before block#9624.

Skip mention resolution when the rendered text has no @, project only
the three verified name tags in SQL instead of parsing whole kind:30382
events, deduplicate folded aliases per member, try names only at mention
anchors, and read verified names only where the community advertises
verified profiles.

Signed-off-by: Tom Brow <tomb@block.xyz>
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.

1 participant