Skip to content

Commit b4cdd7a

Browse files
committed
cleanup
1 parent af447d7 commit b4cdd7a

7 files changed

Lines changed: 4 additions & 45 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"CompoundError":[{"EntityRefinementChangedIdentity":{"refinement_id":"entity.chained.entity","ref":"entity.refined.entity","attribute_id":"test.attr","role":"descriptive","provenance":{"schema_url":"https://default/0.1.0","path":"data/registry-test-v2-6-identity-demote/registry/v2-identity-demote.yaml"}}},{"EntityRefinementChangedIdentity":{"refinement_id":"entity.demoting.entity","ref":"entity.base.entity","attribute_id":"test.attr","role":"descriptive","provenance":{"schema_url":"https://default/0.1.0","path":"data/registry-test-v2-6-identity-demote/registry/v2-identity-demote.yaml"}}}]}
1+
{"CompoundError":[{"EntityRefinementChangedIdentity":{"refinement_id":"entity.demoting.entity","ref":"entity.base.entity","attribute_id":"test.attr","role":"descriptive","provenance":{"schema_url":"https://default/0.1.0","path":"data/registry-test-v2-6-identity-demote/registry/v2-identity-demote.yaml"}}}]}

crates/weaver_resolver/data/registry-test-v2-6-identity-demote/registry/v2-identity-demote.yaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@ entity_refinements:
2121
identity:
2222
- ref: test.attr
2323
brief: Refined identity attribute
24-
# Invalid: demotion through a chained refinement — test.attr is inherited
25-
# with the identifying role from refined.entity.
26-
- id: entity.chained.entity
27-
ref: refined.entity
28-
brief: Chained refinement
29-
description:
30-
- ref: test.attr
31-
brief: Demoted identity attribute of a refinement
3224
# Invalid: test.attr is an identity attribute of base.entity and must be
3325
# refined under `identity`, not `description`.
3426
- id: entity.demoting.entity
@@ -37,10 +29,3 @@ entity_refinements:
3729
description:
3830
- ref: test.attr
3931
brief: Demoted identity attribute
40-
# Resolves cleanly against the offending refinement above: the demotion
41-
# must not leave `demoting.entity` unresolved, so this group must NOT add
42-
# `UnresolvedExtendsRef` noise. The only expected errors are the two
43-
# demotions.
44-
- id: entity.noise.entity
45-
ref: demoting.entity
46-
brief: Extends the offending refinement
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"CompoundError":[{"EntityRefinementChangedIdentity":{"refinement_id":"entity.chained.entity","ref":"entity.refined.entity","attribute_id":"test.attr2","role":"identifying","provenance":{"schema_url":"https://default/0.1.0","path":"data/registry-test-v2-7-identity-promote/registry/v2-identity-promote.yaml"}}},{"EntityRefinementChangedIdentity":{"refinement_id":"entity.promoting.entity","ref":"entity.base.entity","attribute_id":"test.attr2","role":"identifying","provenance":{"schema_url":"https://default/0.1.0","path":"data/registry-test-v2-7-identity-promote/registry/v2-identity-promote.yaml"}}}]}
1+
{"CompoundError":[{"EntityRefinementChangedIdentity":{"refinement_id":"entity.promoting.entity","ref":"entity.base.entity","attribute_id":"test.attr2","role":"identifying","provenance":{"schema_url":"https://default/0.1.0","path":"data/registry-test-v2-7-identity-promote/registry/v2-identity-promote.yaml"}}}]}

crates/weaver_resolver/data/registry-test-v2-7-identity-promote/registry/v2-identity-promote.yaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ entity_refinements:
2727
description:
2828
- ref: test.attr2
2929
brief: Refined descriptive attribute
30-
# Invalid: promotion through a chained refinement — test.attr2 is inherited
31-
# with the descriptive role from refined.entity.
32-
- id: entity.chained.entity
33-
ref: refined.entity
34-
brief: Chained refinement
35-
identity:
36-
- ref: test.attr2
37-
brief: Promoted descriptive attribute of a refinement
3830
# Invalid: test.attr2 is a descriptive attribute of base.entity and must be
3931
# refined under `description`, not `identity`.
4032
- id: entity.promoting.entity
@@ -43,10 +35,3 @@ entity_refinements:
4335
identity:
4436
- ref: test.attr2
4537
brief: Promoted descriptive attribute
46-
# Resolves cleanly against the offending refinement above: the promotion
47-
# must not leave `promoting.entity` unresolved, so this group must NOT add
48-
# `UnresolvedExtendsRef` noise. The only expected errors are the two
49-
# promotions.
50-
- id: entity.noise.entity
51-
ref: promoting.entity
52-
brief: Extends the offending refinement

crates/weaver_resolver/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ pub enum Error {
187187
},
188188

189189
/// Entity refinement changes identity.
190-
#[error("Entity refinement `{refinement_id}` changes the identity of `{ref}` by referencing `{attribute_id}` under `{role}`.\nProvenance: {provenance:?}")]
190+
#[error("Entity refinement `{refinement_id}` changes the identity of `{ref}` by referencing `{attribute_id}` under `{role:?}`.\nProvenance: {provenance:?}")]
191191
#[diagnostic(help(
192192
"A refinement must preserve the base entity's identity: keep base attributes under the same section (`identity` or `description`) as the base, and do not add new `identity` attributes."
193193
))]

crates/weaver_resolver/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ mod tests {
842842
let msg = e.to_string();
843843
assert!(
844844
msg.contains("Entity refinement `demoted.host` changes the identity of")
845-
&& msg.contains("referencing `host.id` under `description`"),
845+
&& msg.contains("referencing `host.id` under `Descriptive`"),
846846
"Expected identity demotion error, got: {msg}"
847847
);
848848
}

crates/weaver_semconv/src/attribute.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -263,17 +263,6 @@ impl AttributeRole {
263263
}
264264
}
265265

266-
impl Display for AttributeRole {
267-
/// Renders the role as the yaml section attributes with that role are
268-
/// declared under (`identity` / `description`).
269-
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
270-
match self {
271-
Self::Identifying => write!(f, "identity"),
272-
Self::Descriptive => write!(f, "description"),
273-
}
274-
}
275-
}
276-
277266
/// Primitive or array types.
278267
#[derive(
279268
Serialize, Deserialize, Debug, Clone, Eq, PartialEq, Hash, JsonSchema, PartialOrd, Ord,

0 commit comments

Comments
 (0)