Skip to content

Disallow stability and deprecated on v2 attribute refs - #1670

Draft
lmolkova wants to merge 1 commit into
mainfrom
v2-no-ref-stability
Draft

Disallow stability and deprecated on v2 attribute refs#1670
lmolkova wants to merge 1 commit into
mainfrom
v2-no-ref-stability

Conversation

@lmolkova

@lmolkova lmolkova commented Aug 5, 2026

Copy link
Copy Markdown
Member

These always come from the attribute definition. Using them on a ref is now a failure.

Related to #1658

  • we don't have tests for it
  • we don't have a use-case for it
  • since we don't always have original attribute definition and only know ref properties, we might be limited in weaver live checks

We can add them in some other form that does not hide original deprecation and stability.

These always come from the attribute definition. Using them on a ref is
now a hard parse failure.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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/deprecated from the v2 JSON schema for attribute refs (including span attribute refs).
  • Updates v2→v1 translation to always emit stability: None / deprecated: None for attribute refs.
  • Updates syntax docs to state stability/deprecated cannot 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

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.3%. Comparing base (f7b63a0) to head (290229e).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants