Repository navigation
Conversation
Seer automations were built on a SeerWorkflow base class with a subclass per kind. Each subclass mixed how runs start, which projects they cover and what Seer does, and each had its own copy of run admission, with its own config locking. Replace the subclasses with composition. A WorkflowDefinition pairs a trigger with an action, and a config's strategy picks the pairing. Admission (dedupe, quota, run creation) lives once on the definition and takes the config lock once. Each trigger's code, including the entry point that receives its firings, is in one module: metric_alert.py and schedule.py. Triggers and actions declare the settings they take, validated on create and update. Settings are kept in the config's extras for now. Runs are created through SeerWorkflowRunLifecycle. Remove the monitor cleanup test automation, its trigger endpoint, and the older run helpers that only it used.
Contributor
Sentry Snapshot Testing
|
_create_config was shared by two creation paths. With a single create it only added indirection.
Restore the monitor cleanup automation and the run helpers it uses so their removal can be reviewed as its own change.
A metric automation created with no monitors had no backing alert workflow until a monitor selection was first saved. Create it with the automation so every metric automation has one.
Leave the cadence task and its tests in their existing files so the refactor does not also move them.
…ow-trigger-action # Conflicts: # tests/sentry/seer/workflows/test_scheduled.py
Leave the metric alert trigger in breached_metrics.py so the refactor shows as edits to the existing file.
Overload create per strategy so a project selection on a metric automation, or a monitor selection on a scheduled one, is a type error. The configs endpoint branches on the strategy it was sent so each call matches an overload.
trevor-e
marked this pull request as ready for review
November 12, 2026 00:56
This branch was successfully 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.
Seer automations were built on a
SeerWorkflowbase class with one subclass per kind. Each subclass mixed how runs start, which projects they cover and what Seer does, and each carried its own copy of run admission; the two copies had drifted and both locked the config row twice.This replaces the subclasses with composition. A
WorkflowDefinitionpairs a trigger with an action, and a config'sstrategypicks the pairing inworkflows/definitions.py:MetricAlertTriggerwithInvestigateBreachedMetricAction, andScheduleTriggerwithPromptedInvestigationAction(dispatch still unimplemented, as before). Triggers declare the inputs they produce and actions the inputs they accept, so a mismatched pairing is a mypy error. Admission lives once on the definition and locks the config once. Start withworkflows/base.pyfor the interfaces, thenbreached_metrics.py, which now also holds the alert handler fromaction.py.Behavior changes to review:
seer.workflow.createdlog no longer carries project or monitor fields; monitor changes at creation log asseer.workflow.monitors_updated.cron,prompt) that are validated on create and update. They are stored in the config'sextrasand not exposed through the API yet.