-
Notifications
You must be signed in to change notification settings - Fork 0
Link automation.action.* events to automation.triggered event #2
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
base: copilot_full_base_link_automationaction_events_to_automationtriggered_event_pr2
Are you sure you want to change the base?
Changes from all commits
ad6f192
35a9f4c
f716a5e
a79dc08
eff6a1f
8d6e4bb
7a8ea71
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -760,6 +760,24 @@ class TriggeredAction(PrefectBaseModel): | |||||||||||||
| default=0, | ||||||||||||||
| description="The index of the action within the automation", | ||||||||||||||
| ) | ||||||||||||||
| automation_triggered_event_id: UUID | None = Field( | ||||||||||||||
| default=None, | ||||||||||||||
| description=( | ||||||||||||||
| "The ID of the automation.triggered or automation.resolved event that " | ||||||||||||||
| "prompted this action, used to link automation.action.* events back to " | ||||||||||||||
| "the state change event" | ||||||||||||||
| ), | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| @field_validator("automation_triggered_event_id") | ||||||||||||||
| @classmethod | ||||||||||||||
| def validate_automation_triggered_event_id(cls, v, info): | ||||||||||||||
| """Ensure automation_triggered_event_id is only set when triggering_event exists.""" | ||||||||||||||
| if v is not None and info.data.get("triggering_event") is None: | ||||||||||||||
| raise ValueError( | ||||||||||||||
| "automation_triggered_event_id can only be set when triggering_event is provided" | ||||||||||||||
| ) | ||||||||||||||
|
Comment on lines
+775
to
+779
|
||||||||||||||
| """Ensure automation_triggered_event_id is only set when triggering_event exists.""" | |
| if v is not None and info.data.get("triggering_event") is None: | |
| raise ValueError( | |
| "automation_triggered_event_id can only be set when triggering_event is provided" | |
| ) | |
| """Allow automation_triggered_event_id to be set independently of triggering_event.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
action.triggeredevent in thefailmethod is usingself._resulting_related_resourcesinstead ofrelated_resources. This means theaction.triggeredevent will not include theautomation-triggered-eventandtriggering-eventrelated resources that were just constructed.This is inconsistent with the
succeedmethod where both theaction.triggeredandaction.executedevents correctly userelated_resources. Theaction.triggeredevent should include these links so users can trace from the triggered event back to the automation.triggered event and original triggering event.