fix(slack): Use workflow environment in issue alert links - #126113
Open
sentry-junior[bot] wants to merge 2 commits into
Open
sentry-junior[bot] wants to merge 2 commits into
sentry-junior[bot] wants to merge 2 commits into
Conversation
Slack issue alert links read the environment from the legacy Rule whenever a legacy_rule_id was present. Migrated legacy Rules keep the environment they had at migration time and aren't updated when the workflow is edited, so links could carry a stale environment (e.g. development instead of production). Prefer the workflow's environment whenever a workflow fired. Fixes ISWF-3420
sentaur-athena
marked this pull request as ready for review
September 30, 2026 22:43
Member
|
oh hey, I have this fixed applied a bit more generally in one of my pile of local branches. Let me check if it is close enough to make this unnecessary.. |
Member
|
ah yes, #126074. Kinda tacked on there, tbh. |
This branch has not been deployed
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.
Slack issue alert links can have the wrong
environmentquery param, e.g.environment=developmenton a production alert.When an issue alert fires through the workflow engine, the Rule built for the notification carries both
workflow_idandlegacy_rule_id.get_rule_or_workflow_idpreferslegacy_rule_id, soSlackIssuesMessageBuilderre-readenvironment_idfrom the legacyRulerow. That row keeps whatever environment it had at migration time. Workflow edits (WorkflowValidator.update) never write back to it, and the legacy rule edit endpoints are gone. So once a workflow's environment was changed, the link kept showing the old one.The fix: whenever the rule data has a
workflow_id, read the environment from thatWorkflow. When there's no workflow, it still falls back to the legacyRule, as before. The alert link andalert_rule_idparams don't change.Added a regression test: it migrates a
developmentrule, moves the workflow toproduction, and checks that the link saysenvironment=production. The test failed on master withenvironment=developmentand passes with this change.Fixes ISWF-3420
Fixes #123541
via Athena Moghaddam.
--
View Junior Session [Sentry]