Motion probes
The probes I use to keep navigation and motion from regressing, and the budgets they enforce. The tokens and the behavior they guard are in Motion and transitions. None of them runs in CI, so I run them myself.
The transition probe
scripts/probes/transitions.mjs drives a running production server with headless Chromium (Playwright, 1440 by 900). It samples every animation frame around client navigations and hard loads: URL and scroll, title opacity and position, whether the “Loading…” fallback is on screen, the header logo position, document height and layout shift (CLS). Each scenario runs with motion allowed and with reduced motion.
pnpm build && pnpm start -p 3000 # one terminal
pnpm probe:transitions # another; prints a table| Variable | Meaning |
|---|---|
PROBE_BASE | base URL, default http://localhost:3000 |
PROBE_BUDGETS | JSON of budget overrides, for example '{"clientFullMs":300}', to see a failure on purpose |
PROBE_ATTEMPTS | tries per scenario before it counts as failed, default 2 (a real regression fails every try) |
PROBE_ONLY | run only scenarios whose id contains this text, for example dialog (skips the cross-checks) |
PROBE_JSON | 1 prints the raw metrics as JSON instead of the table |
What the probes need
- A production build.
pnpm build && pnpm start -p 3000. The dev server animates and compiles on demand, so its timings mean nothing. Do not setSKIP_ENV_VALIDATIONto get a build through; see quality gates. - No
.env. Every variable is optional (.env.example). Without them the content, role pages and/resumestill render and the dialog still opens. The/resumedialog is only opened and closed, never submitted, so no Resend or Turnstile keys are needed. - Playwright’s Chromium.
npx playwright install chromiumonce. - The splash. A hard load holds a full-viewport splash for 1300 to 1900 ms plus its dissolve (
splashinsrc/config/motion.ts), and every other animation waits untildata-splash-activeleaves<html>. The probes wait for that attribute instead of a fixed delay, and a hard-load entrance is measured from the moment it clears. A click made earlier lands on the splash, and an entrance measured from DOMContentLoaded reads 1.7 to 2.4 s. - Not
networkidle. The/api/flagsrequest and the route prefetches can stay pending for many seconds on repeat loads in one browser context, sonetworkidlemay never fire. The probes wait onloadand the splash. - A quiet machine. Run one probe at a time. Leftover browsers from an interrupted run and a second probe in parallel both push timings over budget.
The exit code is 0 when every budget holds, 1 on a budget failure (each failure is listed with the measured value, the limit and where to look), and 2 when the probe cannot run (no server, no Chromium). It builds nothing and is not part of pnpm test. The unit tests for the evaluation logic (scripts/probes/budgets.test.mjs) do run in pnpm test.
Scenarios
Landing to /about, landing to a role page, role to the adjacent role, /about back to the landing page through its back link (/#summary), the footer link from a role page to /resume, the floating-nav pill from /resume to #experience, browser back from /about to / (scroll restoration), and hard loads of /, /about, a role page and /resume. The resume dialog (a name and email form that sends the PDF by email; there is no direct download) has seven more: open, close by the Close button and by Escape, scroll-behind on desktop (wheel and keys, 1440 by 900) and on mobile (touch swipe, 390 by 844), a cursor check (a screenshot pixel check that the dot is drawn at the pointer over the left panel, the form and the Send button, mid-enter and mid-exit, and that the popover and body cursor are restored after closing), and one behaviour check (Tab never reaches the page behind, and focus returns to the Download button after closing). Each samples the dialog’s computed display and opacity, and its ::backdrop opacity, every frame; Escape is a real key press.
The landing focus motion adds four more (see “Landing focus motion”): focus: nav active section (no label at the top, the right label at Summary, Impact and Experience, and a click from the top to Experience never shows another label), focus: experience timeline (the role at the reading line is the active one and every other role is receded), focus: about gallery (the soft layer is soft as an image enters and sharp in the reading zone; absent under reduced motion) and focus: skills index (every row reveals on first view and can receive the pointer when scrolled to mid-viewport, a search leaves exactly the rows the “N of 22 skills” readout reports, no row keeps a filter, and under reduced motion the search applies on the first frames).
Budgets
The numbers live in scripts/probes/budgets.mjs (BUDGETS). Each is the value measured on a production build plus a margin. Measured: nine runs (six alone, three at once) on a healthy build, headless Chromium, localhost. The three focus budgets (focusInactiveMax, focusGalleryEnterMin, focusGalleryReadMax) are instead thresholds derived from the token values plus slack; their “measured” column is a single observed value, not a 9-run worst case.
| Budget (key) | Limit | Measured (worst of 9 runs) | Applies to |
|---|---|---|---|
loadingFrames | 0 | 0 | every navigation and hard load |
cls | 0.02 | 0 | every navigation, hard load and browser back |
clsLanding | 0.1 | 0 | arrival on the landing page |
clientTitleMs | 150 ms | 43 ms | motion allowed: title in the DOM after a click |
clientHalfMs | 300 ms | 148 ms | motion allowed: title at least half opaque, client nav |
clientFullMs | 650 ms | 498 ms | motion allowed: title fully opaque, client nav |
hardHalfMs | 300 ms | 149 ms | motion allowed: title at least half opaque, hard load |
hardFullMs | 700 ms | 532 ms | motion allowed: title fully opaque, hard load |
clientVsHardMs | 100 ms | about 25 ms | client nav no slower than the hard load of the same page |
morphWaitMs | 300 ms | 265 ms over the hard load | landing -> /about only: extra time its title gets on clientHalfMs, clientFullMs and clientVsHardMs, because the About entrance starts aboutEntrance.arrivalDelayMs (160 ms) into the portrait morph and the route needs about 100 ms to commit first. It still fails if the page goes back to waiting out the whole 400 ms morph |
travelPx | 24 px | 18 px | motion allowed: entrance travel (token is 20, sampled late); not applied to the landing hero title, which travels a full line by design (hero.title) |
logoMovedPx | 2 px | 0 | logo must not move between sub-pages or from the landing top |
scrollRestorePx | 4 px | 0 | browser back restores scroll |
anchorTopPx | 2 px | 0 | nav pill ends with #experience at the top |
reducedFirstOpacity | 0.99 | 1 | reduced motion: title opaque on its first frame |
dialogFirstOpacity | 0.95 | 0 (backdrop) | motion allowed: the ::backdrop is not fully opaque on its first frame (the dialog itself is opaque by design) |
dialogEnterMs | 450 ms | 250 ms | motion allowed: dialog and backdrop opacity at least 0.99 (99% on an ease-out lands before the 400 ms end) |
dialogExitMs | 260 ms | 229 ms | motion allowed: dialog removed after Close, Escape, Skip, Download |
dialogExitMinFrames | 3 | 12 | motion allowed: frames it stays rendered while fading (not a cut) |
dialogReducedGoneMs | 50 ms | 16 ms | reduced motion: dialog gone on the first frame after closing |
dialogScrollBehindPx | 0 px | 0 | page scrollY while the dialog is open (wheel, keys, touch) |
dialogScrollRestorePx | 0 px | 0 | scrollY exactly restored after closing |
dialogCursorDiff | 100 | 213 (weakest spot) | the cursor dot differs from its surroundings by this much (0-255) over the dialog |
focusInactiveMax | 0.65 | 0.6 | motion allowed: a timeline role away from the reading line is at most this opaque |
focusGalleryEnterMin | 0.8 | 0.95 (passes) | motion allowed: gallery soft layer at least this opaque as the image enters the viewport |
focusGalleryReadMax | 0.05 | 0 (passes) | motion allowed: gallery soft layer at most this opaque in the reading zone |
| (fixed) | 0 px | 0 | reduced motion: no travel at all |
| (fixed) | monotonic | monotonic | dialog opacity only rises on enter and only falls on exit |
| (fixed) | true | true | focus returns to the trigger, Tab stays in the dialog |
| (fixed) | no reload | document kept | footer link and nav pill are client navigations |
Not a budget, by design: the logo legitimately docks and eases in on the way back to the landing page (about 51 px), and the probe only checks that the hash link scrolled somewhere.
When a budget fails, fix the cause rather than loosening the number. If a change to the motion tokens is intended (for example a longer duration.slow), update the budgets and this page in the same change.
The route-scroll probe
scripts/probes/route-scroll.mjs drives the same running server (PROBE_BASE, same requirements) with four browser contexts at once: 1440 and 390 px wide, each with motion allowed and reduced. It prints one PASS line per context and throws on the first failed assertion. For every skill tile on the landing page it scrolls to the tile, starts a wheel scroll, clicks mid-scroll and checks that the detail page starts at the top and stays there. For the first skill it also checks Back and Forward restoration (Back must return to the last landing position before the route changed, within 40 px; the wheel scroll is still animating at the click, so the position at the click is about 80 to 150 px short of it), then a click on a related skill. It ends with a direct load, the #impact anchor (the section heading lands at the shared clearance, as in docs/anchor-navigation.md), a role page and, on mobile, a touch swipe followed by a tap.
PROBE_BASE=http://localhost:3000 pnpm probe:route-scrollWhat I have not fixed
These show up while running the probes and are not budget misses.
/api/flagsand prefetch requests stall. On repeat loads in one browser context they can stay pending for tens of seconds. The probes do not wait on network idle for that reason. I have not fixed the cause.
In CI
The probe does not run in CI. I run it locally before merging changes to motion, navigation or the landing sections.