Skip to content

♻️ ref(aci): only fire active actions #97927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

iamrajjoshi
Copy link
Member

now that we have introduced a status field for Actions and will update the status of actins depending on integration status, lets only fire active actions.

we will still record WorkflowFireHistory entries for all the disabled actions, just not fire them.

i also added the base manager for Action to filter out all actions in process of being deleted. this matches Workflow and Detector behavior (which both also have the status field)

@iamrajjoshi iamrajjoshi self-assigned this Aug 15, 2025
@iamrajjoshi iamrajjoshi requested a review from a team as a code owner August 15, 2025 16:47
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 15, 2025
cursor[bot]

This comment was marked as outdated.

Copy link

codecov bot commented Aug 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #97927   +/-   ##
=======================================
  Coverage   80.64%   80.65%           
=======================================
  Files        8591     8591           
  Lines      378981   379049   +68     
  Branches    24684    24684           
=======================================
+ Hits       305647   305707   +60     
- Misses      72955    72963    +8     
  Partials      379      379           

@@ -465,6 +466,10 @@ def process_workflows(
create_workflow_fire_histories(
detector, actions, event_data, should_trigger_actions, is_delayed=False
)

# We only want to fire active actions
actions = actions.filter(status=ObjectStatus.ACTIVE)
Copy link
Member

Choose a reason for hiding this comment

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

Should this be done in fire_actions or deduplicate_actions inside of it? fire_actions is used in both process_workflows and delayed workflow processing

Copy link
Member Author

Choose a reason for hiding this comment

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

i could see an argument for fire_actions but my thought in keeping it where it is because i want fire_actions and deduplicate_actions to do exactly what they say - deduplicate them and fire them.

if we add it to either method, they have a side effect and do an extra filter that i don't think they should

Copy link
Member Author

Choose a reason for hiding this comment

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

open to change it tho

Copy link
Member

Choose a reason for hiding this comment

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

I moved deduplicate_actions inside fire_actions before. I don't think it hurts because you should only fire active actions anyway

Copy link
Contributor

Choose a reason for hiding this comment

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

might be worth putting in fire_actions just to DRY up the filter in delayed workflows and make sure there aren't any footguns there. another alternative could be to just put an if statement in the action.trigger, but that's a little less ideal since it'll create all the extra overhead until executing that.

we'll also want to confirm that this won't make 2 queries; 1 for the first set of actions that we log for fire history, and a second for this filter. if there are 2 queries, it might be better to just quickly filter the array.

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.

4 participants