# How should an instance detect semantic-convention drift when an eval harness's span attributes silently re-type between OpenTelemetry SDK versions **Date of Record:** 2026 November 29 **Scope:** Applies to agent/LLM observability pipelines where span-level eval harnesses assert on GenAI semantic-convention attributes (`genai.*`) emitted by an OpenTelemetry SDK, and where the SDK minor version is not pinned across the fleet. Does not apply to harnesses that parse raw OTLP protobuf without attribute type coercion, nor to single-process test rigs that never cross an SDK boundary. ## Core Distinction The failure is not "an attribute went missing" and it is not "the schema changed." It is **type coercion under an unchanged attribute key**. The GenAI semantic conventions define `genai.usage.input_tokens` as an integer count and `genai.request.model` as a string, but the OTel attribute model permits a value to be carried as `int`, `double`, or `string` depending on the emitting SDK's encoder path. When an SDK minor bump flips an integer attribute to a double (or a numeric-string to an int), the attribute key is byte-identical, the span still validates against the *name* schema, and the eval harness's assertions on value semantics fail silently or — worse — pass against a coerced value that no longer means what the assertion intended. The distinction that matters: **conformance on attribute names is not conformance on attribute types, and the harness conflates the two because both are checked against the same span dict.** A missing attribute raises a KeyError the harness catches. A re-typed attribute returns a value that is `==`-comparable to the expected value in Python (`1.0 == 1` is `True`), so the assertion passes while the downstream consumer that does `struct.pack(" list[Verdict]: verdicts: list[Verdict] = [] for g in goldens: if g.key not in span: verdicts.append(Verdict.MISSING) continue actual = span[g.key] expected_type = EXPECTED_TYPES.get(g.key, type(g.value)) # Type identity is checked FIRST and independently of value equality. # A float that equals an int must be classified as drift, not pass. if type(actual) is not expected_type: # Only raise drift when the value would otherwise have passed — # a genuine value mismatch is reported separately. if actual == g.value: raise SemanticConventionDrift( f"attribute {g.key!r} re-typed: expected {expected_type.__name__}, " f"got {type(actual).__name__} (value {actual!r} == {g.value!r})" ) verdicts.append(Verdict.VALUE_MISMATCH) continue if actual != g.value: verdicts.append(Verdict.VALUE_MISMATCH) continue verdicts.append(Verdict.PASS) return verdicts def run_harness(spans: list[Mapping[str, Any]]) -> None: goldens = [ Golden("genai.usage.input_tokens", 812), Golden("genai.usage.output_tokens", 240), Golden("genai.usage.total_tokens", 1052), Golden("genai.request.model", "gpt-4o"), ] for i, span in enumerate(spans): try: verdicts = assert_span_conforms(span, goldens) except SemanticConventionDrift as drift: # Fail closed: a re-typed span must never reach the ledger. raise SemanticConventionDrift(f"span[{i}] failed type-conformance: {drift}") from drift if Verdict.MISSING in verdicts or Verdict.VALUE_MISMATCH in verdicts: raise SemanticConventionDrift( f"span[{i}] failed conformance: {[v.value for v in verdicts]}" ) ```