Skip to content

feat(specs): add notification settings to tasks [skip-bc] #4297

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 9 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions specs/ingestion/common/schemas/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ Task:
$ref: '#/ActionType'
cursor:
$ref: './common.yml#/cursor'
notifications:
$ref: '#/Notifications'
policies:
$ref: '#/Policies'
createdAt:
$ref: './common.yml#/createdAt'
updatedAt:
Expand Down Expand Up @@ -63,6 +67,10 @@ TaskV1:
$ref: '#/ActionType'
cursor:
$ref: './common.yml#/cursor'
notifications:
$ref: '#/Notifications'
policies:
$ref: '#/Policies'
createdAt:
$ref: './common.yml#/createdAt'
updatedAt:
Expand Down Expand Up @@ -105,6 +113,10 @@ TaskCreate:
$ref: '#/TaskInput'
cursor:
$ref: './common.yml#/cursor'
notifications:
$ref: '#/Notifications'
policies:
$ref: '#/Policies'
required:
- sourceID
- destinationID
Expand Down Expand Up @@ -175,6 +187,10 @@ TaskUpdate:
description: Whether the task is enabled.
failureThreshold:
$ref: '#/failureThreshold'
notifications:
$ref: '#/Notifications'
policies:
$ref: '#/Policies'

TaskUpdateV1:
type: object
Expand Down Expand Up @@ -553,3 +569,30 @@ ShopifyMarket:
- countries
- currencies
- locales

Notifications:
type: object
additionalProperties: false
description: Notifications settings for a task.
properties:
email:
title: emailNotifications
type: object
additionalProperties: false
properties:
enabled:
description: Whether to send email notifications, note that this doesn't prevent the task from being blocked.
type: boolean
required:
- email

Policies:
Copy link
Member

Choose a reason for hiding this comment

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

is policies a relevant name in that case? Do we already have other rules in mind than the error thresholds?

Copy link
Member

Choose a reason for hiding this comment

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

also could be great to move the failure threshold there

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes we have other policies in mind, for example the safetyCheck as you talked about on slack, to prevent a index being emptied if the action is replace.
Yes it would be nice to move failureThreshold, but it's a big breaking change

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 mostly wondering if the name made sense but I don't have any other in mind anyway

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we had other naming ideas with @Fluf22 but this one made the most sense, maybe advancedOptions ?

Copy link
Member

Choose a reason for hiding this comment

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

to me those seems to mostly be error settings but maybe we can generalize it indeed, policies just feel like guidelines or things like that rather than personalization

type: object
additionalProperties: false
description: Set of rules for a task.
properties:
criticalThreshold:
description: The number of critical failures in a row before blocking the task and sending a notification.
type: integer
minimum: 1
maximum: 10
8 changes: 8 additions & 0 deletions specs/ingestion/common/taskParameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ triggerType:
$ref: './schemas/task.yml#/TriggerType'
example: onDemand,schedule,subscription,streaming

withEmailNotifications:
name: withEmailNotifications
in: query
description: If specified, the response only includes tasks with notifications.email.enabled set to this value.
required: false
schema:
type: boolean

sort:
name: sort
in: query
Expand Down
1 change: 1 addition & 0 deletions specs/ingestion/paths/tasks/v2/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ get:
- $ref: '../../../common/taskParameters.yml#/sourceType'
- $ref: '../../../common/taskParameters.yml#/destinationID'
- $ref: '../../../common/taskParameters.yml#/triggerType'
- $ref: '../../../common/taskParameters.yml#/withEmailNotifications'
- $ref: '../../../common/taskParameters.yml#/sort'
- $ref: '../../../common/parameters.yml#/order'
responses:
Expand Down
20 changes: 18 additions & 2 deletions tests/CTS/requests/ingestion/createTask.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@
"sourceID": "search",
"destinationID": "destinationName",
"cron": "* * * * *",
"action": "replace"
"action": "replace",
"notifications": {
"email": {
"enabled": true
}
},
"policies": {
"criticalThreshold": 8
}
},
"request": {
"path": "/2/tasks",
Expand All @@ -31,7 +39,15 @@
"sourceID": "search",
"destinationID": "destinationName",
"cron": "* * * * *",
"action": "replace"
"action": "replace",
"notifications": {
"email": {
"enabled": true
}
},
"policies": {
"criticalThreshold": 8
}
}
}
},
Expand Down