feat(slack): replace email references with Slack @mentions#516
Conversation
…entions (partial #514)
There was a problem hiding this comment.
Code Review
This pull request introduces outbound mention resolution in the Slack broker, automatically replacing Scion user emails with Slack @mentions in outgoing messages. A review comment points out a potential data race issue caused by mutating the shared msg pointer in-place, and suggests performing a shallow copy of the message struct to prevent unexpected side effects.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if msg != nil && store != nil { | ||
| msg.Msg = resolveOutboundMentions(ctx, store, msg.Msg) | ||
| } |
There was a problem hiding this comment.
Mutating msg.Msg in-place modifies the shared msg pointer. Since Publish can be called concurrently across different brokers, or sequentially where other components rely on the original message content (e.g., for dedup key generation or logging), mutating the message in-place can lead to data races and unexpected side effects.
Additionally, msg is already checked for nil earlier in this function (line 363), making the msg != nil check redundant.
Instead, perform a shallow copy of the message struct and update the local pointer.
| if msg != nil && store != nil { | |
| msg.Msg = resolveOutboundMentions(ctx, store, msg.Msg) | |
| } | |
| if store != nil { | |
| msgCopy := *msg | |
| msgCopy.Msg = resolveOutboundMentions(ctx, store, msg.Msg) | |
| msg = &msgCopy | |
| } |
|
Superseded by squash-merged upstream PR. Closing fork PR. |
Summary
resolveOutboundMentions()from Telegram broker to the Slack brokeruser:emailand standalone email references with Slack<@user_id>mentions viaGetUserMappingByEmail()store lookupPublish()before message formattingTest plan
Partial #514