Skip to content

Correct public performance metric contracts - #162

Open
mattcosta7 wants to merge 1 commit into
v1.3/01-overhead-baselinefrom
v1.3/02-metric-contract
Open

Correct public performance metric contracts#162
mattcosta7 wants to merge 1 commit into
v1.3/01-overhead-baselinefrom
v1.3/02-metric-contract

Conversation

@mattcosta7

Copy link
Copy Markdown
Member

Summary

  • add accurately named canonical metrics while retaining deprecated aliases through v2
  • normalize DOM mutation sampling to a per-second public rate and update panel terminology
  • publish exhaustive provenance, quality, and unit metadata for every public metric
  • update focused tests, documentation, public exports, and release metadata

This PR is stacked on #161 (v1.3/01-overhead-baseline) so the benchmark foundation remains part of the combined 1.2.0 release work.

Validation

  • 858 browser tests passed across Chromium, Firefox, and WebKit
  • npm run tsc
  • npm run lint (no errors; one unrelated existing warning)
  • npm run build (attw and publint passed)
  • Changesets reports one minor addon bump
  • overhead benchmark compared against the committed baseline with no measurable regression
  • adversarial review completed with Saboteur, New Hire, and Security Auditor perspectives; final closure verdict: CLEAN

@mattcosta7 mattcosta7 self-assigned this Aug 3, 2026
@mattcosta7
mattcosta7 marked this pull request as ready for review August 3, 2026 16:34
@mattcosta7
mattcosta7 requested a review from a team as a code owner August 3, 2026 16:34
@mattcosta7
mattcosta7 requested review from Copilot and removed request for a team August 3, 2026 16:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Not ready to approve

DOM mutation normalization can report inaccurate per-second rates when sampling intervals are delayed or interrupted.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

Corrects public metric naming, units, metadata, UI terminology, documentation, and compatibility aliases.

Changes:

  • Adds canonical metrics and exhaustive contract metadata.
  • Normalizes DOM mutation reporting to mutations per second.
  • Updates panel rendering, exports, tests, documentation, and release metadata.
File summaries
File Description
.changeset/correct-metric-contracts.md Records the minor release.
packages/storybook-addon-performance-panel/README.md Documents corrected contracts.
packages/storybook-addon-performance-panel/react/performance-decorator.tsx Updates metric terminology.
packages/storybook-addon-performance-panel/performance-panel.tsx Displays canonical metrics.
packages/storybook-addon-performance-panel/index.ts Exports public contracts.
packages/storybook-addon-performance-panel/index-universal.ts Exports universal contracts.
packages/storybook-addon-performance-panel/core/performance-types.ts Defines metrics and metadata.
packages/storybook-addon-performance-panel/collectors/style-mutation-collector.ts Names the sampling interval.
packages/storybook-addon-performance-panel/collectors/README.md Documents collector semantics.
packages/storybook-addon-performance-panel/collectors/paint-collector.ts Corrects collector terminology.
packages/storybook-addon-performance-panel/collectors/input-collector.ts Clarifies double-RAF behavior.
packages/storybook-addon-performance-panel/collectors/constants.ts Corrects constant descriptions.
packages/storybook-addon-performance-panel/collectors/collector-manager.ts Produces canonical metrics and aliases.
packages/storybook-addon-performance-panel/collectors/__tests__/performance-types.browser.test.ts Tests metadata and defaults.
packages/storybook-addon-performance-panel/collectors/__tests__/paint-collector.browser.test.ts Updates collector test terminology.
packages/storybook-addon-performance-panel/collectors/__tests__/collector-manager.browser.test.ts Tests canonical mappings.
packages/storybook-addon-performance-panel/__tests__/performance-panel.browser.test.tsx Tests updated panel labels.
Review details
  • Files reviewed: 17/17 changed files
  • Comments generated: 4
  • Review effort level: Balanced

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

const scriptResourceLoadTime = Math.round(paint.scriptEvalTime * 10) / 10
const averageDomMutationsPerSample = computeAverage(style.domMutationFrames)
const domMutationsPerSample = Math.round(averageDomMutationsPerSample)
const domMutationsPerSecond = Math.round((averageDomMutationsPerSample * 1000) / DOM_MUTATION_SAMPLE_INTERVAL_MS)
Comment on lines +90 to +93
await expect.poll(() => document.body.textContent).toContain('Pointer Frame Interval')
await expect.poll(() => document.body.textContent).toContain('DOM Churn')
await expect.poll(() => document.body.textContent).toContain('Initial Paint Milestones')
await expect.poll(() => document.body.textContent).toContain('Layer-Promotion Candidates')
/** Layer-promotion candidates above this needs attention */
LAYERS_WARNING: 20,
/** Compositor layers above this is concerning */
/** Layer-promotion candidates above this is concerning */
/** CSS var changes above this is excessive */
CSS_VAR_CHANGES_WARNING: 50,
/** Compositor layers above this needs attention */
/** Layer-promotion candidates above this needs attention */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants