Skip to content

Conversation

@cathteng
Copy link
Member

@cathteng cathteng commented Jan 9, 2026

Update integrations code to handle using legacy_rule_id or workflow_id depending on if it exists. We prefer using legacy_rule_id if available, otherwise try workflow_id, then finally use rule.id

Builds on #105999

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 9, 2026
@cathteng cathteng changed the title chore(aci): handle workflows or rules in digests sans feature flag chore(aci): handle workflows or rules in integrations sans feature flag Jan 10, 2026
)
)
key, value = get_rule_or_workflow_id(rules[0])
if key == "workflow_id":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where variant types would be nice..

it could be like

match get_rule_or_workflow_id(rules[0]):
     case WorkflowId(value):
           rule_url = ..
     case LegacyRuleId(_):
           rule_url = build_rule_url(...)

self.issue_details,
self.notification,
ExternalProviders.SLACK,
rule_id,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is supposed to be the workflow_id?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the rule_id is set to whatever value we end up picking in the logic above (it used to work like that and just keeping it for now)

@cathteng cathteng requested a review from kcons January 12, 2026 23:15

rule_id = None
rule_environment_id = None
key = "legacy_rule_id"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe 'rule_id_type'? "key" is pretty vague.



def get_rule_or_workflow_id(rule: Rule) -> tuple[str, str]:
def get_rule_or_workflow_id(rule: Rule) -> tuple[RuleIdType, str]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't tuple[RuleIdType, int] be more accurate and cleaner here?

obj: Group | GroupEvent = self.event if self.event is not None else self.group
rule_id = None
rule_environment_id = None
key: RuleIdType = "legacy_rule_id"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: should we have a DEFAULT_RULE_ID_TYPE const to avoid needing to annotate and so this choice is uniform, obvious, and easy to change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, we should have an easy way to flip the default after GA to always read the workflow id

@cathteng cathteng merged commit c91f208 into cathy/aci/workflow-rule-in-digests Jan 12, 2026
60 of 61 checks passed
@cathteng cathteng deleted the cathy/aci/workflow-rule-integrations branch January 12, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants