-
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
[Cases] Migrate user actions connector ID V2 #112710
[Cases] Migrate user actions connector ID V2 #112710
Conversation
Pinging @elastic/security-threat-hunting (Team:Threat Hunting) |
💚 Build SucceededMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
To update your PR or re-run it, just comment with: |
* Making progress * Fleshing out the extraction logic * Finishing migration logic and starting more tests * Finishing migration unit tests * Making progress on services * Finishing transform to es schema * Finishing transform functionality and unit tests * reverting migration data updates * Cleaning up type errors * fixing test error * Working migration tests * Refactoring retrieval of connector fields * Refactoring connector id in and tests in frontend * Fixing tests and finished refactoring parse string * Fixing integration test * Fixing integration tests * Removing some duplicate code and updating test name * Fixing create connector user action bug * Addressing feedback and logging error * Moving parsing function to common * Fixing type errors * Fixing type errors * Addressing feedback * Fixing lint errors * Adjusting import for user action changes Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
* Making progress * Fleshing out the extraction logic * Finishing migration logic and starting more tests * Finishing migration unit tests * Making progress on services * Finishing transform to es schema * Finishing transform functionality and unit tests * reverting migration data updates * Cleaning up type errors * fixing test error * Working migration tests * Refactoring retrieval of connector fields * Refactoring connector id in and tests in frontend * Fixing tests and finished refactoring parse string * Fixing integration test * Fixing integration tests * Removing some duplicate code and updating test name * Fixing create connector user action bug * Addressing feedback and logging error * Moving parsing function to common * Fixing type errors * Fixing type errors * Addressing feedback * Fixing lint errors * Adjusting import for user action changes Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Jonathan Buttner <56361221+jonathan-buttner@users.noreply.github.com>
The original PR was reverted because it broke master: #108272 (comment)
I updated the tests in the last commit: 09ec155
Background: #105677
Initial PR: #104221
This is a follow on PR for the work to migrate references to saved objects that are stored in fields outside of the
references
field for user actions. The connector ID can be stored in a few types of user actions:Creation of a case user action
Updating the connector within a case
Pushing a case
User actions holds a JSON encoded version of the above objects in the fields named
oldValue
andnewValue
to indicate what the original value was and what it is being changed to.Performance Concern
The easiest solution would be to have the backend decode the user actions
oldValue
andnewValue
fields and place the connector ID back into them and re-encode the fields before they are returned to the UI. This would have avoiding needing to change any code in the UI. We had some performance concerns with doing that approach for every user action when the case detail view is requested.Instead the approach we took was to move the ids to
new_val_connector_id
andold_val_connector_id
. This required a number of changes in the UI to look for that field instead of using the encoded values for the id.Notable Changes
references
fieldreferences
fieldnew_val_connector_id
andold_val_connector_id
fields to correspond with thenewValue
andoldValue
*_val_connector_id
parseString
on the encoded valueTesting
I added unit tests for the transformation and migration code in the backend and frontend where I could. I also added integration tests that run the migration on older 7.13 data.
To test this PR: