-
Notifications
You must be signed in to change notification settings - Fork 2k
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
server: handle invalid jobs in expose handler hook #10154
Conversation
The expose handler hook must handle if the submitted job is invalid.
// Mutators run first before validators, so validators view the final rendered job. | ||
// So, mutators must handle invalid jobs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not fully sure what the motivation of having mutators run first: but this has bitten us before with a similar panic #6575 .
I'm not fully sure of the impact of re-ordering steps, so we validate first then mutate. Skimming code, that would mean that we'd attempt to validating the job first before canonalizing it, which may open another can of worms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really unfortunate in that we really have two types of validation: validation for safety which really wants to happen before mutation (canonicalization, making sure we don't have nil pointers in unexpected places), and validation for "business logic" (ex. task group count for system jobs).
But solving that is beyond the scope of this bug fix, so 👍 for leaving this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// Mutators run first before validators, so validators view the final rendered job. | ||
// So, mutators must handle invalid jobs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really unfortunate in that we really have two types of validation: validation for safety which really wants to happen before mutation (canonicalization, making sure we don't have nil pointers in unexpected places), and validation for "business logic" (ex. task group count for system jobs).
But solving that is beyond the scope of this bug fix, so 👍 for leaving this comment.
Co-authored-by: Tim Gross <[email protected]>
The expose handler hook must handle if the submitted job is invalid. Without this validation, the rpc handler panics on invalid input. Co-authored-by: Tim Gross <[email protected]>
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
The expose handler hook must handle if the submitted job is invalid. Without this validation, the rpc handler panics on invalid input.
Fixes #10115