Skip to content

Adjust notifications IDL to support notifications per phases#7025

Merged
iaroslav-ciupin merged 8 commits intov2from
notifications-idl-message-per-phase
Mar 16, 2026
Merged

Adjust notifications IDL to support notifications per phases#7025
iaroslav-ciupin merged 8 commits intov2from
notifications-idl-message-per-phase

Conversation

@iaroslav-ciupin
Copy link
Contributor

@iaroslav-ciupin iaroslav-ciupin commented Mar 13, 2026

Tracking issue

Why are the changes needed?

  1. Support different notifications per different phases. E.g. success email for SUCCESS phase, FAILED/TIMED_OUT/ABORTED email for failed phases respectively.
  2. Support 2 notifications type per same set of phases. E.g. email and Slack for any phase in FAILED/TIMED_OUT/ABORTED

What changes were proposed in this pull request?

How was this patch tested?

Labels

Please add one or more of the following labels to categorize your PR:

  • added: For new features.
  • changed: For changes in existing functionality.
  • deprecated: For soon-to-be-removed features.
  • removed: For features being removed.
  • fixed: For any bug fixed.
  • security: In case of vulnerabilities

This is important to improve the readability of release notes.

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Signed-off-by: Iaroslav Ciupin <iaroslav@union.ai>
@github-actions github-actions bot mentioned this pull request Mar 13, 2026
3 tasks
Signed-off-by: Iaroslav Ciupin <iaroslav@union.ai>
Comment on lines +52 to +56
option (buf.validate.message).cel = {
id: "at_least_one_required"
message: "at least one of the delivery options must be set"
expression: "has(this.webhook) || has(this.email)"
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this vs oneof?

Copy link
Contributor Author

@iaroslav-ciupin iaroslav-ciupin Mar 14, 2026

Choose a reason for hiding this comment

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

Because in oneof you must have at most one. Here you can have as many notifications as you want. for same phase match, we may want both email & webhook & Slack for example.

message DeliveryConfigId {
// Org this rule belongs to.
// Org this config belongs to.
string org = 1 [
Copy link
Contributor

Choose a reason for hiding this comment

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

why keep org? We should just make all of this at the rule level no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't follow, can you elaborate?
this is a separate entity that lives in its own table, in my understanding org is needed:

  • for authz, to ensure you are referring to delivery config set up by your org, and not someone else's
  • to avoid name collision in DB, so that you don't accidentally update/delete someone else's config.

Copy link
Contributor

Choose a reason for hiding this comment

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

When you register a notification the runspec or the trigger already has the org. Why would you ever lookup some other org. We should drop it and infer from the context

Copy link
Contributor Author

@iaroslav-ciupin iaroslav-ciupin Mar 14, 2026

Choose a reason for hiding this comment

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

@kumare3 you are mixing one-off settings and persisted settings.
One-off settings are stored in runspec via CreateRun or DeployTask(with triggers) endpoints.
Persisted settings are stored independently of any tasks, runs, triggers, etc. Its a separate set of endpoints to create a Rule and a DeliveryConfig(see commit where I removed this API 75c97de )

Copy link
Contributor

Choose a reason for hiding this comment

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

I think what Ketan is probably saying is that in the RunSpec, instead of embedding this id, you just need the "string name" of the DeliveryConfig...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, I thought he was referring to removing org from DeliveryConfigId object.
Yeah, we can infer org from a run/trigger when creating a one-off notification setting. 👍

Signed-off-by: Iaroslav Ciupin <iaroslav@union.ai>
Signed-off-by: Iaroslav Ciupin <iaroslav@union.ai>
Signed-off-by: Iaroslav Ciupin <iaroslav@union.ai>
@iaroslav-ciupin
Copy link
Contributor Author

implemented this IDL on backend https://github.com/unionai/cloud/pull/14878

Signed-off-by: Iaroslav Ciupin <iaroslav@union.ai>
Signed-off-by: Iaroslav Ciupin <iaroslav@union.ai>
Signed-off-by: Iaroslav Ciupin <iaroslav@union.ai>
// Optionally, you can send a notification when your run completes.
oneof notification_settings {
flyteidl2.notification.RuleId rule_id = 10; // either refer to a previously stored notification rule
string notification_rule_name = 10; // either refer to a previously stored notification rule
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

@iaroslav-ciupin iaroslav-ciupin merged commit f11aad3 into v2 Mar 16, 2026
14 checks passed
@iaroslav-ciupin iaroslav-ciupin deleted the notifications-idl-message-per-phase branch March 16, 2026 18:22
afbrock pushed a commit that referenced this pull request Mar 18, 2026
* adjust notifications IDL to support notifications per phases
* drop delivery config id & rule id
* email idl adjustments

Signed-off-by: Iaroslav Ciupin <iaroslav@union.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants