Skip to content

chore(workfow-engine): split condition handlers into separate files #82970

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

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

ameliahsu
Copy link
Member

split condition handlers into their own files since the shared files were getting kinda long

@ameliahsu ameliahsu requested review from cathteng and a team January 6, 2025 22:58
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 6, 2025
@ameliahsu ameliahsu merged commit 3e28b90 into master Jan 7, 2025
50 checks passed
@ameliahsu ameliahsu deleted the mia/aci/move-handlers branch January 7, 2025 18:03
event = job["event"]
first_seen = event.group.first_seen
current_time = timezone.now()
comparison_type = comparison.get("comparison_type")
Copy link
Contributor

Choose a reason for hiding this comment

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

@cathteng @ameliahsu 🤔 thoughts on how we could add type safety to these? i think this is fine for now, but i wonder if we could improve this system a bit.

One idea I had was to add another generic type on the condition handler, then pass it through to evaluate value (the same way we are for the first parameter in evaluate value).

Any ideas on how we could do that with json schema or anything? 🤔

Copy link
Member

Choose a reason for hiding this comment

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

i was thinking of validation on the comparison using a dataclass with types given the DataCondition.type with a registry storing the dataclasses. this would be more robust than json schema because you can use a list of possible values for a single key, whereas json schema is limited to the basic types

Copy link
Member

Choose a reason for hiding this comment

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

basically spreading the comparison dict into the dataclass to check that the contents we need are there and are the correct type

andrewshie-sentry pushed a commit that referenced this pull request Jan 22, 2025
…82970)

split condition handlers into their own files since the shared files
were getting kinda long
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants