Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[Security Solution] Remove the advanced sorting switch from the rules management page #149840
[Security Solution] Remove the advanced sorting switch from the rules management page #149840
Changes from all commits
c61110b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 don't recall off hand, but are there any old legacy
outcome
's that a user could have lingering around that wouldn't be included in theRuleLastRunOutcomeOrderMap
? If so, isundefined
fine here until the next rule execution?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.
The
outcome
field was added in 8.6 with only three values specified in theRuleLastRunOutcomeOrderMap
. So I don't expect any other values there. That said,undefined
should also work just fine.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.
Problem is, the
outcomeOrder
is defined as anumber
, but in the case of aoutcome: undefined
- or some change in the future that would add a new outcome but forget to add the order - the order will end up beingundefined
. Feels like we should changeoutcomeOrder
to benumber | undefined
, or write a function to generate the updated value that deals with the potentialundefined
value, where it's generated in execution.If we want to keep it typed as a number, then I think we need to supply a number here, but not sure what we'd use. If we go with making
outcome_order
asnumber | undefined
, then this code is fine as-is , as it would generate anundefined
(if outcome is not set or an unexpected value).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.
Unless I miss something,
outcome
cannot beundefined
. See the 8.6 migration, for example:https://github.com/elastic/kibana/blob/2d675b47a7c3210a1b430e89ff51c9d7485d1fd2/x-pack/plugins/alerting/server/saved_objects/migrations/8.6/index.ts#L22-L35
If the
outcome
is unknown, the wholelastRun
structure is omitted.Furthermore, adding a new outcome value will cause a type error if the value is not added to the
outcome->order
map:So TypeScript protects us from forgetting to add values to the linked structures.
That said, if you feel strongly about changing the type of
outcomeOrder
tonumber | undefined
, I'm okay with that. It doesn't affect the code of Security Solution in any way, as we don't work with that field directly.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.
Awesome! We've become more sensitive to migrations recently so wanted to understand this one well.
The main thing I'm worrying about is some bug where we would unintentionally have
outcome
set to some invalid value, as part of normal (presumably buggy!) operation. And then the migration would end up writing out anundefined
for the order. But ... that's valid for that field :-)So, even in that case, I don't think there's anything else we can do to improve the migration.
The rest of the type-checking on outcome looks good, thanks for explaining.