This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index at /llms.txt, or add .md to any page's URL.
Inspection and testing
The native agent's tree includes declared SVG geometry in each shape's
props: a circle's cx, cy and r, an ellipse's radii, and a rectangle's
position, size and radii. These are model values, not animation samples.
Lengths in user units are numbers, including resolved font-relative lengths.
Percentages, viewport lengths and unresolved calc() and env() values
remain CSS text. layout <target> includes the same properties.
On Apple development builds, an iframe's web content is inspectable from
Safari's Develop menu. Enable Safari's web developer features, launch the app,
and select its web view under Develop. This inspects the embedded page; use the
agent operations below for Exact's native tree. Production builds
(EXACT_UPDATE_TRUST=production), exact release, and IPA archives leave
web-view inspection disabled.
An Apple build's dev menu (a four-finger tap, or ⌘D on a hardware keyboard or a simulator's; on a Mac, Develop › App Info…, ⌘D, in a development build: a Mac build with production trust, EXACT_UPDATE_TRUST=production, or made by exact release has no Develop menu and takes none of its chords unless it is built or launched with EXACT_DEV_MENU=1, or a person runs defaults write <bundle id> ExactDevMenu -bool YES and the build did not say 0; an iOS build, a release one too, has the menu unless it is built or launched with EXACT_DEV_MENU=0, LLP 1115 D9) uses a native grouped navigation sheet on iOS. Project commands and diagnostics have full-width rows; Build Information opens a separate, selectable text screen. On macOS, App Info opens with the
build it is in: the app and version, when, where and with which Xcode it was
built, the Exact commit and the app's own (with branch and a dirty flag), the
build kind, the device, and the app's release notes. host/apple/build.mjs
stamps these into the bundle's Info.plist on every build, --archive included,
so a shipped binary carries the build machine's host name and the commits too.
Release notes are release-notes.md beside app.contract: UTF-8 text, shown as
written, up to 16 KB; no file, no section. A deploy script that publishes the
build under a revision sets EXACT_DISTRIBUTION_REVISION for the build to show
it. Copy (iOS and macOS) takes all of it as text.
On iOS, the developer menu's Frame Health row opens a native card in a window of its
own above the app's, so above every sheet, alert and cover, whichever opened first, and
in the app's appearance; the Mac's Develop menu has the same item. Row and item are
checked while the card shows, and follow it when it closes itself. The card starts hidden
and takes the touches within its bounds: drag it from anywhere, even past the window's
edges, and on release it springs to the point along the edges of an area 8 points inside
the window, past the safe area and above any keyboard, that is nearest where it would
stop sliding at a constant 2,000 points/s²: a gentle release stays by the nearest edge,
and a fling reaches another. Accessibility actions move it to an edge, keeping its position
along the other axis. Close, at its top left, or the checked Frame Health dismisses
it. On iOS, Minimize, beside Close, leaves a small status and frame rate at the same edge,
8 points below the status bar, while measurement continues; tap it to restore the card.
In a screen corner, the small status moves along the edge until its corner keeps 8 points
from the screen's. Dragging and accessibility actions move either form, and rotation and
keyboard changes keep it within the window. Touches outside the visible form reach the app. LLP 1079.000 §7.2 describes its rows: Live, Paused
or Idle; the requested rate and any system limit; frame rate
and missed frames for the last 0.5 s and 5 s; pacing; and charts of frame rate and
frame time, or a table of work time, late frames, maximum frame time and pacing
changes. A tap on a chart expands it; a tap on the title defines each figure; Share,
at its top right, opens the system's share sheet at once with one Markdown text: the
summary, then the agent report (two where the card measures the screen, the screen's and
Exact's frames'). On the Mac the picker offers Copy first. The card states no pass or fail of its own;
Details, at the end of the line under the header, swaps the figures and charts for
perf frames health's three results over the last 5 s with their reasons and the counts
behind them, in rows that scroll within the card; Done in its place returns. These are timing proxies; actual presentation and
native-only animation cadence are unmeasured. While the card is shown, bounded hitch
capture also records matching asynchronous owner and apply timestamps. Idle time never
becomes a frame time.
The card's charts take each frame and show the last 30 seconds: the frame rate's moving
average over the last half second against the request, and each frame's frame time and
work, the longest in each tenth of a second, against that frame's deadline. Within a run
of frames the lines reach across tenths of a second without frames; an idle app, a pause
and a reset leave gaps. The charts start no display link and store no file. Measuring
Exact's frames, they take the frames the app's clock already runs and move with the time
on a tenth-of-a-second timer of their own, which stops once their newest mark has left
them. Their figures update every half second, and at once when the source stops, on the
existing bounded publication pass in common run-loop modes, so touch tracking does not
suspend them. Measuring the screen, the charts take every UI update and glide on Core
Animation, and the card reads on a half-second timer of its own in place of
publications, which stops as it hides. The reader creates no display link, reads nothing
while the card is hidden, paused or detached, and keeps at most 60 half-second samples;
the first read after a pause covers the paused span. During native scrolling, a card
measuring Exact's frames stays on the app callback source; in development builds on iOS
18 and later the separate experimental scroll source reaches perf frames and the
report.
perf frames health exposes the metrics. state.frameHealthUI contains only the
card's visibility and window-local bounds, marked as host controls outside app nodes.
On iOS 18 and later the card's face shows every UI update of the app on its screen, how
much of each window's time the main thread was held up past one refresh, and its longest
hold-up, which it measures only while it shows; perf frames reports Exact's own frames
(LLP 1079.000 §7.4).
Embedders opt in by passing a host view as DevMenu.install's frameHealthContainer.
app.json may set "frame_health": { "mode": "off" } or "core". Without a mode, a
build with development trust collects from launch, and a production bake on demand:
only while the card shows, and while it is hidden every collection hook returns at
its first check. "core" collects from launch in any build, and "off" never collects. Where
collection is off, the developer menu's row reads Frame Health Disabled, dimmed,
and a tap on it names the setting and says to remove it; on the Mac, choosing the item
does. The core has fixed
storage for up to 16 collectors per UI thread and does no per-callback allocation;
these bounds do not substitute for measuring whole-hook overhead on real devices.
An Apple app launched with EXACT_OBSERVE_LOG=1 prints its startup measurement to stderr once launch
has settled, in a release build too. The observe: startup line has the launch type (cold,
warm), how the first tree booted (baked), how time to interactive ended, Observe's metrics, and each
mark in ms from process start (main, didFinishLaunching, boot, commit, present, interactive
…). The metrics are timeToFirstRender (the first vsync after the first tree's commit) and
timeToInteractive, both from didFinishLaunching, and coldLaunchTime or warmLaunchTime.
Time to interactive covers the native tree only, so an app with a GPU canvas (a game, a painted
surface) also prints observe: world <ms> once, when the canvas's first frame reaches the screen:
the world mark, in ms from process start like the startup line's marks. It may come before or after
the startup line. A tool that captures the screen should wait for it when the app draws a canvas. On a
simulator, give the variable to the app through simctl's prefix and read its console:
Terminal
SIMCTL_CHILD_EXACT_OBSERVE_LOG=1 xcrun simctl launch --console-pty <udid> <bundle id>
On macOS, set it in the executable's environment. The painted hosts (Linux) print a line of their own
marks under it. These are the host's clocks, in process: quick to repeat when comparing two builds, but
no screen's measurement (a video, XCTApplicationLaunchMetric). A simulator's numbers move by about
10 ms between batches with the Mac's load, so compare builds in interleaved rounds of several launches.
Run an Apple app on a connected phone with bun host/apple/build.mjs --device --run.
Open the four-finger menu and choose Frame Health, which in a production bake starts
collection, reproduce the hitch, then tap Share on the card; the share sheet takes
one Markdown text: the card's status, the summary, then a section on the agent reports
that says how they relate, with each JSON report in a json block under a heading that
names it, such as "All screen updates (ui-update)".
Exact creates no report file or automatic upload. A person can send
that text to an agent. The system share destination controls any storage it creates.
On iOS 18 and later the card measures the screen, and the text holds two reports, the
screen's (ui-update) and Exact's frames' (exact-app-display-link), each within
4 KB. The screen's has no frame times; an app drawn by
GPU surfaces, whose canvases Exact's frame clock ticks, has its frame times and their
work in Exact's, its GPU execution and presentation unobserved.
For controlled device checks, scripts/fixtures/frame-health-app is a minimal fixture:
one Start/Stop button, one moving canvas tile and 32 static rows. It starts paused;
the drawing function asks for another frame only while running. There are no app
resources, storage/network grants, widgets or content assets; the only image is
the required app icon. It reuses the Canvas Gallery native host with its own source. Build it without
installing or launching it on the phone:
Terminal
EXACT_APP_DIR="$PWD/scripts/fixtures/frame-health-app" bun host/apple/build.mjs canvas-gallery-apple --device --phone "<phone name or UDID>" --no-install
The development build supports the experimental scroll observer. Use matching
optimized collector-on/off archives for overhead comparisons; development sampling
is excluded from production-overhead results. The prepared pair uses optimized Swift
and Rust host-dev; full production LTO is a separate configuration. The fixture
requires iOS 27.0 or later.
Each source retains its latest 16 timing events in fixed memory. A report includes
only events from the last 120 seconds. A burst can overwrite the ring sooner; the
report names overwrite, expiry and byte-budget omissions separately. Hiding the card
stops detail capture unless an agent lease still owns it. Reload
preserves retained evidence and advances the generation; explicit clear or session
teardown removes it. The core creates no expiry timer, extra display link, stack
sampling, screenshots or log collection. The optional scroll observer is described below.
An attached agent can use the existing device carrier (ios --device, optionally
--phone <name|udid>), or a simulator, with --timing platform or, on the
simulator, --live (reference).
Once a clock operation has taken the agent's clock, a capture stays paused
(virtual-clock). A collector that collects on demand (ExactFrameHealthMode is
demand) is started by capture start and track start as by the card's showing, in
a new generation, and stops when their lease ends or they stop, unless the card shows;
between leases perf frames health reads nothing (collection-disabled). Where
collection is off, both are refused with collection-disabled. A drive runs these
operations
(sky is a canvas):
text
perf frames capture start 60000
perf frames health
perf frames health during "tap sky drag 0 -100 over 500"
perf frames report
perf frames capture stop
perf frames capture clear
perf frames live 5000
While the lease holds, an input's landing is allowed and takes nothing: its
answers land on the platform's clock. Every other clock operation is refused,
and perf frames live takes a lease of its own, so it comes after capture stop. The scroll source (health scroll, report scroll) reads native
scrolling. On iOS, an agent's drag without real touches moves a list's offset
over the requested over duration, allowing intermediate frames to be observed.
The recognized drag does not start the native-scroll observer, which relies on
UIKit's dragging lifecycle. Without an observed native drag, the source answers
native-scroll-unobserved.
A capture lease lasts 1–120000 ms, default 60000. The card and the agent
lease own capture independently. Existing callbacks, applies and reads check expiry;
an idle app gets no expiry wakeup. Power/thermal notification observers can remain until that next
check. Reports bypass the legacy sampler and cost at most 4 KB (4000 UTF-8 bytes,
including the agent carrier's newline). There is one encoder in flight per process;
agent reports are admitted once per 15 seconds. Encoding runs on a utility queue after
a bounded main-thread copy. Repeated busy/rate-limited requests receive small refusal
packets. No report is automatically persisted, queued for retry or sent periodically.
A report covers one source. The default selects the source with the most recent
retained hitch; report app or report scroll selects explicitly. source identifies
it, otherSources names retained evidence in other sources, and selection says how
to get another: an agent's request, or, for a report the card's Share gave, the
report beside it. Counts and generations
belong to their named source. Forwarded apply context does not count an app apply or
its deadline again as a native-scroll event.
perf frames health [app|scroll] reads exact.frame-health.metrics/2 without starting
the legacy sampler. It reports frames as LLP 1079.000 §4.6 defines them: a display-link
callback that started frame work is a frame, and one held by earlier work in flight, or
with no frame work due, is not. frames gives callbacks, held callbacks, frame
intervals, their total time and rate, frame-time median, p99 and maximum bounds, pacing
and schedule changes, intervals across a schedule change, callbacks whose timestamp went
backwards (outOfOrder; each ends a run), and the requested slots and missed frames on
the requested-rate grid.
work gives one record per frame, from its timestamp until its callback returned and the
owner work it sent had landed, with late frames (finished after targetTimestamp),
median, p99 and maximum bounds, and the frames whose work is still in flight (pending)
and already past their deadline (overdue). Where the deadline carries no information,
as on the iOS simulator, late and overdue are null and latenessUnknown says why.
The cursor carries the frame-time and work bins. The reply also carries requested
and scheduled periods, coverage, generation and an explicit cursor. Send that cursor
unchanged as cursor in a subsequent health request to read a delta. A
producer/generation mismatch, malformed cursor or impossible histogram population
returns baseline-required; retry without it. Read timestamps differ from the
timestamps through which intervals and work are finalized. Each completed interval or
work record enters the next finalized window, even if it began before that window's
initial read. Never subtract lifetime maxima or assume a wall-time clipping rule.
assessments judges the same window under exact-frame-health-policy/2, with one
result for each question and no overall pass:
Assessment | Question | Decided from |
|---|---|---|
cadence | Did frames keep to the platform's schedule? | frameIntervals and skippedRefreshes, the scheduled periods frame intervals spanned beyond each interval's first; lateFrames, work that finished after its frame's targetTimestamp, and overdueFrames, work still in flight past it; unclassifiedIntervals, frame intervals across a schedule change, which have no refresh count |
target | Did frames arrive at the requested rate? | requestedSlots and missedFrames on a grid at the requested period (spatial motion and canvases ask for the display's maximum, paint-only motion for 60 Hz); restrictedIntervals, frame intervals with either end scheduled more than 0.1 ms slower than the request that governed it. context lists conditions at the read (simulator, low-power-mode, thermal-serious, thermal-critical) without naming them as the cause |
contentLatency | Did content appear when it was meant to? | Unobserved on Apple |
Each result is one of fail, restricted, proxy-pass, insufficient-evidence or
not-applicable, and reason names the predicate that decided it. An observed
skipped refresh, late frame (or frame still in flight past its deadline) or missed
frame is fail even when the rest of the window is unobserved; a restricted schedule
makes target restricted instead. proxy-pass means frames kept to schedule; it is
never a presentation pass, and without presentation feedback target delivery is at
best insufficient-evidence (presentation-unobserved). Other insufficient reasons
are virtual-clock, the collector's unavailable code (collection-disabled,
collector-capacity, wrong-thread), schedule-unknown (the scroll source),
no-frame-intervals, no-callbacks (the source runs but sent none in the window),
stale (the source runs but has sent no callback for over a second, as through a
blocked main thread; status is stale too), out-of-order (a callback's timestamp
went backwards and ended a run), schedule-changed (an interval across a schedule
change has no single period, so no refresh count; it counts in the window where it
finalizes) and simulator-deadlines. The iOS simulator dispatches display-link
callbacks after their own targetTimestamp, so there lateness is unknown and only
skipped refreshes can fail cadence. not-applicable is idle, or for target,
no-rate-request: timers and frame tasks run at the platform's default rate without a
request, so they have a schedule to keep but no requested rate.
Frame times and work times use 64 saturating 32-bit bins: 48 of 500000 ns over [0,24
ms), 15 doubling tails from 24 ms, and an open last bin. Quantiles are half-open
bounds; a null upper endpoint means the open bin, and null quantiles mean no samples
or invalid distribution accounting. Saturation is explicit. histogram.valid
describes accounting, not health. All metric responses fit the same 4000-byte wire
envelope.
Apple perf frames live <1–30000 ms> takes a bounded capture lease, reads its
baseline once the lease holds, waits in the driver, then reads a cursor delta and
releases its lease. During that lease the host refuses
all virtual-clock requests, including implicit takeover from held-clock operations.
Use real input. Platform timing now preserves frame tasks, timer wakeups, async fills
and macOS ordinary-wheel/reorder timing; frozen-clock agents retain their deterministic path.
Media, permissions, context-menu adapters, touch diagnostics and appearance overrides
can still differ under an agent. Qualification uses a normally running app or an
audited journey; these clock changes do not certify every agent workload. Plain frame
reads under platform timing use the bounded metrics path. Plan-site perf <target>
can enable its requested counters without starting the old frame sampler.
On Android (agent.mjs android), the same operations read the reader's own frames in the
same formats, from two sources: app (exact-app-choreographer), each Choreographer turn
on exact2's thread, whose work runs from its vsync until the main thread has ingested what
it published, against Choreographer's deadline (Android 13 and later; before it the next
vsync), where a turn whose stream waits behind eight others has its work lost and counted
(work.lost, which keeps cadence from passing); and window (android-frame-metrics), the window's FrameMetrics, whose frames
have work against their DEADLINE (Android 12 and later) and no frame times, as the
screen's source on iOS has none. health window and report window name the second;
scroll is refused there, since the reader's scrolling is the window's. Neither observes
presentation, and a GPU canvas's SurfaceView is outside the window. A drive owns the
clock, so a frame is virtual until perf frames capture start lends the display the clock
for its lease: meanwhile a clock request is refused (an input's landing is not), and the
capture's replies carry clock, from which the driver goes on once capture stop or the
lease's end returns it. perf frames live <1–30000 ms> is such a lease, which reads both
sources from its start to its end. perf frames track answers unavailable. Only a driver's launch collects.
perf frames track start <node> [1–120000 ms] leases a scroll track on one node's native scroller (default
30000 ms). perf frames track read returns what it recorded, and perf frames track stop reads the rest and
releases it. The format is exact.frame-health.track/1. A fling's top hits and prepends are counted from it, which
the bounded metrics and reports don't carry.
•
Where its rows come from: each row is one committed offset change, recorded in the host's existing scroll
callback: iOS scrollViewDidScroll, or the Mac clip's bounds change. The track adds no display link, timer or
observer, so a tracked fling is scheduled as an untracked one is.
•
At rest: a still scroller writes no rows. On the Mac, a bounds change that leaves the origin where it was (a
resize at rest, including the first after start, whose origin is the baseline) writes none either.
•
A bounded read: like perf frames health, report and capture, a track request never waits for a slice in
flight to land. perf frames track start <view id> sends only the track request. A testId is resolved with one
tree first, which does land slices in flight, so resolve it before the glide, or start with the id tree
lists to start or replace a track mid-glide.
•
Several rows in one frame: a frame can write more than one row when the host also moves the offset in it (a
prepend's anchor correction). These are separate offsets, and their short intervals aren't frames.
•
Leases: one track a session. A second start replaces the first (its unread rows go, and the reply says
replaced: true). A start that fails (no-scroller, a bad lease) leaves the current track as it was.
•
Where it may be leased: exactly where perf frames capture may: frame health enabled (a development build
by default, or "core") and no virtual clock. An agent cannot attach to a production bake. Elsewhere it answers
available: false with capture's reason.
•
Memory: 4096 rows of 16 bytes, allocated at start and freed by the read that ends a stopped track, a
replacing start, a reload or clock change, the session's teardown, or, once the lease ends, the next track
request (or, while the track is still recording, the next feed). No timer ends it.
•
Reads: each reply fits 4000 bytes with the carrier's newline. It holds the oldest unread rows that fit; more
says there are others, and cursor (a row count, as a decimal string) continues from where it stopped. A read
with no cursor is from row 0, the track's first. The driver keeps each session's cursor, so consecutive reads
don't repeat rows, and starts again from 0 after a successful start.
•
Cursors: the driver keeps one cursor per app session it drives (s.session), so switching sessions doesn't
carry a cursor across.
•
Stop and ends: stop freezes the track: no row is written after it. Its reply is the first page of what is
left (stopped: true, more if there is more), the rest is read by cursor, and the read that answers
more: false releases the ring. A frozen track nobody reads to the end is released when its lease ends or a new
start replaces it. The driver's stop reads to the end and joins every page. A
read after the lease ended answers track: false, reason: no-track; the driver says so instead of returning a
partial page.
•
Malformed nodes: a node id that names no view (negative, too large, not an integer) is refused as
no-scroller and leaves the current track.
•
dropped: the rows the ring overwrote before the read reached them, which happens past 4096 unread rows.
Field | Meaning |
|---|---|
t_us | Arrival of the scroll callback, CACurrentMediaTime, microseconds since start |
interval_us | Spacing from the previous row. 0 (a new run, no comparable predecessor) for the first retained row, after a gap of 0.5 s or more, and after a gap of more than two periods following a t or - row: a held finger or a scroller at rest moves nothing and writes no row, so that gap is a pause, not lost frames |
missed | A proxy: max(0, round(interval / period) − 1), with period_us = 1 / the screen's maximumFramesPerSecond at start. It counts callback spacing, not presentation: a display running below its maximum rate reads as missed frames, and an unchanged offset in a frame writes no row |
offset_cpt | The scroller's committed offset along its scrolling axis (y unless it scrolls only sideways: on the Mac, its overflow says so when only one axis scrolls, whatever its content's height; otherwise, as on iOS, content wider than the scroller that fits its height), in hundredths of a point, clamped to JSON's safe integers (±(2^53 − 1)) |
phase | t a finger dragging, d decelerating, b past its range, - neither. On the Mac, t/d come from the event the scroller's own wheel handler moved it with (phase or momentumPhase began or changed; an ended phase is -), a plain wheel is -, and a move outside a wheel event (a layout's) is - |
On macOS, phased trackpad replay (tap … wheel … gesture) is refused under platform
timing with platform-trackpad-replay-unqualified. AppKit has no validated completion
acknowledgement for this synthetic sequence, so an immediate layout read may see
zero or partial movement. Use a plain wheel event in an
agent drive, or reproduce the trackpad gesture in the normally running app. Frozen-clock
replay remains available for functional tests and does not establish live timing.
The iOS/tvOS 18 native-scroll prototype observes one mounted active scroller with a
passive UIUpdateLink: it leaves continuous-update, rate, latency and presentation
preferences at their defaults. It is disabled in release/production builds pending
device qualification. A hidden, zero-size host lifecycle view ends observation as soon
as the scroller leaves its window; the normal end/deceleration callbacks close it too.
This view has no hit target or accessibility element. Reads never create the observer.
A missing earlier update phase increments nativeUpdateSamplesLost and skips that
sample. The observer reports completion-deadline overruns. Its cadence is unknown:
passive updates can pause while a finger rests, so they contribute no FPS, interval
histogram or maximum-gap population. This observer is not presentation feedback.
On macOS, Develop offers Frame Health, and the card's Details and Share work as on iOS.
Actions follow the responder chain to the eligible window; an embedder opts in by
passing frameHealthContainer to DevMenu.install. The standalone adapter supplies its
host slot. The card takes the clicks within its bounds and moves without changing the
app's viewport. Details shows within the card on both platforms, with the app's frames.
Clear starts a new measurement on both platforms, discarding the figures, charts and
retained hitches for every source the card measures. It preserves the paused state and
the app's requested frame rate. On iOS this also clears the screen-update measurements.
Active reader updates are coalesced at half-second intervals across the process.
Lifecycle changes may publish immediately; there is no idle publication timer, and only
an iOS card measuring the screen reads on a timer of its own, twice a second while it
shows. macOS spatial motion, canvases and press feedback request the current display
maximum, including above 120 Hz; press clocks are per window and update when its screen
changes.
exact.frame-health/2 is a versioned JSON schema. Field explanations stay here to
leave bytes for evidence. coreSinceReload counts every frame since the collector's
last reset, not only the retained rows: callbacks, frame intervals, missed and late
frames, and frameTimeBoundsNs and workBoundsNs, the bounds of the bins holding the
median, p99 and maximum frame time and work (perf frames health's bins; a null upper
bound is the open last bin). A field is null where its source does not measure it, as
the screen's frame times, or where its bins do not hold every frame. columns names each field in a hitches row. Export keeps
the newest rows that fit, in chronological order, with retention.omittedForBudget;
it never reduces timing precision to fit. Sequences, captures and generations are
decimal strings; other numbers are safe JSON integers. time.clamped invalidates
precision claims for values beyond that range. capturedAt is wall-clock export
context only. All intervals use CACurrentMediaTime, in microseconds: a retained
hitch keeps one absolute timestamp and stores its other times as 32-bit microsecond
offsets (35 minutes either way) and durations (71 minutes).
Row fields | Meaning |
|---|---|
sequence, capture, generation | Event sequence since clear, capture ID, and reload/clock generation. Identity names the installed binary, not the source of every hot reload |
age_us | Age at the export snapshot, measured from callback arrival, late apply end or late pending-work finish |
flags | Evidence, workload and power bits below |
target_offset_us | This callback/tick's platform prediction relative to the event; it is not intended content presentation |
period_us, requested_period_us | Scheduled callback interval and this session's preferred host interval at the event; zero is unknown/default. Other owners may request a higher rate |
gap_us, callback_us | Callback-arrival gap and synchronous callback duration. Gap requires a stable predecessor; zero means no comparable evidence. Apply and pending-work events have no callback duration |
before_gap_us, before_callback_us | Previous callback's observed gap/duration in the same segment; zero without evidence |
after_offset_us, after_gap_us, after_callback_us | First observed following callback's arrival offset, gap and duration; null if unavailable. At most two pending events receive this context |
owner_queued_offset_us, owner_began_offset_us, owner_finished_offset_us | Matching asynchronous frame-update submission, owner start and owner completion, including decoding and host callbacks |
main_landed_offset_us, apply_began_offset_us, apply_finished_offset_us | Main arrival and outermost presenter-apply boundaries. Apply excludes legacy sampler bookkeeping |
work_target_offset_us, operations | Captured frame update's target and batch operation count; an apply without a frame target has no work target |
frame_start_offset_us | Pending frame's start relative to its finish; null for callback and apply events. Its deadline is target_offset_us |
A pending frame that finishes after its deadline records a work event even when its
owner batch changes nothing and is skipped. Its origin is the frame's finish: the
latest of callback return, owner landing and any deferred canvas draw. The row has
no apply boundaries or workload/power flags. A late apply may also have an apply
event; these are separate observations, and the core late-frame count counts the
frame once. Synchronous work already has its callback event.
A report whose source is ui-update, the card's measure of the screen's UI updates on
iOS 18 and later, has no frame times and none of Exact's owner or apply boundaries, so
its rows have only sequence, capture, generation, age_us, flags,
target_offset_us, callback_us, before_callback_us, after_offset_us,
after_callback_us, waited_us, exact_us, card_us and layouts. There
callback_us is the update's work: the main thread's time from its scheduling until its
last Core Animation commit, less waited_us, the time it waited between them, as UIKit
lets it for input. The commit is as the card sees it, in an action just after Core
Animation's, behind any action ahead of its own in that phase, so a commit that ends
just before the deadline can count as late; an update with no commit seen ends at its
completion. The work is placed to end at the commit, so its effective start, the commit
less the work, is when it began only where its waits all came first. target_offset_us
is UIKit's completion deadline from that effective start, negative when the deadline
came before it; work longer than it is late. before_callback_us is the previous
update's work, and after_offset_us and after_callback_us the next update's effective
start and its work. exact_us is the part of the work in Exact's host phases (applying
batches, rows, text, scroll callbacks, pictures and waits on the runtime), card_us the
card's own, its drawing included, and layouts how many nodes' views UIKit laid out;
the rest is UIKit's, the system's and Core Animation's commit, and Exact's work outside
its phases, such as laying out those views. Null is unmeasured. Updates that follow each
other as one finishes are the main thread working without a pause; a single long one
between short ones is one stall, such as a new screen.
Offsets are relative to the event's origin; negative means before it. Null boundaries
are unavailable, never zero-cost work. Callback events attach the largest apply since
the preceding callback, otherwise the most recent apply only if it ended within two
scheduled periods. This is temporal evidence, not causal attribution. Queue delay,
owner elapsed time, main-thread landing delay and apply duration can be derived by
subtracting their matching boundaries. Elapsed time includes descheduling; it is not
CPU time. The report cannot attribute unobserved main-thread work, GPU execution,
presentation, input latency or native-only animations. Zero counts or an empty report do not establish healthy rendering. Live agent scheduler/apply parity remains unqualified; reproduce
outside an agent run for production behavior.
flags bits: 0 callback gap >1.5 stable periods, 1 synchronous callback past target, 2
captured tick apply past its target, 3 following callback known, 4 apply context known,
5 largest apply in the callback interval, 6 packed value clamped, 7 pending frame work
past its deadline; 16 motion, 17 spatial, 18 canvas, 19 frame tasks, 20
fill pending, 21 tick pending, 22 hatch frames, 23 workload flags known (otherwise bits
16–22 are unavailable); bits 32–33 thermal state (0 nominal, 1 fair, 2 serious, 3
critical), 34 Low Power Mode, 35 card shown, 36 card dragging. A ui-update row's bits
16–23 are the app session's and bits 35–36 the card's as its update was scheduled, and
bits 40–46 the users of Exact's frame clock, in any session of the process, asking for
frames then: 40 the session's clock, 41 a list's offset correction, 42 a navigation
reveal, 43 the scroll pump, 44 deferred heavy leaves, 45 a live SVG filter, 46 a
textarea's resize grip; with none of them, UIKit or the system asked. These cached
observations do not establish which activity caused the hitch.
Save received text as report.frame-health.json if needed, then use
bun scripts/agent.mjs trace report.frame-health.json for the expert readout. This
explicit recipient-side save does not create an app-side retention policy. Commit,
presentation and host-phase probes like those explored on ide/trace-costs can guide
a later targeted investigation; this bounded monitor does not run those probes.
Build diagnostics include stable ids and original file ranges. Locations are
1-based line/byte-column coordinates, with exclusive end columns; a usage, I/O or
manifest error has no range (line and columns 0). Honor related
locations when an error crosses a child prop, injected action, or imported file.
Do not use a character index as a byte offset in Unicode source.
Terminal
bun exact.mjs contract build app.contract --json
bun exact.mjs contract symbols app.contract --name save
bun exact.mjs contract build app.contract -o /tmp/app.plan --map
The source map (<plan>.map.json, beside the plan) is separate from the plan and
keyed by its digest. Use it only for
the accepted generation it describes. The driver can connect layout to the
original declaration, component call sites, and winning style attribute.
Production artifacts do not need a development source map.
The driver has ten operations: tree, screenshot, tap, type, state,
layout, logs, clock, prefer, and perf. Variations are arguments, not new
commands; prefer takes CSS's media feature names ("prefer prefers-color-scheme dark",
"prefer prefers-reduced-motion reduce"). The display's scale, which a hairline is one
device pixel of, is the device's: a simulator's or the Mac's own, and on the web and the
Linux host what EXACT_SCALE=2 launches them at (1 otherwise; "prefer display-scale 2"
changes it under a native host, and layout shows the boxes that follow). Targets are testIds (or view ids): give every control a testId and
drive it on every host, iOS included (agent ios), never by screen coordinates.
On a machine with several booted iPhone simulators, name yours: EXACT_SIM=<udid>
for agent ios and the smokes, --sim <udid> for host/apple/build.mjs; a
choice among several is refused rather than guessed (another drive's simulator).
A target no testId carries resolves by a view's exact accessibility label or
text (tap "Save draft"); a name several views share refuses, naming them.
type also sets a control's value: type "persona" "bob" chooses a
select's option by its value, and a date, time, range or checkbox takes
its value the same way, in a drive or a test (a tap does not open a native
select's menu under the driver).
tree --ax prints the platform's accessibility properties without claiming
VoiceOver's reading order. An iOS simulator drive containing tree --ax enables
UIKit's accessibility runtime before launch and restores the simulator's setting
after launch. Library drives request this with open({host: 'ios', ax: true}).
verify reads it once at each screen it checks and counts its findings as check's:
a control with no name, an element exposed while hidden, one reachable outside an open modal.
Use tree to find targets, state for data and delivery, layout for
geometry, perf for the work a drive cost (perf <target> during "<op>" …: per
plan site, evaluations, unchanged results, instances created and retired), and
screenshots for rendered output. state.tasks gives each task's next due time
(null while a gated task is idle or an after is spent) and state.queued each
queue mutation's waiting sends. Logs name refused operations and data errors.
Under the driver's clock no frame is presented, so perf frames measures a
live window instead: perf frames live 3000 lets the page's clock follow the
wall for 3 s and reports the frames it presented (p50/p95/p99, late frames)
and each game world's frame, tick, feed and encode times, on the web's wasm
target (a game's). The world ticks on the wall in that window, so a hash
taken after it is not a seeked run's.
For a game canvas, JavaScript s.tap("world", {mouse:true, at:[x,y]}) sends one
primary mouse click on web, macOS, Windows, and Linux (on macOS any node takes
it, so a click can land on a link inside a paragraph). {contextmenu:true, at:[x,y]}
sends a right-click on desktop hosts and the web. On Android and iOS,
tap <target> contextmenu delivers a recognized long press to the nearest node
with a contextmenu handler or contextPopover. Its handler runs and its menu
opens, where present; a handler needs no popover. Coordinates are relative to
the target's top-left; omit at for its center. Invalid, covered, or offscreen
points are refused. Mouse clicks also require held contacts to be released.
Windows' headless agent refuses a field's native editing menu before changing
its focus or selection; authored menus and handler cancellation still work.
The CLI forms are tap world mouse [at <x> <y>] and tap world contextmenu [at <x> <y>]. tap <target> auxclick is the middle button and clicks 3 a triple
click (each press counting 1, 2, 3); every click form and a wheel take at <x> <y> and
modifiers Shift+Meta, and down … modifiers Shift or drag … modifiers Shift holds
them to the lift. Chrome and macOS deliver these as a hand's (on macOS through the
application, so its local event monitors see them). Other carriers answer
delivery: "unsupported" for forms they cannot carry; Firefox and WebKit carry
clicks and wheels at a point, including wheels with modifiers. A word a form does
not use is refused by name. tap stage wheel 0 -20 modifiers Control
is a pinch's wheel; tap world drop a.board drags a file in (web, macOS, Windows, Android). Plain canvas taps and held contacts are
fingers, so their platform pointer identity and retained press history can differ
from a mouse's; use the intended physical input when comparing game saves.
On Firefox and WebKit, a wheel positions the pointer at its delivery point first;
if it moves, the reply's hovered: [x, y] reports that input. To compare wheels across engines,
use session.tap(target, { hover: true, wheel: [dx, dy] }) on every page. It resolves
one viewport point for the hover and wheel, keeping it if hover changes the layout.
The wheel may also name at: [x, y] and modifiers: 'Control'.
conform.mjs --browser does this and reports the comparison as hover followed by wheel.
tap and type scroll a target whose middle is out of view into it first (its
nearest scroll containers, then the page) and say so in the reply's scrolled.
A tap aims at the target's middle, or, where the target is not there (a wrapped
inline run, whose middle can fall between its lines), at the middle of the first
of its lines that is; a tap whose point lands on something else fails, an
ancestor that would take the press itself included.
A tap that names a node presses that node, never a control inside it: a node
with its own press (or a link) whose middle holds another — a post row's link
card, its Like — is pressed at the nearest point of its box the search finds
that reaches it (the reply's avoided names what the middle holds), or refused
when it finds none; a node without one is refused when its middle holds a control
(tap post-0 would press card-0 inside it; tap card-0, or tap post-0 at <x> <y>).
The search tries a grid of about 12 points, then about 3 points and the box's
edges 1 point in, so a reachable strip thinner than that, away from the edges,
can be missed: then name a point. tap <target> at <x> <y> presses at a point
from the target's top left, whatever a finger there reaches, on every host. What
a press there would deliver counts as a control: a node with its own press, an
SVG element, an inline run or link, a form control or text field (it toggles,
opens or takes the focus), a grouped list's row, a surface's action button and a
canvas that takes input. A disabled node presses nothing (on the web only a
disabled form control: disabled on a box means nothing there). On iOS without
--touch platform a refused tap has still dismissed, or begun to open, a
painted popover, as the tap's first step.
type on a control sets it as a person choosing would, with input then
change: a select takes an option's value or its label, a date, time or
datetime-local input its HTML value (2026-10-09, 14:00,
2026-10-09T14:30), a range a number, a checkbox true or false, a radio
true (it is unchecked only by checking another of its group). A
select, a range and a date, time or datetime-local input keep the person's
choice until their bound value changes, as a text field does (LLP 1069.001 D4,
amended): an action that writes nothing, or only sends a mutation, shows the
choice until the bound value moves, on every host, and type replies with what
the control shows. A checkbox still snaps back to its bound checked.
On a text field or textarea type inserts the text, one input (in a CLI op the
text is the rest of the op's words, joined by one space, quotes included:
"type new-task buy milk";
in a test file each value is one quoted string, a checkbox's "true" too); change comes as a
person's would, when the field commits (type <id> key Enter on a field, or the
focus leaving it), so an edit saved on change needs one of those (on macOS a
tap on a button leaves the focus in the field, and commits the field's change
before the button's press runs). A CLI drive's
input does not wait for a request its action sends; clock data lands it.
tap <target> drag <dx> <dy> … during "<op>" … runs the quoted reads after the
move, with the finger still down, before the hold. Under --touch platform the
lift is scripted, so the reads run inside the hold and during needs one
(hold 300 during "state"). Under the agent's clock the gesture moves the clock by its
press, over and hold as the finger makes them (under --touch platform on real
time, as a clock +<ms> real would), so the app's every and after run while it is
held and performanceNow() in its pointer actions reads how long it was pressed. tap <target> drag to <other> [at <x> <y>]
ends the drag on another node (refused by name when it is not mounted or off
screen); a drag that should autoscroll a list or a board is drag dx dy hold ms. On iOS
without --touch platform a drag scrolls the scroll or list it starts on with the
finger, no fling; any other drag there is refused, naming the flag.
On the Android APK reader, a named scroll or list receives deterministic scroll
samples; the reply labels native touch recognition and fling as unobserved.
Presenter-owned pans keep their contact path. Scroll samples cannot hold a touch
for press, hold or during; use native device input to verify those gestures.
into keyboard (library: drag.into: 'keyboard') lets the end pass the
viewport's bottom, down to the screen minus its bottom safe area. It requires
an iOS simulator with --touch platform and the software keyboard up at the
press. The start stays in the viewport. For a held dismissal on a transcript
whose keyboardDismissMode is "interactive", write tap transcript drag 0 200 hold 1000 into keyboard during "state" and compare keyboard.top with the
finger's endpoint.
Append then dx dy [over ms] [hold ms] [during "op" …] to script another leg
with the same finger, in a drive or a test file. For example:
tap handle drag 0 120 over 300 hold 500 during "layout" then 0 -120 over 300 hold 500 during "state".
Each delta starts at the previous endpoint. Under --touch platform all legs play
in one XCTest synthesizer record, with one down and one up, and reads run inside
their leg's hold; if they outlast it, the drive fails. Elsewhere the carrier's
contact plays them; on iOS without --touch platform only a test's drag can. The complete path must stay inside the
viewport (or the extended end bounds with into keyboard), last at most
10 seconds, and spend at most 2 seconds moving, across at most eight legs.
Library calls use drag.path: [{dx, dy, over, hold, during}]
for the additional legs, with during read functions. Separate requests never
keep an iOS contact down.
Under --touch platform a tap replies viewGone: true when its view left the
window before the finger lifted, so that view had no lift (UIKit rebuilds a
grouped row's detail button in the first seconds after the list appears), and
downAfterLift: true when the window had the down only after the finger lifted
(the app busy, or the system slow to deliver it; a UIKit switch in a list cell
takes a down and a lift that arrive together as no tap). Read the state, and tap
again if nothing changed; touch.dispatched less touch.ended says how late
the down was, and an app that blocks its main thread that long loses a
person's tap too.
A wheel (tap <scroller> wheel 0 300) and, without --touch platform, a drag on
the scroll or list it starts on (tap <scroller> drag 0 -300, past the screen
too) leave it as a person's scroll by that distance does, with no glide: the
content moves that far, a large title collapses as it goes, and a scroll back to
the top opens it again. A drag moves over over milliseconds (250 by default),
including one that ends past the screen; live frame capture observes the motion.
As a person's, none stops with the content partway under
a large title: it eases to the title's open or closed rest, whichever is nearer,
so under one a wheel of 20 from the top moves nothing (with a search field in the
bar it stays where it ends: not measured). Under --touch platform a drag whose ends
are both in the viewport is a real one (delivery: platform): the content follows the
finger once UIKit's pan begins, some 10 points in. Without a hold it glides on
after the lift, and clock settle waits up to 4 s for it to stop (reason: "scroll" past that). Held for hold 100 or longer it stops with the finger,
which the runner steps a point across the drag and back in the hold's last
150 ms, as a finger does (measured along a list); hold 50 still glides. With
into keyboard and the keyboard up at the press, an end below the viewport
stays delivery: platform, down to the screen minus its bottom safe area;
farther ends are refused. Without that option, a drag that ends past the
viewport is the agent's drag above, delivery: recognized.
On macOS a wheel is applied at once, with no momentum and no rubber band.
tap <scroller> wheel 0 600 fling is a trackpad's fling instead: the driver
posts its events to the app through the window server, AppKit glides and bands
as it does for a person, and the reply comes when the scroller rests, with its
offset (on the real clock; the session's clock does not move). wheel 0 3000 hold leaves the finger down, so layout and screenshot see a band pulled
past the end, and wheel 0 0 release lifts it; a drive that ends with a hold
open lifts it too. These need the terminal's Accessibility grant (System
Settings › Privacy & Security) and a window that is on screen; without either
the operation fails and says why. A pull that starts at a scroller's end goes to
the scroller around it, so one from the end of the outermost moves nothing.
tap <scroller> wheel 0 600 paced plays a fling inside the app instead, one
continuous wheel event per frame at the screen's rate: the finger's travel over
100 ms, then its momentum, slowing by 0.95 a frame. It needs no grant and no
window on screen, and the reply comes at once with the gesture's events and
ms, so wait it out in real time (perf frames live <ms>) under --timing platform. wheel 0 0 paced plan 0,300,1300;0,-250,700;… plays several flings
from one request, each <dx>,<dy>,<ms> with the time until the next touches
down, which stops whatever still coasts, as a finger on the pad does. One
request keeps the drive off the main thread while the flings play, where a
tap per step resolves its target each time. The events carry no gesture
phases: AppKit applies only the first event of a phased gesture that did not
come through the window server, so its own momentum, rubber band and scrolling
thread do not run. What a paced fling measures is the app's work per frame of
a scroll, not AppKit's scroll physics.
During a reorder state.reorder reads { item, from, to, before, phase, ending }; a grouped grip also takes type <grip> key Space and the arrows. clock +N moves the virtual clock without
waiting for a store's or the network's reply on real time (unless a timer fires
first); its reply says what is still in flight (inflight, on every host), and clock settle lands it.
On the web JS target, a single jump can deliver several timer-driven DOM edits together
to a MutationObserver. To observe an intermediate value, advance to that time in a separate clock step.
A request the server holds, marked exactHeld: true (a long poll, LLP 1016.000 D9), is the exception: no
clock waits on it, neither a jump nor clock settle nor clock data, and each of their replies names it
(held, heldTargets; state.pending marks it held: true). Its answer must be safe to supersede.
After an action that causes a push you will read (a write the server echoes, a build's report), say so with
clock held [<target>…] [<n>s]: real time passes with the clock frozen, so no timer fires, until each held
request in flight (or each named) has had one reply, the server's own timeout answer included; then clock data lands what that reply started. Past its bound (20 s) it answers settled: false, reason: "held",
naming the targets that had none.
A stream counts as landed when its first mapped value commits, so for state it
reaches later (a socket's READY after HELLO),
wait with clock until state <path> == <literal> within <ms>: real time with the clock frozen, polling state
until it equals the JSON literal; a miss fails naming the last value.
clock settle also runs the clock to where the last running finite, unpaused
transition or animation ends, firing the timers due on the way, so a test on a timer's grid moves with it,
and on past a task due a commit later (after(1, …), which an input or an answer armed) until none is.
clock data takes clock ownership, including after --timing platform: it freezes
platform timing at the current instant and leaves the clock held after the reply.
It lands data without moving that clock: the data module's activation and
every request in flight, each answer's then with it, no timer fired (its reply names a task
due a commit later, which a tap next would come before: clock settle runs it). A CLI drive's
first operation runs at boot and may come before that has landed (an authored test
lands it before its first step), so a drive that reads or taps data starts with clock data
(a tree, layout or screenshot taken before the clock first moves, with a request
in flight, says so on stderr).
A playing video or audio is on real time too: the clock never seeks or holds it, so
between operations it moves only as far as the drive took. clock +N real lets
N ms of real time pass with the clock moving beside it, a step at a time: a
video plays that far (its timeupdates arrive), and a reply that lands in the
span lands (LLP 1042 §3). On Apple's hosts state media reads each video's
player: its renderer, paused, currentTime, muted and volume. Under the
agent a video never takes the audio session, so the app's audio_session is not
applied and a drive cannot show that it is heard (AVKit's speaker shows a slash).
On iOS, AVKit's own controls (controls=true) show only for a real touch: tap the
video under --touch platform.
clock +N real until <path> is a test harness's affordance, not something an app
drive needs: the same real time with the clock beside it, ended early once the
file at <path> (a local path, not a URL or a glob; its directory must exist)
exists, which the harness driving the drive writes at the event it waits for. The
clock moves by exactly the real time gone, and the reply says until: "met" (at
once, real: 0, when the file is there already) or until: "bound" after N ms.
Under the driver a picker, an export, a share or an auth session opens no panel:
it is held and state lists it under pending with its capability. Answer it by
the node its answer arrives at (the id the command names) or by its capability:
type @folder-input path/to/folder, type @pick photo.jpg, tap @open-directory cancel. @N, its ticket, works too, but a ticket counts every request before it,
so it differs between hosts and runs. On Linux, Windows and Android a tap on a date
or time control holds its picker the same way, by the control's kind: type @date 2026-10-23, type @time 09:30, tap @date clear, tap @date cancel.
Authored tests are a smaller language over that API:
contract-test
test "an action uses its computed next value"
expect state count == 0
tap "advance"
expect text "result" == "1/2"
expect state doubled == 2
This test goes with the complete example above. A test opens with its launch
lines — size 1200x800, epoch "2026-09-21T12:00:00Z", time-zone "America/New_York", locale "fr-FR", seed 7, the driver's flags of those
names, and fresh (the Snapback dev server emptied first, fresh "seed.json" seeded from a file; Snapback tests) —
written first in the test or, for every test, at the top of the file.
prefer prefers-color-scheme dark sets a media preference before the first
observation. It can lead the test or the file, or appear later to change the
preference between steps. Use the driver's CSS media feature names and values
(prefers-color-scheme light|dark, prefers-reduced-motion reduce|no-preference,
and the other media preferences listed above). prefer permission.notifications granted sets a module's permission the same way, as the driver's prefer permission.<name> granted|denied|prompt does. A test's leading value overrides
its file's default for that name only. Duplicate names at file level or among a
test's leading launch lines are errors; later steps may change the same name.
A bad name, value or unsupported emulation fails that test at its line.
reload and verify's relaunch keep the latest applied preferences. On native
hosts they are applied after connection, before the test observes the app;
they do not set its appearance before mount. MIDI's prefer midi.… remains a
step inside a test.
prefer root-font-size "24" sets the root text size in pixels for a large-text
fixture. Other single-value page facts, such as prefer online false, follow
the same launch, override and reload rules and use the drive's parser and name
aliases. Hosts refuse facts they cannot substitute. The hinge's facts (posture,
segments, gap) and mode pins require a drive.
prefer extension store.outcome="cancel" sets a package substitute.
A leading line supplies it before boot. A later step changes subsequent calls,
and prefer extension store.outcome=clear restores the package default.
A package that reads its substitute only at startup sees a mid-test change
at the next launch. Reload and verify's relaunch receive the current values.
Each test and each replay starts again with the package defaults.
Before the first step (and after a reload) the driver waits for the app's data
as clock data does: its data module activated and every request launch started
(a store's open, a fetch) answered, the clock unmoved and no timer fired, so a
test does not start with clock settle. before data, a launch line, skips the
wait; what has landed then is the host's (a native app runs on real time before
the driver connects).
To test an error path, fail the fetch: fail fetch "<url prefix>" makes every
later fetch whose URL starts with it fail exactly as a refused connection does
on that host (a TypeScript source's fetch rejects with FetchError kind
"Network"; a Rust source's request settles Failed { kind: Network }), and it
never goes out. Leading the test it is armed before the first data load, so
"the API is down when the screen opens" is the launch; later it is a step.
To test going offline after the data loaded (a Snapback4 partition, which
cannot open before its first sync, is the usual case), put clock data first;
a runner note names a fail fetch armed before the data loaded.
times N fails only the next N; pass fetch "<prefix>" stops it; a counted
fault that never fired fails the test. A fault reaches only fetches that start
after it: a request already in flight with the same arguments is reused by the
runner (one request per resource and arguments), so re-opening the screen while
it is pending gets that request's answer, not the fault. Arm the fault before
the request starts (as the launch line, or before the step that first loads
it), or let the pending one settle (clock data) first. The app's own catch, error record and
retry run, so this checks the real error handling (LLP 1103). A drive takes
--fail-fetch <prefix> at open and the ops "fail fetch <prefix> [times N]"
and "pass fetch <prefix>"; state.faults shows each prefix's hits.
Each HTTP attempt of a long poll can take a matching fault, including an
attempt with its updated cursor. It retries as after a network failure;
state.streams shows the backoff in retrying. A successful reply resets
the backoff. Other stream types do not take fetch faults.
contract-test
test "the list shows an error, then retries and loads"
fail fetch "https://api.example.com/recipes"
expect text "error" == "Couldn't load recipes."
pass fetch "https://api.example.com/recipes"
tap "retry"
clock data
expect tree has "recipes"
answer fetch "https://api.example.com/greeting" with 200 {"text":"Hello"}
supplies a response without contacting that service. Leading a test or the file,
it is installed before the first resource load; later it is a step. The real
source reads its status, headers and body. A quoted string supplies plain text;
JSON supplies application/json. Optional header "name" "value" pairs before
the body set response headers. Use a text body to test malformed JSON.
An answer replaces a failure or answer at the same prefix; fail fetch replaces
it with a connection failure, and pass fetch clears it. The longest live prefix
decides. Reload carries the current table, and tests start with independent tables.
On the web, the carrier gives the table only to the top-level document on the
original app origin, excluding child frames and pages on other origins.
Development render servers apply the fixtures while rendering request and cached
pages, preserving unrelated server-fetched answers in the checkpoint. Fixture
renders are not shared or cached between requests. On adoption, only answers that
fetched a URL matching a table prefix are asked again, including a prefix cleared
by pass fetch. Other rendered answers stay settled. A delivered response does
not excuse a resource failure from expect no failures. An injected connection
failure remains arranged after
its prefix is replaced or carried through reload.
Fixtures keep request validation, file-read grants and upload limits, deadlines,
response limits and native HTTP caching. Native prefetch and its foreground
fallback use the same fixture. A web response and its clones keep the request URL
and read-only headers.
Unmatched URLs still go to the network. answer fetch covers buffered HTTP
responses; redirects and exactBodyTo are not supported. For HTTP(S)
exactStream event and byte streams, use answer stream "<prefix>" [method POST] with 200 followed by indented event, bytes, end or fail lines with
cumulative after <ms> delays, and pass stream "<prefix>" to disarm it.
after 0 events land on clock data; later events park across clock settle
and advance on clock +<ms>, letting a test interact mid-stream without a live
server. See the authored-test grammar for
limits.
To write through the app's own server as another person, request POST "/items" {"title": "Bread"} as grace is the driver calling it (Authorization: Bearer grace,
under app.ts's local URL; a status outside 2xx fails the step with the status and
body, unless … as bob expect 409 says it is the refusal the test wants). The app shows the write when it next reads: clock +<its poll's ms>, clock data, then expect (your own REST server,
authored tests).
A slow server is bounded in the source, not the view: fetch(url, { exactTimeout: 10000 }) cancels the exchange after 10 s (headers and body) and
rejects with a FetchError of kind "Timeout", which the source catches and
answers as any failure (a Rust source's request takes Request::timeout(ms)).
Without it a stalled fetch waits the platform's limit (60 s without data on
Apple). Test the error state with fail fetch, as above; a timeout itself is
tested against a stand-in server that never answers (the reference's
"exactTimeout"). A stream that may go silent (a WebSocket, an event stream,
a byte stream) takes exactIdleTimeout: ms beside exactStream: the host
ends it, as one
error event of kind "Timeout", when nothing has arrived for that long,
and the app refreshes the resource to open it again (the reference's
"exactIdleTimeout"); fail fetch does not produce it.
A test whose text depends on the date names its epoch; without one it runs at
the driver's 2026-01-01 UTC. A drive or test whose app talks to a live backend
(snapback4 dev runs on real time) says --epoch now or epoch now: the
machine's clock, read once at launch, from which clock moves the date as
before, so the app's dates agree with the server's but differ run to run. The steps are tap "id" [hover|dblclick|contextmenu],
tap "id" modifiers "Shift+Meta" (a press with keys held),
tap "list" into "key" (a virtualized list's row brought into view by its key,
so the next step can tap a row outside the rendered window),
tap "id" pinch <scale> [at x y] (two fingers; scale greater than 0),
tap "id" swipe <left|right|up|down> [at x y] (the platform's swipe as a real flick, a fast
drag of 120 points from the target's middle or at; iOS, where a test file takes real
touches for it),
tap "id" drag dx dy [from x y] [mouse] [press ms] [over ms] [hold ms] [into keyboard] [during "op" …]
(a finger, pointerType touch, where the carrier has one, unless mouse names the left button; during
is last: quoted reads or clock while that contact is down, after the move and
before the hold; press and hold advance the virtual clock, except under
--timing platform, and over does not, so on the virtual clock a GPU surface's
samples of one move share its time, at_ms: give them times with --timing platform,
or with a contact's phases, each hold before the step it times, as tap sky down,
tap hold 16, tap move by 0 -20, tap hold 16, tap move by 0 -20, tap hold 16,
tap up (the last hold lifts the finger a frame after its last move); on an iOS simulator it is a real UIKit gesture, so a swipe row's
full swipe performs its action),
tap "id" drag to "other" [at x y] […] (it ends on the other node's middle, or
at a point in its box; a card dropped on another list; on iOS a tap naming a
native swipe action's control performs it as assistive technology does, with no
swipe, where the web's tap scrolls the row to it, and --touch platform, as in
bun exact.mjs test ios --touch platform, makes every tap a real touch),
type "id" "text" (sets the value), type "id" "text" append (after the value
the tree shows, as typing after a prefill), or type "id" key "Name"
(down, up — its keyup handlers hear it — or for <ms> on the virtual
clock, repeating as a held key does: a keydown with repeat true 500 ms after
the down, then every 83 ms),
type "id" paste "text" (⌘V on macOS, Ctrl+V elsewhere, then the paste; a key handler that preventDefault()s that chord keeps it from landing), type "id" copy, type "id" cut, pick "id" "path"… or
pick "id" cancel (a held picker or export, by its node or capability as
above; paths are the test file's), clock settle|data|+ms|+ms real|ms (data:
what is in flight lands, with each answer's then, the clock unmoved), clock held [<resource>…] [<n>s|<n>ms]
(the driver's: real time with the clock frozen until each held request, or each named, has had a reply, such as a
long poll's after a push the test caused, within the bound, 20 s unless given; then clock data), clock until state <path> == <literal> within <ms> (real time with the clock frozen until expect state's path equals a
string, number, true, false or null), resize 800x600 (the window, mid-test), reload
(the app restarts on the store it had, including a secret.keep, its state and
clock starting over, so a test shows what persists; the web reloads its current
URL, including its agent launch facts; on Linux, Windows, macOS and iOS a
native app reopens at the drive's path or app scheme --url, otherwise at
its no-link cold launch location:
the manifest's start_url on Apple, / on Linux and Windows; an HTTP(S)
--url selects a development server, not a launch location. Native reload
builds a fresh navigation stack; at changes only the first launch, so
assert a detail-route launch before reloading. Android's APK reader opens
these launch URLs and a leading at path as its launching intent's data, as a
link opens the app; agent android --headless runs
the Linux host on Android and accepts both. See
reload and native launch tests),
close (the window's close button, as ⌘W: a beforeunload that
calls preventDefault() keeps it open and the test goes on to the app's "Save
changes?"; macOS and the web), back (the platform's Back: a dialog's cancel,
a sheet's dismissal, the pushed route popped; a refusal is a note, nothing to
go back from fails),
screenshot "file", expect tree has|missing "id", expect disabled|enabled "id" (a control's
disabled; a tap on a disabled one fails its step on every host), expect focused "id" (the
node holding the keyboard focus), expect layout "id" width|height ==|<=|>= n (its laid-out
size in points, from the box layout <target> prints: expect layout "status-mark" height <= 24
fails for a glyph a column stretched), expect text "id" == "…"
(the node's text; a control's value, so a select reads its chosen value, not its
options, and a checkbox with a checked binding true or false; else its descendants' — a button's label — else a field's value), and
expect state name == <literal>, where name may go on into a record's fields
(board.active.present) or a list index (rows.0). A literal is a number (negative
allowed), string, bool, none, some(literal), list (["a", "b"], [[1, -2], []]),
or shape with literal fields (Point(x=1, y=-2)). == and != compare the whole value
structurally (expect state shown != "hint"). Numeric bounds use >= or <=
(expect state offset >= 90 and expect state offset <= 110); they require a number, without coercing strings or bools.
expect state mode in "idle" "ready" checks literal membership; alternatives use the same
literals as ==, separated by spaces. Every operator also accepts a state path on the
right: expect state pinned == state locked, expect state offset >= state minimum,
or expect state mode in state allowedModes. Both paths read the same state reply.
Bounds require two numbers; in requires a list whose element type matches the left.
Incompatible path types fail compilation with both types named. A missing path on
either side fails, including with !=; a present none compares as a value. A
mismatch prints both values and the right-hand path when present.
expect wakelock held|released reads state.wakelock.held: the runner's record of displayed elements requesting the
lock, not whether the OS or browser granted it. A mismatch names the holding
view ids and their testIds when present, or says nothing holds it.
A failed expect names any resource that
failed, and why; with no input before it, the requests still in flight (the boot's
own, or what a clock +N left on real time). An input step ends with what it settled: an answer the data
module gave in the input's turn, and its mutation's then, are there for the
next step. Otherwise the clock stands still between steps: a reply on real time
(a store's, the network's) or a transition an input started lands at a clock
step, so clock settle before the expect that depends on it. Storage work that
has answered by the end of a web input may still be pending on iOS, macOS or
Linux: before a later step depends on its reply or its mutation's then, use
clock data (or clock settle, if motion should finish too). A timer
(after, every(ms)) fires when the clock reaches or passes its time: clock settle fires it only if it reaches it while advancing to a motion's end, so
move to it with clock +N (a task … after(1, restore) needs clock +1).
type "id" key "Name"
focuses the target if it takes the focus (else leaves the focus where it is)
and presses the key as a keyboard would on every host: its key handlers,
then its default — "7" types into a field, "Enter" submits it (a
textarea's breaks the line), "Space" presses a button, "r" reaches an
aria-keyshortcuts="r" button — then releases it through the keyup
handlers at the focus. A chord holds its modifiers for the key, in
Playwright's spelling: "Shift+Enter", "Meta+s", "Control+Alt+ArrowLeft"
(keys). As a keyboard does, on every host, each
modifier is its own key first: a key handler hears Shift, then Enter
(with its shiftKey), so a handler that treats any key as typing must skip
Shift, Control, Alt and Meta. A paste is the same (Control or Meta,
then v), and so is a click or a wheel with tap … modifiers on Chrome,
Firefox, WebKit and Linux, and a right or double click with modifiers on Chrome.
Each modifier comes up after the key, in reverse, without its own bit, so a
keyup handler hears it too. Still flags only, with no modifier key of their
own: Apple's taps, a drag's phased tap … down/move/up (Chrome and Apple;
other carriers refuse modifiers there), and a key a canvas world takes on Apple.
Not every interactive
driver operation is a test-file statement. contract test parses and prints JSON;
agent.mjs <host> --test <file> actually drives the app.
Test the behavior being changed: a filter retaining row identity, a text edit
sending the new value, an async error retaining its placeholder, a route back
restoring a screen, or an animation at a specific virtual time. An assertion
that restates a constant is weaker evidence than the user's actual sequence.
Is this helpful
Last updated November 30, 2026