dev/metrics-studio/SPEC.md
One place to answer three questions without opening CI logs: is studio performance drifting on main? (Trends), what did a specific run look like? (run detail), did anything change that needs a human? (drift feed). Primary users: studio engineers checking the effect of merged work; secondary: leads scanning health weekly.
benchRun document per day from the track-main cron (absolute mode,
fixed 8 sessions): per-scenario interaction metrics (p50/p75/p90/p99 per
field), pageLoad time-to-editable + web vitals + auth boot-path milestones,
bundle sizes (initial/total gzip), resources per endpoint class, soak
series, runner.calibrationMs, git sha. Written by bench store
(perf/bench/report/storeToSanity.ts); stored shape defined by
perf/bench/report/storeShape.ts and mirrored by schemaTypes/benchRun.ts.sessions.runner.calibrationMs, higher =
slower host) so a "regression" that is really a slower runner pool is
visible as such. This is the dashboard's version of the suite's fail-loud
principle.rel/absMs thresholds the gate uses
(perf/bench/stats/gate.ts — one source of truth for "what matters").
Two baselines, both shown when they disagree:
defineTool) in this studio, registered first so
Trends is the landing view; the structure tool stays for raw document
access.useDocumentStore().listenQuery +
useObservable (never one-shot client.fetch), so a new cron run appears
without a reload. Tight projections only. No rollup documents — with
≤1 doc/day, projected queries over all runs are fast; revisit only if that
stops being true.tools/trends/debugData.ts — steady/drift/step/host-correlated shapes,
sparse/single/empty sets) selectable in the toolbar, so charts and the
future drift feed are testable without live data.@visx/scale, @visx/shape, @visx/group,
@visx/axis, @visx/responsive) — low-level primitives, no chart-library
opinions to fight inside @sanity/ui layout.sanity deploy eventually; hostname TBD.benchRun create running
the drift computation — event-driven, no cron); broader health metrics
(coverage reports from CI's json-summary, flake rates) as sibling
document types with their own trends tabs.