Disallow stability and deprecated on v2 attribute refs - #1670
Draft
lmolkova wants to merge 1 commit into
Draft
Conversation
These always come from the attribute definition. Using them on a ref is now a hard parse failure.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Semantic Convention v2 surface area to make stability and deprecated illegal on attribute references, ensuring those properties only come from the canonical attribute definition (not per-signal refinements).
Changes:
- Removes
stability/deprecatedfrom the v2 JSON schema for attribute refs (including span attribute refs). - Updates v2→v1 translation to always emit
stability: None/deprecated: Nonefor attribute refs. - Updates syntax docs to state
stability/deprecatedcannot be refined, and adds a regression test to ensure YAML parsing rejects them on refs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| schemas/semconv.schema.v2.json | Removes stability/deprecated from attribute-ref schema definitions so they’re rejected structurally. |
| schemas/semconv-syntax.v2.md | Updates documentation to clarify stability/deprecated are not refinable on refs. |
| crates/weaver_semconv/src/v2/span.rs | Ensures span attribute ref conversion no longer forwards stability/deprecated. |
| crates/weaver_semconv/src/v2/attribute.rs | Removes stability/deprecated from AttributeRef and adds a test asserting they’re rejected on refs. |
| crates/weaver_infer/src/lib.rs | Updates inferred v2 AttributeRef construction to match the new struct shape. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+191
to
+196
| for field in ["stability: stable", "deprecated:\n reason: obsoleted"] { | ||
| let yaml = format!("ref: my.attribute\n{field}\n"); | ||
| let err = serde_yaml::from_str::<AttributeRef>(&yaml) | ||
| .expect_err("stability/deprecated must not be allowed on attribute refs"); | ||
| assert!(err.to_string().contains("unknown field"), "{err}"); | ||
| } |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1670 +/- ##
=======================================
- Coverage 81.4% 81.3% -0.1%
=======================================
Files 131 131
Lines 11714 11708 -6
=======================================
- Hits 9538 9528 -10
- Misses 2176 2180 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
These always come from the attribute definition. Using them on a ref is now a failure.
Related to #1658
We can add them in some other form that does not hide original deprecation and stability.