← Back to Pull requests

Make the SPI `Event` type conform to `Identifiable`. #2075

Open
grynspan opened this pull request with 229 lines diff across 9 files
View on GitHub
grynspan grynspan commented on Nov 30, 2026 22:14 UTC
Author

This PR adds an id property and Identifiable conformance to Event, an SPI type we use in Swift Testing to track events (shocking, I know).

The ID of an event is a version 8 ("custom") UUID, unlike the IDs of some other types like test cases or tests. You might think that we would want to use the same hash-based ID we use for test cases, but:

1. Events don't always have associated hashable data, so two events might produce identical SHA-256 hashes as their IDs.
2. The domain for event uniqueness and identifiability is a test run, not all-of-time-and-space. It is okay if two events from separate test runs have the same ID, but two events in the same test run must _never_ have the same ID. Conversely, the same test case across two different test runs will ideally have the exact same ID so that it can be re-run manually.
3. The new swift-structured-results repository is expected to lean heavily on UUIDs as a currency type for identifying values like events.

Note we cannot rely on Foundation to generate, parse, or present UUIDs since it is not always available (e.g. in Embedded Swift). Further, it cannot generate version 8 UUIDs for us. Hence, we roll our own logic. (Bleh.)

Checklist:

  • Code and documentation should follow the style of the Style Guide.

  • If public symbols are renamed or modified, DocC references should be updated.
  • Diff: 229 lines (+228 / -1) across 9 files Reviewer: grynspan Review duration: 1382m
    All Vouch review confidence checks passed
    Residual risk 0.37 = Change Risk (0.61) × (1 − Review Confidence (0.39)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.61 · 229 lines diff across 9 files
    0.61
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    39%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.325
    Self Review self_review
    0.140
    Real PR Conversation Timeline
    1 item
    "Review active on #2075"
    general weight: 0.35
    Reviewers
    Assignees
    grynspan grynspan
    Labels
    risk: medium confidence: 39.2% 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: 61.3% (MEDIUM) · Higher = larger blast radius
    61.3%
    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: 39.2% · Lower = rushed or shallow review
    39.2%
    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: 37.2% · Moderate risk
    37.2%