-
Notifications
You must be signed in to change notification settings - Fork 8.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
[SO Migration] write an integration test tracking all registered SO types' migrations, mappings, schemas #104100
Comments
Pinging @elastic/kibana-core (Team:Core) |
We could require all the saved objects-related code to live in the
Besides being able to review the migrations code, the Core team might set up advanced metrics collection for migrations. Test coverage for the migrations code, for example. |
We recently had to rush out an 8.4.1 release due to #139412, which was an issue caused by a saved object mapping being changed without a corresponding migration being written. That scenario couldn't have been prevented by a review process on migrations alone, as the root cause wasn't a problematic migration, but rather a missing migration. We have three concepts in saved objects that are all closely related:
The vast majority of the time, a change in any one of these areas will require a change in the other areas too. So if we are looking for a solution that will improve the overall stability of our saved objects, it would ideally encompass all of the above and not be limited to migrations only. The @elastic/kibana-core team met today and discussed a few different ideas of how we could introduce more guardrails to prevent issues like #139412 from happening again in the future. Several different approaches were considered. Ideas
Pros & Cons (1) Seems like a promising solution but would be a longer-term one, requiring much discussion and planning to ensure we arrive at the right API. We think it is highly likely that there would be some migration scenarios that still require an "escape hatch" of manually writing transform functions as we do today, reducing the effectiveness somewhat. TLDR: We are recommending that we shift the scope of this issue to focus on adding an integration test as outlined in idea (5), which would basically enforce a codeowners review any time a plugin creates a new saved object type, or makes changes to an existing saved object type. This added layer of review would ensure we have more eyes on these types of changes, thus reducing the likelihood of major regressions. Would love to have folks chime in with any other ideas, otherwise we will look to implement idea (5) sometime in the near-term. |
I am a big +1 on the integration test path: it feels like we are not utilizing integration tests to be defensive enough. It gives other teams a clear early warning and a reminder to make their saved objects "safer" by adding more related tests. |
We discussed again today and agreed we will change the scope of this issue to focus on option (5), that is, writing an integration test that serializes all registered SO types, and giving Core codeowners over that file so that we can review all changes that happen to registered types. We see this as requiring two things:
We're working to get this prioritized in the near term, and will post any updates here. |
If the migration system itself can now be considered pretty resilient against failures, it’s still as fragile as the old implementation regarding errors thrown from migration functions registered by the type owners.
If a migration function is buggy, or does not properly handle some edge case resulting in an error being thrown, it will result in the whole migration process failing.
I don’t think we can really improve the algorithm for that. A migration function is supposed to be working as intended. The migration system cannot guess if a failure was valid or not, and we can’t just ignore the failure and copy the unmigrated object to the target index, as it could lead to even worse runtime problems.
Instead, our best shot here is probably to add a proper process around SO migration functions to make sure that the added migrations are properly handling edge cases before being integrated into master.
We would ideally find a way to have the
core
team being considered automatically as a code-owner for the files inside plugin code where the migration lives and are added. However, I'm not sure this is something that is doable with theCODEOWNER
file format. Also, for delegated migrations, such as embeddables and/or PSS, I don't think we could really find a file pattern for it.If an automated process is not possible, we will have to fallback to education and documentation to have the teams manually ping and add us a reviewers on PRs were migration functions were added or updated.
The text was updated successfully, but these errors were encountered: