Skip to content
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

[Response Ops][Task Manager] Validate Task Instance During "mGet" Task Claiming #207158

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JiaweiWu
Copy link
Contributor

Summary

Resolves: #204466

This PR adds schema validation to the task instance during the mGet task claiming strategy logic. This should ensure malformed tasks do no short circuit other tasks from being claimed. Not sure if this is overkill but it seems like a good approach to have runtime validation instead of just a try and catch over the entire task claiming logic.

Checklist

@JiaweiWu JiaweiWu added release_note:skip Skip the PR/issue when compiling release notes Feature:Task Manager backport:skip This commit does not require backporting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v9.0.0 labels Jan 20, 2025
@JiaweiWu JiaweiWu requested a review from a team as a code owner January 20, 2025 03:13
@elasticmachine
Copy link
Contributor

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

@@ -169,6 +171,17 @@ async function claimAvailableTasks(opts: TaskClaimerOpts): Promise<ClaimOwnershi
const now = new Date();
const taskUpdates: PartialConcreteTaskInstance[] = [];
for (const task of tasksToRun) {
try {
concreteTaskInstanceSchema.validate(task);
Copy link
Contributor

Choose a reason for hiding this comment

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

This validation currently catches the PT1M issue because we changed the schema for that field from schema.duration to schema.string, however prior to that fix, using this validation would not have caught the PT1M issue. I think because the goal of the issue is to catch the unknown unknown errors, we should be aiming more broadly.

@ymao1 ymao1 requested review from a team and removed request for a team January 21, 2025 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Task Manager release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Response Ops][Task Manager] mget claim strategy should be more resilient to single malformed claimed task.
3 participants