← Back to Pull requests

Structured-clone user-timing detail #8852

Closed
unknown closed this pull request without merging on Nov 25, 2026 15:04 UTC
View on GitHub
unknown unknown commented on Nov 24, 2026 04:12 UTC
Author

The User Timing spec says performance.mark(), performance.measure() and the PerformanceMark constructor store a structured clone of detail, and throw a DataCloneError when it can't be cloned. workerd kept the caller's value instead, so the entry shared the caller's object and a Symbol or function was accepted. Six structured-serialize-detail WPT subtests failed because of this.

In this patch the entries store a clone of detail. A detail that can't be cloned throws a DataCloneError, and no entry is recorded. mark() now builds its entry through the PerformanceMark constructor, and measure() passes detail to the PerformanceMeasure constructor.

No compat flag: portable code is more likely to expect the standard behaviour, which Node.js and browsers already have, than workerd's current one. What does change for a deployed Worker: a function, a Symbol or another uncloneable detail now throws, and changing the original object after the call no longer changes the entry. Primitive and cloneable details read back as before, and an undefined detail still reads back as null.

The six WPT expected failures are removed. New cases in perf-hooks-nodejs-test cover:

  • clones for mark(), the constructor and measure()

  • changing the original after the call

  • primitives

  • uncloneable values, which throw and record no entry
  • The WPT and the new tests both fail without the fix. //src/wpt:user-timing@, //src/wpt:user-timing@all-autogates, //src/workerd/api/node/tests:perf-hooks-nodejs-test@ (including @all-compat-flags and @all-autogates) and //src/workerd/api/tests:all pass.

    Diff: 203 lines (+152 / -51) across 2 files Reviewer: littledivy Review duration: 2091m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.36) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 203 lines diff across 2 files
    0.36
    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%
    56%
    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.318
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #8852"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 36.3% (MEDIUM) · Higher = larger blast radius
    36.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: 56.8% · Lower = rushed or shallow review
    56.8%
    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.7% · Safe to merge
    15.7%