fix(slack): use replace offset for duplicate mentions, invalidate cache on user_change#233
Closed
matchai wants to merge 3 commits intofeat/state-remove-from-listfrom
Closed
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
618a5a0 to
fa14617
Compare
fa14617 to
f84b0fb
Compare
Member
Author
|
Superseded by combined PR |
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 three issues found during review of #230. Stacks on #234.
Duplicate mention bug
resolveOutgoingMentionsusedtext.indexOf(match)inside the.replace()callback, which always returns the index of the first occurrence. When the same@nameappears multiple times, subsequent matches get their<prefix check evaluated against the wrong position. Uses theoffsetparameter that.replace()already provides.Stale user cache on name changes
The user cache (
slack:user:{userId}) has an 8-day TTL. When a Slack user changes their display name, the cache serves stale data until expiry — incoming messages show the old name and the reverse index never learns the new name.Subscribes to Slack's
user_changeevent and:removeFromListfrom feat(state): add removeFromList to StateAdapter #234)The next
lookupUsercall hits the Slack API and picks up the new profile. Requires addinguser_changetobot_eventsin the Slack app manifest (users:readscope is already present).Test comment
Fixed misleading "fire-and-forget" comment — the code actually
awaits participant tracking.