-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Update bulk edit api to include skipped rules in response #144461
[Security Solution] Update bulk edit api to include skipped rules in response #144461
Conversation
...ecurity_solution/server/lib/detection_engine/rule_management/api/rules/bulk_actions/route.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/detection_engine/rule_management/api/api.ts
Outdated
Show resolved
Hide resolved
6b3369b
to
67982c7
Compare
return `${i18n.RULES_BULK_EDIT_SUCCESS_DESCRIPTION(summary.succeeded)}. ${ | ||
i18n.RULES_BULK_EDIT_SUCCESS_INDEX_EDIT_DESCRIPTION | ||
return `${i18n.RULES_BULK_EDIT_SUCCESS_DESCRIPTION(summary.succeeded, summary.skipped)} ${ | ||
summary.skipped > 0 ? i18n.RULES_BULK_EDIT_SUCCESS_DATA_VIEW_RULES_SKIPPED_DETAIL : '' |
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.
Only add the explanation about rules with data views being ignored if the action is index_pattern related and the API call responded with skipped rules.
...ecurity_solution/server/lib/detection_engine/rule_management/api/rules/bulk_actions/route.ts
Outdated
Show resolved
Hide resolved
Pinging @elastic/security-detections-response (Team:Detections and Resp) |
Pinging @elastic/security-solution (Team: SecuritySolution) |
73a39f0
to
fe2dd59
Compare
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.
@jpdjere The changes look good
There is a couple of comments which needs attention.
...ecurity_solution/server/lib/detection_engine/rule_management/api/rules/bulk_actions/route.ts
Outdated
Show resolved
Hide resolved
...ecurity_solution/server/lib/detection_engine/rule_management/api/rules/bulk_actions/route.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/cypress/e2e/detection_rules/bulk_edit_rules.cy.ts
Outdated
Show resolved
Hide resolved
c493263
to
3f59997
Compare
As per discussed today, I added the However, @banderror, because of your comments on adding a case for skipping a rule update in the case of adding a rule that already exists, I realised that the skipping logic as is in the PR can only be used for If we want to skip the editing of I already started doing this implementation but would like to work on it on a separate PR, and get this PR merged up to its present scope. Let me know what you think. |
6c452e1
to
e66aeed
Compare
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.
There are quite a bunch of comments, let me post what I have by now and continue the review.
x-pack/plugins/security_solution/cypress/e2e/detection_rules/bulk_edit_rules.cy.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/cypress/e2e/detection_rules/bulk_edit_rules.cy.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/cypress/e2e/detection_rules/bulk_edit_rules.cy.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/cypress/e2e/detection_rules/bulk_edit_rules.cy.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/cypress/e2e/detection_rules/bulk_edit_rules.cy.ts
Outdated
Show resolved
Hide resolved
...security_solution/public/detection_engine/rule_management/logic/bulk_actions/translations.ts
Outdated
Show resolved
Hide resolved
skipped: 0, | ||
succeeded: details.exported_rules_count, | ||
failed: details.missing_rules_count, | ||
total: details.exported_rules_count + details.missing_rules_count, |
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.
Curious why we treat missing_rules_count
as failed
rather than skipped
?
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 sure how this should work. Whar are missing rules when attempting to export? I guess we can consider them as skipped
, but would like to understand this fully before making the change.
...ecurity_solution/server/lib/detection_engine/rule_management/api/rules/bulk_actions/route.ts
Outdated
Show resolved
Hide resolved
...ecurity_solution/server/lib/detection_engine/rule_management/api/rules/bulk_actions/route.ts
Outdated
Show resolved
Hide resolved
...ecurity_solution/server/lib/detection_engine/rule_management/api/rules/bulk_actions/route.ts
Outdated
Show resolved
Hide resolved
@jpdjere I really don't think we should implement skipping via throwing exceptions. |
Simplify return skipped rules Add tests for rule params modifier Extend Cypress tests Refactored rule_params_modifier and add bulk edit response types Add skipping logic for atrributes Wire up changes in API Add tests for should_skip_attributes
Bulk edit test update Update tests for retryIfBulkEditConflicts Fix types Correct number of rules to test Extract out updateRuleAttributesInMemory Refactor bulkEditOcc Refactored types Simplified skip_reason logic Update client type
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' Update retry_if_bulk_edit_conflicts and add coverage WIP refactor bulk_edit.test.ts WIP bulk_edit.test.ts Correct beforeEach
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'
d8325be
to
181d69c
Compare
💔 Build FailedFailed CI StepsTest Failures
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Unknown metric groupsAPI count
ESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @jpdjere |
Closing in favour of #147345 after ResponseOps refactored |
…int (#2731) Relates to: #2684 Feature tickets: elastic/kibana#145093 elastic/kibana#139802 Implemented in PR: elastic/kibana#144461
Addresses: #145093
Related to: #139802
Summary
skipped
property for rules whose updating was skipped. See #145093 for details on when a rule is skipped.x-pack/plugins/alerting/server/rules_client/rules_client.ts
, refactored the methodsbulkEdit
andbulkEditOcc
to smaller methods, following an immutable approach.Skipped.bulk.edit.rules.mp4
Checklist
Delete any items that are not applicable to this PR.
skipped
response parameter of the _bulk_action endpoint security-docs#2684For maintainers