sanity-bench
/sanity-bench
Run, dispatch and read the hermetic Studio performance benchmark suite in perf/bench — local runs and modes, the trigger:perf-bench PR label, the Studio Bench workflow_dispatch inputs (run_suite, self_test, backfill_sha, release_tag, ab_from/ab_to) and which combine, and how to read 🔴🟢✅⚪ verdicts. Use when asked to benchmark a PR or commit, compare two commits, backfill or re-run the daily main series, measure a release, add a bench scenario, extend the mock API, or interpret a bench PR comment or a failed Studio Bench run.
- Author
- sanity-io ↗
- Repository
- sanity ↗
- Licence
- MIT
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Run, dispatch and read the hermetic Studio performance benchmark suite in perf/bench — local runs and modes, the trigger:perf-bench PR label, the Studio Bench workflow_dispatch inputs (run_suite, self_test, backfill_sha, release_tag, ab_from/ab_to) and which combine, and how to read 🔴🟢✅⚪ verdicts. Use when asked to benchmark a PR or commit, compare two commits, backfill or re-run the daily main series, measure a release, add a bench scenario, extend the mock API, or interpret a bench PR comment or a failed Studio Bench run.
Original author description
Run, dispatch and read the hermetic Studio performance benchmark suite in perf/bench — local runs and modes, the trigger:perf-bench PR label, the Studio Bench workflow_dispatch inputs (run_suite, self_test, backfill_sha, release_tag, ab_from/ab_to) and which combine, and how to read 🔴🟢✅⚪ verdicts. Use when asked to benchmark a PR or commit, compare two commits, backfill or re-run the daily main series, measure a release, add a bench scenario, extend the mock API, or interpret a bench PR comment or a failed Studio Bench run.
How it works
- Local
- CI: .github/workflows/bench.yml
- Reading a result
- Soak
- Changing the suite
SKILL.md preview
--- name: sanity-bench description: Run, dispatch and read the hermetic Studio performance benchmark suite in perf/bench — local runs and modes, the trigger:perf-bench PR label, the Studio Bench workflow_dispatch inputs (run_suite, self_test, backfill_sha, release_tag, ab_from/ab_to) and which combine, and how to read 🔴🟢✅⚪ verdicts. Use when asked to benchmark a PR or commit, compare two commits, backfill or re-run the daily main series, measure a release, add a bench scenario, extend the mock API, or interpret a bench PR comment or a failed Studio Bench run. --- # Studio bench (perf/bench) A built studio measured in Chromium against an in-process mock of the Sanity API: no tokens, no network, one clock. The interesting output is an **A/B verdict per metric** from interleaved reference/experiment sessions with a cluster bootstrap — 🔴 regression, 🟢 improvement, ✅ neutral, ⚪ inconclusive (CI too wide within budget; never a coin flip). Absolute numbers are host-relative and only comparable with the run's calibration score alongside. `perf/bench/README.md` is the full reference; this skill is the operating card. Stored results are read through `sanity-radar`. ## Local ```bash pnpm build:bench # required first: packages + bench studio pnpm bench help # commands; `pnpm bench run --help` for flags pnpm bench scenarios # singleString, arrayI18n, article, recipe, synthetic, syntheticLarge, loginReady, loginToTool, toolReady, emptyToolReady, loginToEmptyTool (+ customization scenarios) pnpm bench run --scenario singleString --sessions 4 # absolute interaction run pnpm bench run --mode pageload --scenario singleString # load vitals + bundle size pnpm bench run --mode inp --scenario singleString --sessions 3 pnpm bench run --mode soak --scenario singleString --minutes 5 pnpm bench run --mode soak --scenario article --minutes 2 # long-session soak smoke (PTE body, menus, doc switches, live presence) pnpm --filter bench build:reference-config \ && pnpm bench run --scenario singleString --reference-dist perf/bench/.reference/dist # self-test: must be all-neutral pnpm bench prepare-backfill --sha <sha> # build a historical commit into perf/bench/dist (tarball recipe) pnpm bench dev # mock + sanity dev, type into a seeded doc pnpm bench:unit # mock contract + stats tests ``` Flags worth knowing: `--headed`, `--throttle 1` (interaction runs default to 4× CPU throttle), `--seed N`, `--budget <s>`, `--json-out <file>`, `--fail-on-verdict`. In a sandbox where the `tsx` CLI cannot open its IPC pipe (`listen EPERM … tsx-*/…pipe`), run the CLI directly: `node --conditions=monorepo --import tsx perf/bench/cli/index.ts <command>`. ## CI: `.github/workflows/bench.yml` | Trigger | What runs | Result lands in | | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | | Label a PR `trigger:perf-bench` (maintainers) | PR head vs merge-base A/B, one shard per scenario. The label persists: every later push re-runs the suite until the label is removed. | Sticky PR comment `bench-report`; absolute side stored under the branch (`?branches=main,<branch>` in Radar) | | Cron 05:00 UTC daily | Absolute suite on main + soaks (`singleString`, `article`) + INP + settle | `benchRun` `mode: "absolute"` in Radar (Trends) | | Cron Monday 06:00 UTC | Self-test (build vs itself, `--fail-on-verdict`) | Red job = harness drift | | `-f run_suite=true` | Same as the daily cron, on demand | Radar | | `-f run_suite=true -f backfill_sha=<40-char sha>` | Replay a historical main commit, store under that sha and its commit date | Radar (fills a hole in the series) | | `--ref v6.x.y -f run_suite=true -f release_tag=v6.x.y` | Measure a release commit (`release-latest.yml` does this automatically) | Radar, `trigger: "release"` → anchors the release marker | | `-f ab_from=<sha> -f ab_to=<sha>` | A/B of two arbitrary commits (reference → experiment) | Run summary page + `benchRun` `mode: "ab"` (Radar Comparisons tool) | | `-f self_test=true` | Self-test on demand | Job status | ```bash gh workflow run bench.yml -R sanity-io/sanity -f ab_from=<sha> -f ab_to=<sha> gh run list -R sanity-io/sanity --workflow bench.yml --event workflow_dispatch --limit 5 gh run watch -R sanity-io/sanity <run-id>; gh run view -R sanity-io/sanity <run-id> --web ``` Input rules (the workflow validates them): `ab_from`/`ab_to` go together and exclude `backfill_sha` and `self_test`; `backfill_sha` requires `run_suite` and excludes `self_test`; `release_tag` must point at the measured commit (dispatch at the tag, or pass the tag's sha as `backfill_sha` from main). Shas are full 40 characters. Historical builds (backfill, A/B, PR reference) install the old commit with `--frozen-lockfile`, pack `sanity` and its workspace deps as tarballs, and build HEAD's `perf/bench` harness against them — harness and scenarios are always HEAD's; only product code differs. Backfill and A/B fail loudly, the PR reference falls back to absolute mode with a warning in the comment. Radar's run popover copies the A/B command for "this point vs the previous run" (**Copy A/B vs previous run**) so the shas never need typing. ## Reading a result - The PR comment / run summary is deliberately minimal: verdicts, then a link to Radar. A missing scenario is named (`missing-scenarios.json` fails the run) — silence is never "fine". - Gates: interaction median with `absMs` 16ms floor (two Event Timing quantisation steps), pageload time-to-editable; INP, vitals, resources, bundle are report-only. Thresholds live in `perf/bench/stats/gate.ts` and are shared with Radar's drift feed. - ⚪ on a heavy scenario usually means the budget ran out; re-dispatch or look at `stoppedBy` and `failures` in the stored run. - A `hermeticity violation` or `unexpected endpoint` session failure means the studio made a request the mock does not know: extend `perf/bench/mock-api` in the same PR as the studio change. ## Soak - Two soaks run daily: `singleString` (typing only, presence parked) and `article`, the long-session soak from the scenario's `soak` plan: excursions (document actions menu, field actions menu, reference array item menu, tooltip, switch to the author or a category and back) interleaved with 40-keystroke Portable Text bursts on a seeded schedule, presence live with a mock peer. The article step is `continue-on-error` and writes `bench-results__soak-article.json`. A failure names the excursion and step (`[soak-excursion] …`) in a `::warning::` annotation and the job summary, and a cron run posts it to the CI alerts Slack channel through the `article_soak_outcome` job output. - Every soak report stores `soak.settleMinute` (default 2, `@repo/utils/soak-settle`). Compute growth from that sample on, as Radar's soak slopes do; the first minutes race the lazy mount. - A run can hold several soak reports, in no stable order. Select a soak by `scenario`, never by taking the first report with `soak` (Radar uses `SOAK_SERIES_SCENARIO = 'singleString'`). - Live presence is per session (`running.mock.presence.setLive`) and reset afterwards; every other mode keeps the parked socket, so a plan without `presence` cannot change other scenarios' numbers. ## Changing the suite - New scenario: schema in `perf/bench/studio/schemas`, `defineScenario` in `perf/bench/scenarios` (seeded PRNG, never `Math.random`), register in `scenarios/index.ts`, add it to the `bench-interaction` matrix **and** `BENCH_EXPECTED_INTERACTION_SCENARIOS` in `bench.yml`, verify one absolute session passes. - Stored document shape: `perf/bench/report/types.ts` → `storeShape.ts`, mirrored by `dev/radar/schemaTypes/benchRun.ts`; bump all three together. - Flake rules are in the README (no fixed sleeps, noise widens sampling, seeded PRNG, failed sessions retried and counted, environment drift fails fast). A change that makes a verdict flip on identical builds is a harness bug — the weekly self-test exists to catch it.
Versions
The database has no other skills named sanity-bench.
Database snapshot: 13.11.2026 · package version 51f0fa0f1f99 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90bench-profile
Design a performance benchmark for an API — test scenarios, metrics, and tooling. Use when asked to "benchmark this API", "design a load test", or "measure throughput". - 100authoring-benchmarks
Design, implement, run, debug, and interpret browser performance benchmarks for Elements components and utilities. Use whenever the user asks to benchmark or performance-test runtime code, create or update a .test.bench.ts file, compare benchmark results, investigate a browser… - 100sanity-radar-investigate
Investigate a suspected Studio performance regression surfaced by Studio Radar or the bench suite — confirm the signal against host calibration, narrow the commit range, confirm with an A/B dispatch, bisect, and name the culprit or call it noise. Use when handed a Radar… - 100add-bench-scenario
Use when adding a new scenario to remindb's benchmark suite — symptoms include "compare X tool against grep/cat", "add a token-savings benchmark for Y", "extend `internal/bench/scenarios.go`", "wire a new scenario into `bench.Run`", or any task that adds a row to the `scenario /… - 100benchmark
Benchmark anything: pick the dimensions that serve a decision, weight them, run bun repo bench and report each number with what limits it. Use for /benchmark, benchmark X vs Y, or which of these is faster, smaller or cheaper. - 90add-benchmark
Add a new SWE benchmark task from a real GitHub bug-fix. Use when the user provides a GitHub issue or PR URL and wants to add it to the bench-swe pipeline.