Fix stale baseline_snapshot.json hashes in Check Saved Objects CI step#252435
Closed
clintandrewhall wants to merge 1 commit intoelastic:mainfrom
Closed
Fix stale baseline_snapshot.json hashes in Check Saved Objects CI step#252435clintandrewhall wants to merge 1 commit intoelastic:mainfrom
clintandrewhall wants to merge 1 commit intoelastic:mainfrom
Conversation
Contributor
|
Pinging @elastic/kibana-core (Team:Core) |
Contributor
Author
|
This was just a suggestion, and a check to see if the fix actually resolved the CI failure-- which it did. But now that the change has been reverted, I'm sure there will be discussions as to how to address this. I'm closing it in the meantime. Perhaps it will be helpful later! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes a false positive in the Check Saved Objects CI step that causes unrelated PRs to fail with:
Root cause
The
joidependency was bumped from^18.0.1to^18.0.2in #245131 (Jan 14), one day after theperson-so-typetest fixture and itsbaseline_snapshot.jsonwere introduced in #248443 (Jan 13).The
baseline_snapshot.jsoncontains precomputed hashes (modelVersionHash,schemas.forwardCompatibility,schemas.create) derived from@kbn/config-schemaobjects, which are built on top ofjoi. The hashes are generated byJSON.stringify-ing schema objects and computing SHA-256 digests. Whenjoi's internal representation changed in the patch update, the serialization output changed, producing different hashes — even though the model version definitions themselves were untouched.The CI step's
getMutatedModelVersionsfunction (invalidate_changes.ts) deep-compares baseline model version summaries against freshly computed ones. The stale hashes cause it to flagperson-so-typeversion 1 as "mutated," which is a false positive.This only manifests in test mode — the fallback path (#251139) that runs when a PR doesn't modify any SO types. In that path, the CI loads the committed
baseline_snapshot.jsonas the "before" state and compares it against a freshtakeSnapshot(TEST_TYPES).Changes
Refreshed
baseline_snapshot.jsonhashes — Updated thehash,modelVersionHash, andschemashash fields for all three test types to match the currentjoiversion. The structural "before" state (which types exist, which model versions are present, mappings, etc.) is preserved exactly as-is, since the deliberate differences between the baseline and current code are what make the test mode exercise the validation pipeline and trigger rollback tests.Added
update_baseline_hashes.tsutility — A script that automates refreshing these hashes for the next time a transitive dependency change invalidates them. It reads the existing baseline, takes a fresh snapshot ofTEST_TYPES, patches only the hash-dependent fields, and writes it back. Run via:Test plan
@kbn/check-saved-objects-cliunit tests pass (24 existing + 1 new).Check Saved Objectsstep passes on this PR (test mode fallback path).Made with Cursor