← Back to Pull requests

Type-check attributes values with a semconv name #174

Closed
unknown closed this pull request without merging on Nov 09, 2026 21:38 UTC
View on GitHub
unknown unknown commented on Nov 08, 2026 13:45 UTC
Author

Follow-up to #84 and #173, now merged: now that semconv definitions have a flat shape and
declare the type of their value, fromPairs can check values against it.

What changes

fromPairs rejects a value of the wrong type for its key, at compile time.
A semantic convention definition declares its value type through examples: ?[]const V
(StringAttribute, IntAttribute, DoubleAttribute, BooleanAttribute, and the enum
attributes), which is where the check reads it from. The SDK still does not import semconv: the
matching stays structural, as in #84.

// builds
.{ semconv.attribute.server_port, 8080 },
.{ semconv.attribute.http_request_method, .GET },

// does not build: "the attribute definition ... expects int values, found *const [2:0]u8"
.{ semconv.attribute.server_port, "80" },

  • An integer literal is accepted for a double key, and converted to one (1 for 1.0).

  • Enum values that spell themselves with toInt() are supported, which covers the two

  • semconv enums of numbers (cpython.gc.generation, rpc.grpc.status_code).
  • A plain string key declares nothing and still accepts any supported type.

  • Definitions of array values (StringArrayAttribute, ...) are a compile error: an

  • AttributeValue cannot hold an array yet.

    builders.zig follows the flat enum attributes of #173: the key is read from name only
    (no more base.name), and the enum of well-known values from the well_known_values
    declaration, which is void for definitions that have none.

    Notes

  • No API change: fromPairs keeps its signature. Code that compiled and passed a value of

  • the type its key declares keeps working; code that passed a wrong one (a string port, say) no
    longer builds, which is the point.
  • The error messages name the definition's Zig type, not the attribute key

  • (types.AttributeWithValues(i64,void)). Naming the key would need the definition's value to
    be known at the call site, which it is not for a type-level check.
  • Compile errors cannot be asserted from a test block; this PR does not add tests for the

  • failing cases. They can be covered with std.Build.Step.Compile.expect_errors in a follow-up
    if wanted.

    Diff: 274 lines (+205 / -69) across 3 files Reviewer: inge4pres Review duration: 1912m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 274 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.336
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #174"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.5% (MEDIUM) · Higher = larger blast radius
    39.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.6% · Safe to merge
    15.6%