Skip to content

Adding a unit test to detect when StackTemplateRegistry#REGISTRY_VERSION needs to be incremented#136666

Merged
eyalkoren merged 5 commits intoelastic:mainfrom
eyalkoren:hash-for-registry-components
Oct 19, 2025
Merged

Adding a unit test to detect when StackTemplateRegistry#REGISTRY_VERSION needs to be incremented#136666
eyalkoren merged 5 commits intoelastic:mainfrom
eyalkoren:hash-for-registry-components

Conversation

@eyalkoren
Copy link
Contributor

@eyalkoren eyalkoren commented Oct 16, 2025

Adding a constant to StackTemplateRegistry that represents the checksum of all components registered to it and a test that verifies that the checksum matches it. If the checksum is not equal, it indicates that one of the registered components have been change, triggering the test failure with a message that instructs how to update the checksum and version.

It is a low-risk change with very minimal refactoring of production code. Logic is only added in the test.

It's added specifically to StackTemplateRegistry, but can potentially be ported later on to IndexTemplateRegistry for use by all registries, just would require a bit more refactoring. Proposing to start with this one.

@eyalkoren eyalkoren requested a review from felixbarny October 16, 2025 07:34
@eyalkoren eyalkoren self-assigned this Oct 16, 2025
@eyalkoren eyalkoren added >test Issues or PRs that are addressing/adding tests :StorageEngine/Data streams Data streams and their lifecycles v9.3.0 labels Oct 16, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Data Management (obsolete) DO NOT USE. This team no longer exists. label Oct 16, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

Copy link
Member

@felixbarny felixbarny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I like the approach of starting with the StackTemplateRegistry and then extending this to others.
To prepare for that, I think that slight adjustments would could make it easier for other registries to leverage the checksum validation. I'm thinking of the OTel one in particular. I'll add some comments regarding that inline.

Copy link
Contributor

@nielsbauman nielsbauman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I like this idea! When Jimmy has had time to make progress with his revamp of this registry system, we can see how we can incorporate a check like this on a larger scale.

@eyalkoren eyalkoren merged commit 0701a22 into elastic:main Oct 19, 2025
34 checks passed
@eyalkoren eyalkoren deleted the hash-for-registry-components branch October 19, 2025 08:24
chrisparrinello pushed a commit to chrisparrinello/elasticsearch that referenced this pull request Oct 24, 2025
fzowl pushed a commit to voyage-ai/elasticsearch that referenced this pull request Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:StorageEngine/Data streams Data streams and their lifecycles Team:Data Management (obsolete) DO NOT USE. This team no longer exists. >test Issues or PRs that are addressing/adding tests v9.3.0

4 participants