-
Notifications
You must be signed in to change notification settings - Fork 376
Don't allow signal definition to reference attributes with lower stability than the signal itself #3752
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
Merged
lmolkova
merged 8 commits into
open-telemetry:main
from
lmolkova:group-stability-policy-fix
Jun 1, 2026
Merged
Don't allow signal definition to reference attributes with lower stability than the signal itself #3752
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5f812fc
Check that stability of a group is not higher than of its attributes
lmolkova 040f979
update text policy too
lmolkova 87a9b13
better tests
lmolkova bfbdbc6
changelog
lmolkova 664868b
changelog
lmolkova 38c7ce2
add todo with link
lmolkova e1d9f9b
lint
lmolkova 927aa2c
Potential fix for pull request finding
lmolkova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| change_type: enhancement | ||
| component: docs | ||
| note: > | ||
| Don't allow signal definition to reference attributes with lower stability | ||
| than the signal itself (unless they are opt-in). | ||
| issues: [3752] | ||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,69 @@ | ||
| package after_resolution | ||
| import future.keywords | ||
|
|
||
| test_fails_on_experimental_not_opt_in_attribute_in_stable_group if { | ||
| experimental_stabilities := ["experimental", "development", "alpha", "beta", "release_candidate"] | ||
| every stability in experimental_stabilities { | ||
| count(deny) == 1 with input as {"groups": [{ "id": "span.foo", | ||
| "type": "span", | ||
| "stability": "stable", | ||
| "brief": "brief.", | ||
| "attributes": [{ | ||
| "name": "test.experimental", | ||
| "stability": stability, | ||
| "requirement_level": "required", | ||
| "brief": "brief.", | ||
| }]}]} | ||
| gs_group_types := ["span", "metric", "event", "entity"] | ||
|
|
||
| gs_lower_stabilities := ["experimental", "development", "alpha", "beta", "release_candidate"] | ||
|
|
||
| # Builds an input with a single group of the given type referencing a single attribute. | ||
| gs_input(group_type, group_stability, attr_stability, requirement_level) := {"groups": [{ | ||
| "id": sprintf("%s.foo", [group_type]), | ||
| "type": group_type, | ||
| "stability": group_stability, | ||
| "brief": "brief.", | ||
| "attributes": [{ | ||
| "name": "test.attr", | ||
| "stability": attr_stability, | ||
| "requirement_level": requirement_level, | ||
| "brief": "brief.", | ||
| }], | ||
| }]} | ||
|
|
||
| # A group must not reference a lower-maturity attribute unless it's opt_in. | ||
| test_fails_on_lower_maturity_not_opt_in_attribute if { | ||
| every group_type in gs_group_types { | ||
| every stability in gs_lower_stabilities { | ||
| count(deny) == 1 with input as gs_input(group_type, "stable", stability, "required") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| test_passes_on_lower_maturity_opt_in_attribute if { | ||
|
lmolkova marked this conversation as resolved.
|
||
| every group_type in gs_group_types { | ||
| every stability in gs_lower_stabilities { | ||
| count(deny) == 0 with input as gs_input(group_type, "stable", stability, "opt_in") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| # Group stability higher than the attribute's (non-stable group) still fails. | ||
| test_fails_when_group_stability_higher_than_attribute if { | ||
| every group_type in gs_group_types { | ||
| count(deny) == 1 with input as gs_input(group_type, "release_candidate", "development", "required") | ||
| } | ||
| } | ||
|
|
||
| test_passes_on_experimental_opt_in_attribute_in_stable_group if { | ||
| experimental_stabilities := ["experimental", "development", "alpha", "beta", "release_candidate"] | ||
| every stability in experimental_stabilities { | ||
| count(deny) == 0 with input as {"groups": [{ "id": "span.foo", | ||
| "type": "span", | ||
| "stability": "stable", | ||
| "brief": "brief.", | ||
| "attributes": [{ | ||
| "name": "test.experimental", | ||
| "stability": stability, | ||
| "requirement_level": "opt_in", | ||
| "brief": "brief.", | ||
| }]}]} | ||
| # A lower-stability group referencing a higher-stability attribute is fine. | ||
| test_passes_when_group_stability_lower_than_attribute if { | ||
| every group_type in gs_group_types { | ||
| count(deny) == 0 with input as gs_input(group_type, "development", "stable", "required") | ||
| } | ||
| } | ||
|
|
||
| test_passes_when_group_and_attribute_have_equal_stability if { | ||
| every group_type in gs_group_types { | ||
| count(deny) == 0 with input as gs_input(group_type, "release_candidate", "release_candidate", "required") | ||
| } | ||
| } | ||
|
|
||
| # A lower-stability attribute is allowed at opt_in in a more stable group. | ||
| test_passes_on_lower_stability_opt_in_attribute if { | ||
| every group_type in gs_group_types { | ||
| count(deny) == 0 with input as gs_input(group_type, "release_candidate", "development", "opt_in") | ||
| } | ||
| } | ||
|
|
||
| # attribute_group is exempt from the check regardless of stability. | ||
| test_passes_on_attribute_group if { | ||
| count(deny) == 0 with input as gs_input("attribute_group", "stable", "development", "required") | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.