Skip to content

Validate interval when a task is updated#222486

Merged
ersin-erdal merged 9 commits intoelastic:mainfrom
ersin-erdal:213391-validate-interval
Jun 20, 2025
Merged

Validate interval when a task is updated#222486
ersin-erdal merged 9 commits intoelastic:mainfrom
ersin-erdal:213391-validate-interval

Conversation

@ersin-erdal
Copy link
Contributor

@ersin-erdal ersin-erdal commented Jun 3, 2025

Resolves: #213391

This PR adds validation for task interval where it is updated.

There are 5 places in the TaskStore that we update the interval: schedule, bulkSchedule, update, bulkUpdate and bulkPartialUpdate

For the bulk operations we just skip the task with invalid interval, for schedule and update throw an error and stop the execution.

To verify:

Create a rule with connector.
Let it run for a while.
Then update the rule.

There shouldn't be any error.

@ersin-erdal ersin-erdal added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// backport:version Backport to applied version labels v9.1.0 v8.19.0 labels Jun 3, 2025
@ersin-erdal ersin-erdal marked this pull request as ready for review June 6, 2025 17:08
@ersin-erdal ersin-erdal requested a review from a team as a code owner June 6, 2025 17:08
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@ersin-erdal ersin-erdal requested a review from pmuellr June 12, 2025 10:06
@ersin-erdal ersin-erdal requested a review from doakalexi June 19, 2025 14:12
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Unknown metric groups

References to deprecated APIs

id before after diff
taskManager 12 14 +2

History

Copy link
Contributor

@doakalexi doakalexi left a comment

Choose a reason for hiding this comment

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

LGTM! I tested locally and works as described

@ersin-erdal ersin-erdal merged commit 723fcc3 into elastic:main Jun 20, 2025
10 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19

https://github.com/elastic/kibana/actions/runs/15781523545

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 20, 2025
Resolves: elastic#213391

This PR adds validation for task interval where it is updated.

There are 5 places in the TaskStore that we update the interval:
`schedule`, `bulkSchedule`, `update`, `bulkUpdate` and
`bulkPartialUpdate`

For the bulk operations we just skip the task with invalid interval, for
schedule and update throw an error and stop the execution.

## To verify:
Create a rule with connector.
Let it run for a while.
Then update the rule.

There shouldn't be any error.

(cherry picked from commit 723fcc3)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jun 22, 2025
# Backport

This will backport the following commits from `main` to `8.19`:
- [Validate interval when a task is updated
(#222486)](#222486)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Ersin
Erdal","email":"92688503+ersin-erdal@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-06-20T14:45:08Z","message":"Validate
interval when a task is updated (#222486)\n\nResolves: #213391\n\nThis
PR adds validation for task interval where it is updated.\n\nThere are 5
places in the TaskStore that we update the interval:\n`schedule`,
`bulkSchedule`, `update`, `bulkUpdate` and\n`bulkPartialUpdate`\n\nFor
the bulk operations we just skip the task with invalid interval,
for\nschedule and update throw an error and stop the execution.\n\n## To
verify:\nCreate a rule with connector.\nLet it run for a while.\nThen
update the rule.\n\nThere shouldn't be any
error.","sha":"723fcc335210fa68c37e7db63c35c1530ec5f1d7","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","backport:version","v9.1.0","v8.19.0"],"title":"Validate
interval when a task is
updated","number":222486,"url":"https://github.com/elastic/kibana/pull/222486","mergeCommit":{"message":"Validate
interval when a task is updated (#222486)\n\nResolves: #213391\n\nThis
PR adds validation for task interval where it is updated.\n\nThere are 5
places in the TaskStore that we update the interval:\n`schedule`,
`bulkSchedule`, `update`, `bulkUpdate` and\n`bulkPartialUpdate`\n\nFor
the bulk operations we just skip the task with invalid interval,
for\nschedule and update throw an error and stop the execution.\n\n## To
verify:\nCreate a rule with connector.\nLet it run for a while.\nThen
update the rule.\n\nThere shouldn't be any
error.","sha":"723fcc335210fa68c37e7db63c35c1530ec5f1d7"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/222486","number":222486,"mergeCommit":{"message":"Validate
interval when a task is updated (#222486)\n\nResolves: #213391\n\nThis
PR adds validation for task interval where it is updated.\n\nThere are 5
places in the TaskStore that we update the interval:\n`schedule`,
`bulkSchedule`, `update`, `bulkUpdate` and\n`bulkPartialUpdate`\n\nFor
the bulk operations we just skip the task with invalid interval,
for\nschedule and update throw an error and stop the execution.\n\n## To
verify:\nCreate a rule with connector.\nLet it run for a while.\nThen
update the rule.\n\nThere shouldn't be any
error.","sha":"723fcc335210fa68c37e7db63c35c1530ec5f1d7"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Ersin Erdal <92688503+ersin-erdal@users.noreply.github.com>
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request Jun 25, 2025
Resolves: elastic#213391

This PR adds validation for task interval where it is updated.

There are 5 places in the TaskStore that we update the interval:
`schedule`, `bulkSchedule`, `update`, `bulkUpdate` and
`bulkPartialUpdate`

For the bulk operations we just skip the task with invalid interval, for
schedule and update throw an error and stop the execution.

## To verify:
Create a rule with connector.
Let it run for a while.
Then update the rule.

There shouldn't be any error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add validation in more places in the task manager where the interval may be modified

4 participants