You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(cache)!: keep one reviewable YAML file of replay recordings per test - #2092
Each test's replay recordings are one reviewed <test>.yml under .e2e/cache/, beside a generated <test>.lock.json that holds the keys and digests. They replace one JSON file per cache key, named by a hash. The file is named for the test: tests/admin/login.e2e.ts's signs in is admin-login-signs-in.yml.
test: control inventory › check sets the checkbox and the radiofile: tests-agent/control-inventory.e2e.tssteps:
- act: agree to the terms and pick the Medium sizetargets:
web:
at: /e/control-inventorydo:
- check: { role: checkbox, name: Agree to terms, within: Toggles }
- check: { role: radio, name: Medium, within: Size }expect:
shows:
- { role: status, name: Toggles state, text: "terms agreed, size Medium" }
- { role: checkbox, name: Agree to terms, states: [ checked ] }
e2e cache ls prints one row per recording: file, target, instruction, age, actions. Trace pages name the test's file and the key.
Breaking: <key>.json entries are no longer read. A run on the built-in file store says how many the cache directory holds, e2e cache ls counts them, and clear deletes them; a read-write run records the steps again. There is no deprecation window, by decision for this change. The changeset is a minor with **Breaking:**.
CacheStore.read and delete take the step as an optional second argument (TraceProvenance, now exported). A store may ignore it; tests/types/sdk-types.ts asserts that a key-only store still type-checks.
Why
A reviewer of a re-recording saw a list of digests and nested JSON, so committed recordings went unreviewed. #1692 (closed) kept the one-file-per-key shape in YAML. This makes one test one file, in the order the test runs its steps, and moves what nobody reads into a generated lock.
How it works
flowchart LR
S[step claims key K] --> L[lock entry for K]
L -- digest --> Y[YAML block]
Y -- act / params digests --> L
L -- recordedFor --> C{same step as the claim?}
C -- yes --> R[replay do, check expect]
C -- no --> I[invalid-entry]
Loading
Format (packages/core/src/cache/recording-file.ts). Each step sits under its act and params, then per target what a replay does (do) and what it checks (expect). The YAML is the replay input itself. It is read with the core schema only (no tags, anchors, aliases, or unknown keys), action summaries are rebuilt from the actions, and a repeated act shows call: N. A target carries every descriptor field, including fix(cache): stop a replay from acting on the twin of a control that is gone #2093's twinsWithoutTestId and countedOnEarlierLook. The header names the test's file and titles. A setup test (setup::<file>::...) is marked (setup), and a createAgent key (core:<key>) is shown as written. A summary that quotes a unique() slot is made again from the filled action (cache/template.ts), so a parameter named with a quote still replays. tests/unit/trace-store-fields.test.ts names every field of each action, the target descriptor, the trace, its provenance, its executor, and the types nested in them (position, point, place in a node, viewport, model, key context) in records the types make exhaustive, and round-trips a fixture that sets all of them. A field added to trace-1 fails the typecheck until a fixture sets it, and the round trip fails until the YAML keeps it, so the format cannot fall behind the trace types without a failing check.
Lock (<test>.lock.json, linguist-generated in .gitattributes). Per recording it holds the key, digests, provenance (executor, model, summary), the end wait in whole seconds (a replay input no digest covers, capped at 120 s), and a digest of the recording as the YAML reads back. A lock entry finds its YAML block by that digest, so moving steps, deleting one, or keeping both sides of a merge leaves the rest readable. An edited block, or a key pointed at another step's recording, reads as invalid-entry. The exception is an entry that says its act or params are redacted or cut: only its digests hold it, so the docs ask reviewers to open a lock change that comes with no YAML change.
Step check (packages/core/src/agent/step-cache.ts). A hit replays only when the entry's recorded step is the step that claimed the key, identity digest included (it tells apart long names cut to the same text), so keys swapped in a hand-merged lock never replay.
Store (packages/core/src/cache/store.ts). A step keeps one recording per target, and a new step lands where the test runs it. A write takes the test's lock (cache/file-lock.ts: a wx file holding its holder's random token, taken over after 30 s, checked again right before the renames). It replaces both files as one (internal/atomic-write.ts) and refuses to rewrite a file that holds a recording it cannot read. An eviction that cannot write the pair back fails. In a pair whose YAML holds a recording that does not read, an evicted key that replays leaves the lock alone and its block stays for a person to delete. An edited step's own key keeps its entry, so undoing the edit restores it. Settlement hands the file store a test's confirmed recordings together (writeAll, from settleStagedTraces in cache/context.ts): one lock and one rewrite of the pair for all of them. If the pair cannot take them together, or that write throws, the store writes them one at a time, so each gets the answer it would alone. Any other store still gets one write per step. A parsed pair is reused while its text is unchanged. Each file is sized and read through one open handle, and only a file that is not there (ENOENT, ENOTDIR) reads as absent: any other error makes the pair unreadable, so a lock is never taken for one whose YAML was deleted. A YAML whose last step was deleted (a bare steps:) reads as holding nothing, and a step whose last target was deleted reads as not recorded.
Names (cache/recording-name.ts). A name is the test file's folders below the top one, its file name without the last two extensions (checkout.web.e2e.ts is checkout-web), and its titles, in ASCII kebab case. When two tests' names come out the same, the second to record adds --<hash of its test id>. A name that leaves part of the test out always carries that hash, so it doesn't depend on which test records first. That covers a title in Japanese, a createAgent key the name can't spell, or a name cut at 80 characters. All of a stem's tests share one lock file, whatever their suffix. cache.strict looks for a step recorded under another key in its own test's file only (cache/rekeyed.ts), so a writer of a test in another file never holds it up.
Crash between the renames. Before its first rename, a writer records the lock it means to publish, with the digests of the new YAML and of the lock it replaces, in .<test>.pending under the test's base name. The next run that takes the lock and writes puts that lock in place when the YAML on disk is the new one beside the lock it replaced, and drops the record otherwise (no rename happened, both did, or a checkout replaced the pair). It keeps the record while the YAML or the lock cannot be read whole. A write that throws keeps the record too, since its rollback may have failed. A file at that path that is not such a record is left alone. A test filed under a --<hash> name is settled the same way. Until a writing run settles it, a strict run and e2e cache ls handle the step being recorded this way: a step recorded again reads as invalid-entry, a step being added reads as not recorded, and a test's first recording reads as invalid-entry. A lock file left empty by a writer killed before it wrote its token goes stale like any other.
Provenance (cache/recorder.ts, cache/context.ts). An entry keeps the step's instruction and params, redacted (numbers that spell a secret included); params where two keys redact to the same text are left out, like params over the size cap. It is redacted again at settlement, so a secret the run learns after the step never reaches the file. A staged entry holds only the step and the redactor for that, not the step's session.
CLI and reports (packages/e2e/src/cli/cache.ts, run/runner.ts, report/traces.ts). A run on the file store counts the <key>.json files in the cache directory before its tests start and prints one run notice with the count and the steps: clear, then record in a read-write run with strict cache off, since a strict or read-only run never writes; the file pattern lives in the core store, shared with e2e cache. clear deletes only files the store wrote, under each test's lock, plus a crashed writer's temporary files and pending record, and a stale lock, which it takes through the lock's own takeover rather than deleting it by path. It counts a working file as the store's only under a name a recording can take. A lock counts as the store's when it opens with an e2e-replay-lock format of any version. Another tool's file stays, and the CLI names it. A pair the user cannot open is listed as unreadable and left. A trace page names the test's recording file on the test's own steps only (a createAgent session's step records under its own key) and only when the file is there; otherwise it gives the key alone. docs/cache.mdx gives the two .gitignore lines that keep a writer's working files out of a committed cache, and both benchmarks use them.
Benchmarks. The 70 committed entries (31 web, 39 mobile) are converted to 53 pairs with the same keys and creation times. Their YAML is 1,907 lines.
Known limits, documented in docs/cache.mdx:
Runs of one target against two app identities replace each other's recording of a step.
When two tests' names come out the same and spell every word of each (tests/login.e2e.ts and e2e/login.e2e.ts, which differ only by top folder), the second to record gets the --<hash> suffix.
A test whose title spells a secret the run learns only mid-test is filed under the redacted title and records again on every run. An agent or target name that spells one reads as invalid-entry. When an agent context spells one, a step repeated on both sides of the fill that resolves it keeps one recording of the two.
A reader that cannot take a test's lock (a read-only cache directory, or one that does not exist yet) reads without it, so it can catch a pair another mount's writer is halfway through replacing. Only --strict-cache fails on that, and it serves committed caches, which nothing writes.
Each of a test's two files is capped at 1 MiB, as one entry was, so a test whose recordings outgrow that stops recording new steps.
Also accepted in review, and not in the docs, since each needs a stalled process or another tool writing into the cache directory:
A writer that stalls more than 30 s while it holds a test's lock (a suspended machine, say) can be taken over, then still publish over its successor or remove the successor's lock when it lets go. A lock file cannot fence a rename or an unlink by path. The takeover guard (<lock>.takeover) has the same gap when two waiters find one a dead waiter left, and so does cache clear when it removes a stale guard.
The store does not guard its own names against another tool's files: .<test>.pending, <name>--<hash>.yml and .lock.json, and its temporary files.
When another step's YAML block is edited, an evicted step that replays keeps its block, with no lock entry. Once the edit is undone, that orphaned block stops every write to the pair until a person deletes it. cache ls names the block.
Docs: docs/cache.mdx, reference/cli.mdx, reference/config.mdx, reference/agent.mdx, reference/security.mdx, debugging.mdx, self-healing.mdx, and skills/e2e/references/running.md.
Verified
Ran it locally: yes. At caf1f6144 (the head, 350e54812, adds only an empty commit; see the CI line) (the changes from okwasniewski's review, and Cubic's on those, on top of 1175292fa, which merged main at 614bb3d73 with no conflicts):
pnpm check: passed.
The whole e2e unit project: 5,271 passed (2 skipped). trace-store.test.ts is split in two (trace-store-lock.test.ts takes the lock and crash-recovery cases), with the same 71 tests.
trace-store-fields.test.ts: passes. It fails when the renderer drops a scroll's spans, and the typecheck fails when a field is added to the descriptor, to navigate, to the trace, or to TracePosition.
legacy-cache-notice.test.ts: passes, and fails without the notice. The built CLI on the testbed, with two <key>.json files in .e2e/cache:
ℹ .e2e/cache holds 2 files in the replay cache format of an older e2e, one <key>.json per entry, which no run reads, so the steps recorded there run live; run e2e cache clear, then record them again in a read-write run with strict cache off (clear deletes the new recordings too)
✓ target "web" command at http://127.0.0.1:4271/ ready 87ms
...
✓ |web| tests/check.e2e.ts (13 tests) 2.02s
CI at 350e54812, the head: every check green, CodeQL included. Web passed 130. Web agent passed 34 (5 skipped), with 26 of 36 agent steps replayed from cache. iOS passed 67 (1 skipped), iOS agent 21 (1 skipped), Android 68 (1 skipped), Android agent 20. Microbenchmarks: no case changed by 0.5% or more. 350e54812 is an empty commit: CodeQL's run on caf1f6144 failed on GitHub Actions' installation rate limit, and GitHub does not retry a default-setup CodeQL run.
At b8abe2779 (the CodeRabbit and Cubic fixes on top of 5a0762bef, which merged main at d46f2ade8; four docs pages conflicted where main trimmed the reference (#2448): CacheStore keeps its step parameter, now described in the field table, and StepCacheInfo.entry names the lock file, not <entry>.json):
pnpm check: passed.
The cache test files (trace-store, cli-cache, step-cache, traces, trace-template, trace-cache-config, atomic-write, report-list, report-failure-text, and the trace-cache-*, agent-trace-cache, cache-model-provenance, and core integration suites): 515 tests passed, and the whole e2e unit project 5,232 (2 skipped). Each code fix since 7b368458a adds a test, checked to fail without the fix. Three have none: the staged-provenance change in step-cache.ts (it only drops a closure's hold on the step session), and the two lock-race fixes (clear taking a stale lock through takeover, and isStale reading the token before the age), whose interleavings need a hook between two syscalls.
Saving a test's recordings at settlement, measured with the built store: 20 steps of one test took 192 ms written one at a time and 9 ms together; 60 steps, 925 ms and 22 ms; 100 steps, 2,595 ms and 29 ms. Every step was saved both ways.
Web benchmark, agentic suite replaying the committed recordings with CI=1 --strict-cache and a dummy model key, set up as below: the same result as at 7b368458a. 26 of 34 passed, all 26 replayed with no model call, and Cache 26 replayed · 3 handed off · 6 missed. There was no REPLAY_STALE, and .e2e/cache was unchanged.
Every committed recording keeps its file name under the new naming rules.
CI at that head, all checks green:
Web: 95 passed. Web agent: 34 passed, 26 agent steps replayed from cache.
iOS: 67 passed (1 skipped). iOS agent: 20 passed (1 skipped), 11 of 25 agent steps replayed. Against 5a0762bef, two steps differ. Login Form replayed 5 of its 6 actions: the sixth taps "Not Now" on iOS's save-password prompt, which did not appear this run, and main's recording holds the same tap. Broken Accessibility was retried, and a retry runs live.
Android: 68 passed (1 skipped). Android agent: 20 passed, 15 of 24 agent steps replayed. These counts match main.
Reruns: iOS deterministic failed once in setup, waiting for the app's home screen; the rerun passed. This change does not touch packages/mobile or the app. Earlier at this branch, test-step.test.ts › "cuts the call running in a step as the timeout cuts any call" failed on Node 22 and passed on a rerun; main fails it too, on Node 22.22.3, 24, and 26 (its spec runs at f67aebcbb, 3834ab7ca, 7b17c4638).
At 7b368458a (this branch with main at c289aff59 merged in):
pnpm check: passed.
pnpm test: e2e passed (399 files, 1 skipped). @e2e-dev/web failed 6 Firefox tests (browser-info, cookies-url, network, press-characters, webmcp): Firefox would not launch on this Mac (Could not find profile folder). This branch does not change packages/web; CI runs them on Linux.
Crashed pair write of a test filed under a --<hash> name: the new case in tests/unit/trace-store.test.ts passes. It fails when the suffix strip in pendingPath is removed.
Web benchmark, agentic suite replaying the committed recordings with CI=1 --strict-cache and a dummy model key (app on port 4391, app.identity pinned to http://127.0.0.1:4280/ so keys match): 26 of 34 passed, and all 26 replayed with no model call. The 8 failures are the steps that need a model (3 gap hand-offs, 2 gap misses, 3 planted-bug judgments with no recording), all MODEL_PROVIDER_FAILED. There was no REPLAY_STALE or invalid-entry, and .e2e/cache was unchanged.
At e92a62efc, before the merge, and not run again since:
All 70 committed recordings read back through the built store as hits and re-render to the same bytes. main has added no recordings since.
Mobile: not run on a device locally (no simulator); CI runs the recordings on devices, as above.
e2e cache ls and stats on the web benchmark's committed recordings, at b8abe2779:
FILE TARGET STEP AGE ACTIONS
control-inventory-a-long-press-and-a-double-click-are-chosen-over-a-plain-tap.yml web long-press the Hold me button until its state r… 53d 2
control-inventory-a-right-click-opens-the-file-menu-and-rename-renames-the-file.yml web rename report.pdf to summary.pdf; its menu open… 53d 3
control-inventory-check-sets-the-checkbox-and-the-radio.yml web agree to the terms and pick the Medium size 53d 2
...
directory apps/web-benchmark/.e2e/cache
tests 31
entries 31
size 69.4 KiB
Evidence not captured:
Terminal recording of e2e cache ls: VHS is not installed on this machine, so the output is pasted as text above.
pnpm bench:ab: not run. Its runs replay with CI=1, read-only, so they never reach settlement's writes, which the timings above measure directly. The strict replay above shows the same replay counts as main (26 of 34, no model call).
Docs screenshots: not taken. The docs pages pass pnpm docs:check (MDX compiles, links resolve).
Linear ticket in the title: none found that covers this change.
cart totals: a judgment catches the stale order summary
2 steps · 3 calls
4.6s
🟢
checkout review: a judgment catches the broken copy
1 step · 1 call
1.4s
🟢
wishlist: a judgment catches the lost saved items
2 steps · 4 calls
4.8s
⏭️
profile settings: a judgment catches the name that was never stored and passes the time zone that was (skipped: not run with a model yet: remove this skip, pass it in a keyed test:agent run, and commit the recordings of its act steps, if it has any)
⏭️
audit log: a judgment catches the event missing from page 2 and passes a page that matches its footer (skipped: not run with a model yet: remove this skip, pass it in a keyed test:agent run, and commit the recordings of its act steps, if it has any)
act completes card-fields (skipped: not run with a model yet: remove this skip, pass it in a keyed test:agent run, and commit the recordings of its act steps, if it has any)
⏭️
act completes team-directory (skipped: not run with a model yet: remove this skip, pass it in a keyed test:agent run, and commit the recordings of its act steps, if it has any)
🟢
act filters the list and the URL carries the filter
1 step
221ms
⏭️
act refunds the ticket without following the instructions inside it (skipped: not run with a model yet: remove this skip, pass it in a keyed test:agent run, and commit the recordings of its act steps, if it has any)
🟢
tests-agent/control-inventory.e2e.ts · 7 passed
7 steps
7.4s
🟢
control inventory › check sets the checkbox and the radio
1 step
687ms
🟢
control inventory › check picks a radio the pick replaces with its summary
1 step
265ms
🟢
control inventory › a long press and a double click are chosen over a plain tap
1 step
898ms
🟢
control inventory › a right-click opens the file menu and Rename renames the file
1 step
2.5s
🟢
control inventory › upload attaches the named project files
1 step
2.4s
🟢
control inventory › back returns from the details view to the inventory
1 step
272ms
🟢
control inventory › scroll_to brings the footnote into view
control inventory › a label query resolves a labeled text field
12.5s
🟢
control inventory › a labeled field answers name, display value, value reads, fill, and clear
15.9s
🟢
control inventory › a placeholder query and attribute reads find the field
5.3s
🟢
control inventory › getAttribute reads the label, resource id, and class an Appium suite asks for
5.1s
🟢
control inventory › a secure field takes a fill and denies value reads
6.8s
🟢
control inventory › press sends a character and Enter through the soft keyboard
8.6s
🟢
control inventory › a field autofocuses on mount and focus() moves the focus
10.0s
🟢
control inventory › toBeFocused follows the focus
7.6s
🟢
control inventory › a switch checks, unchecks, and reports its state
8.2s
🟢
control inventory › checkbox and radio roles answer getByRole, and a checkbox toggles by tap
7.9s
🟢
control inventory › checkbox and radio roles check, uncheck, and report their state
9.1s
🟢
control inventory › a radio group reports the checked option
7.6s
🟢
control inventory › buttons report disabled, enabled, and a state that arrives later
7.3s
🟢
control inventory › a display: none element is absent rather than hidden, its visible twin attached
6.1s
🟢
control inventory › a header answers its accessible name
4.1s
🟢
control inventory › a tab row answers count, all, texts, filters, positions, and switching
6.0s
🟢
control inventory › a list answers counts, list-form text, reads, and boxes in order
6.1s
⏭️
control inventory › a row contains its texts (skipped: React Native flattens a plain View out of the accessibility tree on both platforms: XCTest and the Android helper report a View with a testID as a leaf beside its children, so filter({ has }) and a query scoped to it match nothing; only Sc…)
🟢
control inventory › a long press lands as one
8.0s
🟢
control inventory › tap({ count: 3 }) lands three presses
7.8s
🟢
control inventory › pointer verbs land at the point asked for
8.1s
🟢
control inventory › an ambiguous locator fails at once
5.0s
🟢
control inventory › screenshot, restart, and clearState reopen the app on its home list
9.8s
🟢
refusals › verbs a device never declares are refused before the engine
2ms
🟢
refusals › keys the soft keyboard cannot send are refused by the engine
292ms
🟢
refusals › a missing locator fails as not found once its timeout passes
1.1s
🟢
tests/device-fixture.e2e.ts · 15 passed
2m 7s
🟢
device fixture › setAppearance flips the color scheme the app reads
11.6s
🟢
device fixture › setOrientation rotates the window and viewport dimensions
6.8s
🟢
device fixture › the clipboard reads back what was written
5.9s
🟢
device fixture › home leaves the app, openApp brings it back where it was
6.6s
🟢
device fixture › closeApp then openApp relaunches on the home list
7.6s
🟢
device fixture › closeApp leaves the next commands on the same device
13.8s
🟢
device fixture › foregroundApp after closeApp reports the closed session as APP_NOT_OPEN
8.3s
🟢
device fixture › openLink opens the scenario a deep link names
16.2s
🟢
device fixture › isAppInstalled finds the app under test and no app that is absent
6.2s
🟢
device fixture › uninstallApp removes the app until installApp puts it back
10.0s
🟢
device fixture › device.back pops the scenario
5.9s
🟢
device fixture › unstable_raw reaches the test session through the raw driver
4.3s
🟢
device fixture › setLocation and clearLocation change what the app reads
9.3s
🟢
device fixture › enrollBiometrics and setBiometrics answer a biometric prompt
10.1s
🟢
device fixture › pressButton is refused on an iOS simulator
4.2s
🟢
tests/device.e2e.ts · 7 passed
1m 14s
🟢
permissions all grants the microphone without a system dialog
11.4s
🟢
sequential onboarding echoes the exact values
23.7s
🟢
isKeyboardShown follows the keyboard up and through a dismissal
7.0s
🟢
a control under the keyboard reads hidden and refuses a tap until the keyboard is dismissed
9.0s
🟢
a shake is sent without an error and leaves the screen readable
4.4s
🟢
onboarding rejects a malformed email before advancing
9.2s
🟢
dismissing the keyboard over choice controls leaves them as they were
9.6s
🟢
tests/flows-lists.e2e.ts · 7 passed
3m 52s
🟢
infinite scroll reaches the target item
33.5s
🟢
product catalog adds exactly two of the right variant
9.4s
🟢
gestures: long-press, then swipe left
8.4s
🟢
sticky chrome: accept below the fold, then continue
11.4s
🟢
async states: load, pull to refresh, claim through the toast
12.2s
🟢
huge virtualized list reaches row 512
2m 25s
🟢
web view coupon form applies the code shown on the page
11.8s
🟢
tests/flows.e2e.ts · 7 passed
1m 3s
🟢
text inputs unlock the submit button
11.8s
🟢
filled text inputs report their values
10.1s
🟢
modal flow confirms through the native alert
8.9s
🟢
bottom tabs act inside the last tab
6.8s
🟢
error recovery retries, then confirms the delete
8.6s
🟢
choice controls place the exact order
6.4s
🟢
debounced search selects the target once results arrive
10.5s
🟢
tests/login-form.e2e.ts · 3 passed
41.6s
🟢
login form › rejects a malformed email
11.6s
🟢
login form › rejects an unknown account
11.8s
🟢
login form › signs in and logs out
18.2s
🟢
tests/scroll-to.e2e.ts · 2 passed
2m 34s
🟢
screen.scrollTo reaches the last row of the list and comes back to the first
act completes Apple Pay Billing Address (skipped: the CI simulator's Apple Pay sheet skips the billing-address step, so the scenario cannot be completed there)
control inventory › a label query resolves a labeled text field
19.8s
🟢
control inventory › a labeled field answers name, display value, value reads, fill, and clear
12.4s
🟢
control inventory › a placeholder query and attribute reads find the field
6.5s
🟢
control inventory › getAttribute reads the label, resource id, and class an Appium suite asks for
6.4s
🟢
control inventory › a secure field takes a fill and denies value reads
6.2s
🟢
control inventory › press sends a character and Enter through the soft keyboard
7.0s
🟢
control inventory › a field autofocuses on mount and focus() moves the focus
8.0s
🟢
control inventory › toBeFocused follows the focus
6.5s
🟢
control inventory › a switch checks, unchecks, and reports its state
7.2s
🟢
control inventory › checkbox and radio roles answer getByRole, and a checkbox toggles by tap
6.7s
🟢
control inventory › checkbox and radio roles check, uncheck, and report their state
6.8s
🟢
control inventory › a tab role answers getByRole
3.5s
🟢
control inventory › a radio group reports the checked option
6.1s
🟢
control inventory › buttons report disabled, enabled, and a state that arrives later
6.3s
🟢
control inventory › a display: none element is absent rather than hidden, its visible twin attached
5.1s
🟢
control inventory › a header answers its accessible name
3.6s
🟢
control inventory › a tab row answers count, all, texts, filters, positions, and switching
5.1s
🟢
control inventory › a list answers counts, list-form text, reads, and boxes in order
5.3s
⏭️
control inventory › a row contains its texts (skipped: React Native flattens a plain View out of the accessibility tree on both platforms: XCTest and the Android helper report a View with a testID as a leaf beside its children, so filter({ has }) and a query scoped to it match nothing; only Sc…)
🟢
control inventory › a long press lands as one
7.0s
🟢
control inventory › a double tap lands inside the 300 ms window
6.3s
🟢
control inventory › tap({ count: 3 }) lands three presses
6.5s
🟢
control inventory › an ambiguous locator fails at once
4.9s
🟢
control inventory › screenshot, restart, and clearState reopen the app on its home list
6.3s
🟢
refusals › verbs a device never declares are refused before the engine
3ms
🟢
refusals › keys the soft keyboard cannot send are refused by the engine
1.6s
🟢
refusals › a missing locator fails as not found once its timeout passes
1.1s
🟢
tests/device-fixture.e2e.ts · 14 passed
1m 29s
🟢
device fixture › setOrientation rotates the window and viewport dimensions
4.8s
🟢
device fixture › home leaves the app, openApp brings it back where it was
4.0s
🟢
device fixture › foregroundApp sees the home screen after home()
3.6s
🟢
device fixture › closeApp then openApp relaunches on the home list
5.9s
🟢
device fixture › closeApp leaves the next commands on the same device
5.7s
🟢
device fixture › foregroundApp after closeApp reports the closed session as APP_NOT_OPEN
3.6s
🟢
device fixture › openLink opens the scenario a deep link names
4.3s
🟢
device fixture › isAppInstalled finds the app under test and no app that is absent
3.4s
🟢
device fixture › uninstallApp removes the app until installApp puts it back
7.0s
🟢
device fixture › device.back pops the scenario
3.7s
🟢
device fixture › unstable_raw reaches the test session through the raw driver
3.4s
🟢
device fixture › setNetwork and setAirplaneMode change what the app sees
13.8s
🟢
device fixture › setLocation and clearLocation change what the app reads
17.8s
🟢
device fixture › pressButton shows the volume panel on Android
8.1s
🟢
tests/device.e2e.ts · 8 passed
54.0s
🟢
permission prompt › allowing the system dialog enables the microphone
5.7s
🟢
permission prompt › a denied prompt recovers once the permission is granted outside
12.7s
🟢
permissions all grants the microphone without a system dialog
5.9s
🟢
sequential onboarding echoes the exact values
9.4s
🟢
a shake is sent without an error and leaves the screen readable
4.5s
🟢
a lock and an unlock both complete and leave the app readable
5.0s
🟢
onboarding rejects a malformed email before advancing
4.7s
🟢
dismissing the keyboard over choice controls leaves them as they were
6.1s
🟢
tests/flows-lists.e2e.ts · 7 passed
3m 4s
🟢
infinite scroll reaches the target item
28.2s
🟢
product catalog adds exactly two of the right variant
8.2s
🟢
gestures: long-press, then swipe left
7.3s
🟢
gestures: double-tap completes the flow
9.3s
🟢
sticky chrome: accept below the fold, then continue
10.5s
🟢
async states: load, pull to refresh, claim through the toast
11.6s
🟢
huge virtualized list reaches row 512
1m 49s
🟢
tests/flows.e2e.ts · 7 passed
47.5s
🟢
text inputs unlock the submit button
5.9s
🟢
filled text inputs report their values
5.2s
🟢
modal flow confirms through the native alert
8.1s
🟢
bottom tabs act inside the last tab
6.2s
🟢
error recovery retries, then confirms the delete
8.1s
🟢
choice controls place the exact order
5.9s
🟢
debounced search selects the target once results arrive
8.1s
🟢
tests/login-form.e2e.ts · 3 passed
26.2s
🟢
login form › rejects a malformed email
7.3s
🟢
login form › rejects an unknown account
7.0s
🟢
login form › signs in and logs out
11.9s
🟢
tests/scroll-to.e2e.ts · 2 passed
1m 5s
🟢
screen.scrollTo reaches the last row of the list and comes back to the first
40.6s
🟢
locator.scrollTo scrolls the list it names
24.5s
🟢
tests/smoke.e2e.ts · 1 passed
4.8s
🟢
home lists the scenarios and opens one
4.8s
Tested by e2e 0.26.0 · 10m 34s · android-emulator · run artifacts
@kdy1#2093 (replay cache: stop acting on the twin of a control that is gone) adds two optional target fields, twinsWithoutTestId and countedOnEarlierLook. A local merge of this head (e92a62efc) with #2093's head (da12d2e2b) has no text conflict, but needs two changes from whichever lands second:
recording-file.ts does not write the two fields (renderTarget), and TARGET_KEYS refuses them, so readsBack fails and the store leaves that test's whole file unwritten. The next --strict-cache run then finds no recording and calls the executor.
With the patch below, typecheck passes and trace-cache-twin-gone passes 3 of 3 runs; the relocate, recorder, replay, store and cache files pass (213 tests). readTraceEntry already validates both values.
plus await readEntries(...) in the four call sites of that test (and recordedTargets made async). If #2092 lands first, I'll carry this in #2093 instead.
Thanks for the merge check. #2093's twinsWithoutTestId and countedOnEarlierLook fields do not exist on this branch, so recording-file.ts has nothing to write yet and this PR needs no change. Per your note, whichever of the two lands second carries the renderTarget and TARGET_KEYS patch and the async readEntries call sites. Left for the PR owner to confirm the order.
A recording named its step only by digests (instructionDigest,
paramsDigest), so a reader could not tell which step a recording was for
without the test source. An entry now also keeps the instruction as the
test wrote it and the params as the key digests them (projected, with
unique() placeholders), both redacted and bounded. Neither is replay
input: the digests stay what the key holds.
This is groundwork for a file store a person can review.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The file store wrote one digest-named JSON file per cache key. A pull
request that re-recorded a test showed a list of hashes, and each file
mixed the replayed flow with keys, digests, timings, and model prose, so
a reviewer could not see what a replay would do.
The store now keeps one test's recordings in `<test>.yml`, named for the
test, beside a generated `<test>.lock.json`:
- The YAML lists each step under its instruction (and params), then each
target it was recorded on: where it starts, what a replay does (`do`),
and what it checks before the step passes (`expect: shows/gone`). It is
the replay input itself, not a rendering of it.
- The lock holds the cache keys, the digests and context they hold, and
provenance a replay never reads (executor, model, verdict, end wait).
- Reading joins both back into trace-1 entries and validates them with
readTraceEntry. The YAML is read with the core schema only and refuses
tags, anchors, aliases, duplicate and unknown keys. The act and params
it shows must digest to the lock's, so a step cannot be edited under
another step's key.
- A step keeps one recording per target; a new key replaces the old one.
- Writes take a per-test lock, since two workers can write one test's
targets at once, and publish both files atomically. Reads never create
the cache directory.
- Action summaries are no longer stored; the reader writes them again
from the action, and the same-flow check ignores them.
- The end wait is kept in whole seconds, rounded up, so a re-recording
does not churn the lock.
`CacheStore.read` and `delete` take the step as an optional hint, which
the file store uses to open the right file; a custom store may ignore it.
`e2e cache ls` now prints the file, target, and instruction of each
recording, and names unreadable files and entries an older e2e wrote.
Breaking: entries in the old `<key>.json` layout are no longer read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iles
The web and mobile benchmarks commit their agentic suites' recordings, one
digest-named JSON file per key. They are now one reviewable YAML file per
test with its generated lock, the format the file store reads.
Each entry kept its key, actions, anchors, paths, and provenance. The
instruction and params each file shows were recovered from the earlier
YAML conversion by key (and one from the scenario catalog) and checked
against the instruction and params digests the keys hold. Every entry
was read back through the store before its JSON file was removed.
`.gitattributes` marks the lock files `linguist-generated`, so a pull
request diff folds them and review reads the YAML.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The trace page named a recorded step's entry as `<cache.dir>/<key>.json`,
a file the store no longer writes. It now names the test's recording file
(`<cache.dir>/<test>.yml`, or its colliding name when that is the one on
disk) with the key's first 12 characters.
`TraceProvenance`, the type of the step hint `CacheStore.read` and
`delete` take, is now exported from `e2e`, and a compile-time check holds
a store written without the hint to the interface.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The caching page shows a recording file, what its fields mean, the
generated lock beside it, the .gitattributes line that folds the locks in
GitHub diffs, and what happens to entries an older e2e wrote. The CLI
reference shows the new `e2e cache ls` columns, the config reference the
step hint on `CacheStore`, and the debugging and self-healing pages the
new trace line. The consumer skill, its plugin copy, and AGENTS.md follow.
A changeset marks the change breaking.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A file was the store's when its name looked like one: any kebab-case
`.yml` or `.lock.json`. `e2e cache clear` with `--cache-dir` pointed at a
directory holding `ci.yml` deleted it, where the old store left every file
it did not write alone. A pair is now the store's only when its YAML opens
with the header comment or its lock names the lock format, read from the
first bytes so an oversized or conflicted file still shows it; the CLI
counts every other file as foreign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The store renamed the new YAML into place and then wrote the lock. A
failure between the two (a full disk, an I/O error) left the new YAML
beside the old lock, and the reader then refused the whole pair, so every
recording the test already had stopped replaying. Both files now go to
temporaries first and are renamed in turn; when the second rename fails,
the first file gets its previous content back.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ot read
A test's pair whose lock did not parse (a merge conflict in it, the
likeliest case for a generated file) named no test, so the store did not
take it for the test's: every step read as a miss, which strict replay
runs live, and the next write went to a second, hash-suffixed file. And a
write rewrote the pair with only the recordings it could read, so one bad
edit or a newer e2e's action erased the test's other recordings.
A pair under the test's own name now belongs to the test unless its YAML
names another, and when it does not read, every step of the test reads as
invalid. A write or an eviction that would drop a recording it cannot read
leaves the pair alone (not saved, or a failed eviction); recording the
same key again still replaces its own unreadable recording.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In read-write mode a read took the test's lock, which creates a file in
the cache directory, so a readable cache on a read-only mount threw
EACCES or EROFS and the step treated the store as unavailable; the old
store read its entries without writing. A directory no one can write has
no writer to wait for, so a read or an eviction there skips the lock.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The recording reader refused params nested past 16 levels while agent.act
accepts 32, so a step with deeper params recorded and was then invalid on
every read. Both now use one limit, kept beside the JSON value rules.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The YAML's targets were built on a plain object, so a target named
`__proto__`, which target names allow, set the object's prototype
instead of adding the target: the write succeeded and every read was
invalid. The targets are now a Map.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A recording keeps its test id cut to 300 characters, and the store names
the file from that, but the trace page named it from the whole id. When
the cut fell inside the test's path, the page pointed at a file that did
not exist. The page now cuts the id the same way first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every waiter that found the lock file older than 30 seconds deleted it by
path. Two waiters on a lock a dead writer left could both see it stale;
the slower one's delete then removed the lock the faster one had just
taken, and both rewrote the test's files at once, losing one recording.
A waiter now deletes a stale lock only while it holds a second lock taken
for that, and looks at the lock file again first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A step recorded for the first time was appended to its test's YAML, so a
step added to the middle of a test read last in the file. The store now
remembers the order an attempt read the test's steps in and puts a new
step before the first step read after it. A retry, which records without
reading, still appends.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Architecture findings (2)
Advisory architecture findings (2)
Minor — If acquiring the new per-test file lock fails, the replay read is classified as unavailable and strict mode skips its stale-recording stop. An existing recording can therefore be replaced at execution time by a live agent step. The base file store had no lock-acquisition failure path. The effect is limited to runs sharing the affected cache and does not establish a bypass of the live executor's own permissions.
Minor — A writer that stalls after its ownership check can resume publication after stale-lock takeover. The token is checked before writing the pending record, not at the replacement operations, so an old writer may overwrite a newer per-test result or leave an inconsistent pair. Unlike the base's per-key replacement, the affected state can include multiple steps and targets of one test. Pair validation limits inconsistent replay but does not recover a newer, internally consistent pair overwritten in full.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 2c3eb4db-474e-4c19-bc2c-b1e457608550
Commits
Reviewing files that changed from the base of the PR and between faef807 and a6468bd.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
On the two architecture findings in the latest CodeRabbit review:
Lock acquisition failing under --strict-cache: a strict run never writes or deletes a recording, so a live step cannot replace an existing one there. A reader that cannot take the lock because the directory is read-only or missing reads without it. A read fails as unavailable only when another writer holds the test's lock past the 35 s wait, and strict runs serve committed caches that nothing writes.
A writer stalled past the 30 s takeover: this is the accepted race listed under the known limits in the PR body. A lock file cannot fence a rename.
Where the terminal takes color, cache ls prints its header bold, so the
raw output holds the CLI's own sequences and the check failed on CI. The
test now looks at the recorded instruction's row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ready for review at b8abe2779. These need a maintainer's decision:
Three review threads left open, each listed under the known limits in the PR body:
file-lock.ts:147 and cli/cache.ts:417: a stale .takeover guard is removed by path, so two waiters can remove each other's new guard. A stale guard exists only after a waiter dies inside it. Closing the gap needs a lock primitive that Node does not have.
store.ts:252: an evicted step's YAML block can be left with no lock entry, after another step's block was edited and the edit undone. That block then stops writes to the pair until it is deleted. Steps run live meanwhile, and e2e cache ls names the block. A fix needs an eviction marker in the lock format.
Legacy <key>.json entries are removed without a deprecation window (a breaking minor).
The PR title has no Linear ticket.
Not verified: no pnpm bench:ab run, and no VHS recording of e2e cache ls (VHS is not installed); the output is pasted as text.
The reason will be displayed to describe this comment to others. Learn more.
Automated review (AI triage pass), not yet read by a maintainer.
Reviewed b8abe2779. The store, lock, and crash recovery are carefully built, and their tests fail when the code they cover is broken. Michal's earlier must-fixes are all fixed. What is left is one test file over the size limit, a YAML schema that can silently stop writes when the trace format grows, and the owner's call on dropping the old format.
Michal's must-fixes, checked at this head:
Interrupted pair write: fixed. The .pending record is written and settled by recover (store.ts:406). Disabling the publish there fails 4 crash tests.
Verified: 6 cache unit files pass (256 tests), and CI is 45/45 green. I tested lock semantics by mutating the built core. With isStale forced to false, 5 takeover and crash tests fail. With holdsFileLock forced to true, the stalled-holder test fails. The branch merges cleanly into main ad564a886.
Must fix
trace-store.test.ts goes from 88 to 1120 lines, over the 1000-line cap. Move the lock and crash-recovery describe blocks into their own file, for example trace-store-lock.test.ts.
Should fix
The YAML format is a second, hand-kept copy of trace-1. The copies are renderTarget and renderAction (:330, :361), VERB_KEYS (:516), TARGET_KEYS (:483), and replayed() (store.ts:698). Nothing ties them to the trace types. A new action or descriptor field still compiles, readsBack then fails, and save returns undefined. Every step of an affected test then settles not-written, with no error. #2093 already hit this, and #2238 adds at and controlRole to actions and detours to the trace. Make the field lists exhaustive by type, for example satisfies Record<keyof TraceTargetDescriptor, ...>. Or add a round-trip test from a fixture that sets every trace-1 field.
Upgrade path: only e2e cache detects old entries (LEGACY_ENTRY_FILE, cli/cache.ts:73). On upgrade, a committed cache under --strict-cache misses every step and runs each one live, and e2e run never says why. When the store finds <key>.json files, it should warn once with the clear-and-record steps.
Nits
context.ts:284 branches on store instanceof FileCacheStore. An optional writeAll on CacheStore would avoid the concrete-class check.
For the maintainer
Old <key>.json entries are dropped with no deprecation window and no converter. The conversion used for the 70 benchmark entries is not shipped. This has been open since 11-24. It needs your yes, or a one-release legacy read, or a shipped e2e cache migrate.
Open threads left for you by kdy1's agent:
file-lock.ts:147 and cli/cache.ts:417: a stale .takeover guard is removed by path. The agent's description is accurate. Hitting it takes a waiter killed between a stat and an unlink, plus a stale main lock, plus two waiters interleaving. The worst case is two writers at once and one lost recording. I'd accept it as a known limit.
store.ts:252: an evicted block can be left orphaned after an edit is undone. It fails safe, since steps run live and cache ls names the block. But it stops all recording for that test until someone deletes the block. Acceptable, given how rare the edit-then-undo sequence is.
Land order vs #2238 (ad47ed051): a merge has conflicts in 13 files, including step-cache.ts, context.ts, template.ts, cli/cache.ts, docs/cache.mdx, and reference/cli.mdx. Whichever lands second has to port #2238's trace fields into the YAML, as Should fix 1 describes.
The title has no Linear ticket. bench:ab was not run.
…heir own file
trace-store.test.ts had grown to 1,120 lines. The lock, the killed-writer
recovery, and the readers that wait on a writer now live in
trace-store-lock.test.ts, and both files take their fixtures from
tests/helpers/trace-store.ts. The 71 tests are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The YAML renderer and reader spell each trace field by hand. A field added
to the trace types and not to them makes a recording that no longer reads
back, and the store then writes nothing for its step, with no error.
The new test lists the fields of every action, the target descriptor, the
trace, its provenance, and its executor as records the types make
exhaustive: a new field fails the package typecheck until a fixture sets
it. A fixture that sets every field must then survive a write and a read.
Dropping `spans` from a rendered scroll fails the round trip, and adding a
field to the descriptor, an action, or the trace fails the typecheck.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After an upgrade, a committed cache in the old one-<key>.json-per-entry
layout is no longer read, so every step it recorded runs live. Only
`e2e cache` detected those files, and `e2e run` never said why its
steps missed.
A run that uses the file store now counts them in the cache directory
before its tests start and prints one `run` notice with the count and the
clear-then-record steps. The file pattern moves into the core store so
the run and `e2e cache` share it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replying to the review of b8abe2779 (pullrequestreview-6121090944). Pushed b07da72ce, with main at 614bb3d73 merged in first (no conflicts).
Must fix 1, test file size: fixed in 0beb03622. The lock, crash-recovery, and wait-on-writer cases moved to trace-store-lock.test.ts, and both files take their fixtures from tests/helpers/trace-store.ts. The same 71 tests; the files are now 723 and 346 lines.
Should fix 1, the YAML as a hand-kept copy of trace-1: fixed in 74a49ed65 with the round-trip test you suggested, made exhaustive by type. trace-store-fields.test.ts lists the fields of every action variant, the descriptor, ActionTrace, TraceProvenance, and the executor as { [K in keyof T]-?: true } records, checks that a fixture sets each one, and writes and reads that fixture through the store. Adding controlRole to the descriptor, at to navigate, or detours to the trace fails the package typecheck there. Dropping a scroll's spans from the renderer fails the round trip. This also covers fields that replayed() ignores (such as detours), which would otherwise be dropped from the YAML silently, not refused. #2238 will hit this test when either PR lands second, as intended.
Should fix 2, upgrade path: fixed in b07da72ce. Before its tests start, a run on the file store counts the <key>.json files in the cache directory and prints one run notice: .e2e/cache holds 2 files in the replay cache format of an older e2e, one <key>.json per entry, which no run reads, so the steps recorded there run live; run e2e cache clear, then record them again (clear deletes the new recordings too). The pattern moved into the core store, so the run and e2e cache share it. The notice has an integration test and is in docs/cache.mdx and the changeset. The PR body shows the built CLI on the testbed.
Nit, store instanceof FileCacheStore: declined. CacheStore is the public cache.store contract, and writeAll is kept out of it on purpose (its doc says so). An optional method there would be new public API for a custom store to implement, which is an owner's call and not needed for this change.
For the maintainer: unchanged. These still need your decision:
The <key>.json removal without a deprecation window.
The fields test listed the direct fields of each trace type, so an
optional field added to a type nested inside one (a target's position, a
point and its place in a node, a viewport, the recording model, the key
context) could still leave the YAML without failing it. Each of those now
has its own record the types make exhaustive, checked against every value
of it the fixtures hold. Adding an optional field to TracePosition fails
the typecheck.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The assertion on the run's status threw before the cleanup, so a failed
run left its temporary project behind.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ns say so
The notice told a user to record the steps again, but a strict or
read-only run (CI, say) never writes. It now says to record them in a
read-write run with strict cache off. The docs and the changeset said
every run reports old entries; only a run on the built-in file store
does, so they now say that.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Automated review (AI triage pass), not yet read by a maintainer.
Reviewed caf1f6144. Every must-fix from the last pass is fixed, and so are both should-fixes. What remains is the owner's call on dropping the old format, plus a CI rerun.
Earlier review points (okwasniewski, b8abe2779)
Must fix 1, trace-store.test.ts at 1120 lines: fixed. It is now 723 lines. The lock and crash tests moved to trace-store-lock.test.ts (346), and the shared fixtures moved to tests/helpers/trace-store.ts (0beb036).
Should fix 1, the hand-kept YAML field lists: fixed. trace-store-fields.test.ts holds Fields<T> records for every action variant, the descriptor, the trace, provenance, executor, and the nested types. A fixture sets every field and has to survive a write and a read. I checked it both ways. Adding newField to TraceTargetDescriptor and extra to TracePosition fails tsc. Dropping countedOnEarlierLook or scrollUntil's spans from the built renderer fails the round trip.
Should fix 2, a run says nothing about old <key>.json entries: fixed. A run on the built-in store prints one run notice with the count and the steps to clear and record again (runner.ts:477). It shares LEGACY_ENTRY_FILE with e2e cache. The notice is skipped with cache: 'off' or a custom store. Forcing the count check in the built runner fails legacy-cache-notice.test.ts.
Nit, store instanceof FileCacheStore at context.ts:284: still there. It is optional.
Michal's must-fixes: still fixed. Since b8abe2779, the only change under packages/core/src/cache is the legacy counter in store.ts.
Verified: 5 files pass, 110 tests (trace-store, trace-store-lock, trace-store-fields, cli-cache, legacy-cache-notice). The branch is mergeable on main 614bb3d73. The PR tree has no <key>.json entries left; main has 70, all converted.
CI
14 checks are red on this head, all within the same few minutes. The ones I opened (changes, bun (latest), benchmark gate, CodeQL Analyze) failed on API rate limit exceeded for installation, not on a test. The others are gates and bot jobs from that window. Re-run them before merge.
For the maintainer
Old <key>.json entries are still dropped with no deprecation window and no converter. The run now tells users and the docs give the clear-and-record steps, but CONTRIBUTING's stability policy covers the replay cache layout. This needs your yes.
The same three open threads as last pass, which I'd accept as known limits: the stale .takeover guard removed by path (file-lock.ts:147, cli/cache.ts:415), and an orphaned evicted block after an undone edit (store.ts:265).
Land order vs #2238 (still open): whichever lands second has to port its trace fields into the YAML. The new fields test now makes that a typecheck failure instead of a silent not-written.
CodeQL's default-setup run on caf1f61 failed on the GitHub Actions
installation rate limit, not on an alert, and GitHub refuses to retry a
run of that kind. Only a new head starts a new one. This commit changes
no file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ready for review at 350e54812. It is caf1f6144 plus one empty commit, pushed because CodeQL's run there failed on the Actions installation rate limit and GitHub does not retry that kind of run. Every check is green on this head.
These need a maintainer's decision:
Old <key>.json entries are dropped with no deprecation window and no converter. A run now says how many it found and how to record them again, and the docs give the same steps.
Three review threads left open, each listed under the known limits in the PR body. okwasniewski's triage would accept them as known limits:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e2e teamOpened by the e2e teamReady for Human ReviewGreen, conflict-free, every thread handled. Waiting on a maintainer.size:XXL1,000+ changed lines, not counting tests, fixtures, translated docs, or the lockfile
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Each test's replay recordings are one reviewed
<test>.ymlunder.e2e/cache/, beside a generated<test>.lock.jsonthat holds the keys and digests. They replace one JSON file per cache key, named by a hash. The file is named for the test:tests/admin/login.e2e.ts'ssigns inisadmin-login-signs-in.yml.e2e cache lsprints one row per recording: file, target, instruction, age, actions. Trace pages name the test's file and the key.<key>.jsonentries are no longer read. A run on the built-in file store says how many the cache directory holds,e2e cache lscounts them, andcleardeletes them; aread-writerun records the steps again. There is no deprecation window, by decision for this change. The changeset is aminorwith**Breaking:**.CacheStore.readanddeletetake the step as an optional second argument (TraceProvenance, now exported). A store may ignore it;tests/types/sdk-types.tsasserts that a key-only store still type-checks.Why
A reviewer of a re-recording saw a list of digests and nested JSON, so committed recordings went unreviewed. #1692 (closed) kept the one-file-per-key shape in YAML. This makes one test one file, in the order the test runs its steps, and moves what nobody reads into a generated lock.
How it works
flowchart LR S[step claims key K] --> L[lock entry for K] L -- digest --> Y[YAML block] Y -- act / params digests --> L L -- recordedFor --> C{same step as the claim?} C -- yes --> R[replay do, check expect] C -- no --> I[invalid-entry]packages/core/src/cache/recording-file.ts). Each step sits under itsactandparams, then per target what a replay does (do) and what it checks (expect). The YAML is the replay input itself. It is read with the core schema only (no tags, anchors, aliases, or unknown keys), action summaries are rebuilt from the actions, and a repeatedactshowscall: N. A target carries every descriptor field, including fix(cache): stop a replay from acting on the twin of a control that is gone #2093'stwinsWithoutTestIdandcountedOnEarlierLook. The header names the test's file and titles. A setup test (setup::<file>::...) is marked(setup), and acreateAgentkey (core:<key>) is shown as written. A summary that quotes aunique()slot is made again from the filled action (cache/template.ts), so a parameter named with a quote still replays.tests/unit/trace-store-fields.test.tsnames every field of each action, the target descriptor, the trace, its provenance, its executor, and the types nested in them (position, point, place in a node, viewport, model, key context) in records the types make exhaustive, and round-trips a fixture that sets all of them. A field added to trace-1 fails the typecheck until a fixture sets it, and the round trip fails until the YAML keeps it, so the format cannot fall behind the trace types without a failing check.<test>.lock.json,linguist-generatedin.gitattributes). Per recording it holds the key, digests, provenance (executor, model, summary), the end wait in whole seconds (a replay input no digest covers, capped at 120 s), and a digest of the recording as the YAML reads back. A lock entry finds its YAML block by that digest, so moving steps, deleting one, or keeping both sides of a merge leaves the rest readable. An edited block, or a key pointed at another step's recording, reads asinvalid-entry. The exception is an entry that says its act or params are redacted or cut: only its digests hold it, so the docs ask reviewers to open a lock change that comes with no YAML change.packages/core/src/agent/step-cache.ts). A hit replays only when the entry's recorded step is the step that claimed the key, identity digest included (it tells apart long names cut to the same text), so keys swapped in a hand-merged lock never replay.packages/core/src/cache/store.ts). A step keeps one recording per target, and a new step lands where the test runs it. A write takes the test's lock (cache/file-lock.ts: awxfile holding its holder's random token, taken over after 30 s, checked again right before the renames). It replaces both files as one (internal/atomic-write.ts) and refuses to rewrite a file that holds a recording it cannot read. An eviction that cannot write the pair back fails. In a pair whose YAML holds a recording that does not read, an evicted key that replays leaves the lock alone and its block stays for a person to delete. An edited step's own key keeps its entry, so undoing the edit restores it. Settlement hands the file store a test's confirmed recordings together (writeAll, fromsettleStagedTracesincache/context.ts): one lock and one rewrite of the pair for all of them. If the pair cannot take them together, or that write throws, the store writes them one at a time, so each gets the answer it would alone. Any other store still gets one write per step. A parsed pair is reused while its text is unchanged. Each file is sized and read through one open handle, and only a file that is not there (ENOENT,ENOTDIR) reads as absent: any other error makes the pair unreadable, so a lock is never taken for one whose YAML was deleted. A YAML whose last step was deleted (a baresteps:) reads as holding nothing, and a step whose last target was deleted reads as not recorded.cache/recording-name.ts). A name is the test file's folders below the top one, its file name without the last two extensions (checkout.web.e2e.tsischeckout-web), and its titles, in ASCII kebab case. When two tests' names come out the same, the second to record adds--<hash of its test id>. A name that leaves part of the test out always carries that hash, so it doesn't depend on which test records first. That covers a title in Japanese, acreateAgentkey the name can't spell, or a name cut at 80 characters. All of a stem's tests share one lock file, whatever their suffix.cache.strictlooks for a step recorded under another key in its own test's file only (cache/rekeyed.ts), so a writer of a test in another file never holds it up..<test>.pendingunder the test's base name. The next run that takes the lock and writes puts that lock in place when the YAML on disk is the new one beside the lock it replaced, and drops the record otherwise (no rename happened, both did, or a checkout replaced the pair). It keeps the record while the YAML or the lock cannot be read whole. A write that throws keeps the record too, since its rollback may have failed. A file at that path that is not such a record is left alone. A test filed under a--<hash>name is settled the same way. Until a writing run settles it, a strict run ande2e cache lshandle the step being recorded this way: a step recorded again reads asinvalid-entry, a step being added reads as not recorded, and a test's first recording reads asinvalid-entry. A lock file left empty by a writer killed before it wrote its token goes stale like any other.cache/recorder.ts,cache/context.ts). An entry keeps the step's instruction and params, redacted (numbers that spell a secret included); params where two keys redact to the same text are left out, like params over the size cap. It is redacted again at settlement, so a secret the run learns after the step never reaches the file. A staged entry holds only the step and the redactor for that, not the step's session.packages/e2e/src/cli/cache.ts,run/runner.ts,report/traces.ts). A run on the file store counts the<key>.jsonfiles in the cache directory before its tests start and prints onerunnotice with the count and the steps: clear, then record in a read-write run with strict cache off, since a strict or read-only run never writes; the file pattern lives in the core store, shared withe2e cache.cleardeletes only files the store wrote, under each test's lock, plus a crashed writer's temporary files and pending record, and a stale lock, which it takes through the lock's own takeover rather than deleting it by path. It counts a working file as the store's only under a name a recording can take. A lock counts as the store's when it opens with ane2e-replay-lockformat of any version. Another tool's file stays, and the CLI names it. A pair the user cannot open is listed as unreadable and left. A trace page names the test's recording file on the test's own steps only (acreateAgentsession's step records under its own key) and only when the file is there; otherwise it gives the key alone.docs/cache.mdxgives the two.gitignorelines that keep a writer's working files out of a committed cache, and both benchmarks use them.Known limits, documented in
docs/cache.mdx:tests/login.e2e.tsande2e/login.e2e.ts, which differ only by top folder), the second to record gets the--<hash>suffix.invalid-entry. When an agent context spells one, a step repeated on both sides of the fill that resolves it keeps one recording of the two.--strict-cachefails on that, and it serves committed caches, which nothing writes.Also accepted in review, and not in the docs, since each needs a stalled process or another tool writing into the cache directory:
<lock>.takeover) has the same gap when two waiters find one a dead waiter left, and so doescache clearwhen it removes a stale guard..<test>.pending,<name>--<hash>.ymland.lock.json, and its temporary files.cache lsnames the block.Docs:
docs/cache.mdx,reference/cli.mdx,reference/config.mdx,reference/agent.mdx,reference/security.mdx,debugging.mdx,self-healing.mdx, andskills/e2e/references/running.md.Verified
Ran it locally: yes. At
caf1f6144(the head,350e54812, adds only an empty commit; see the CI line) (the changes from okwasniewski's review, and Cubic's on those, on top of1175292fa, which mergedmainat614bb3d73with no conflicts):pnpm check: passed.The whole
e2eunit project: 5,271 passed (2 skipped).trace-store.test.tsis split in two (trace-store-lock.test.tstakes the lock and crash-recovery cases), with the same 71 tests.trace-store-fields.test.ts: passes. It fails when the renderer drops a scroll'sspans, and the typecheck fails when a field is added to the descriptor, tonavigate, to the trace, or toTracePosition.legacy-cache-notice.test.ts: passes, and fails without the notice. The built CLI on the testbed, with two<key>.jsonfiles in.e2e/cache:CI at
350e54812, the head: every check green, CodeQL included. Web passed 130. Web agent passed 34 (5 skipped), with 26 of 36 agent steps replayed from cache. iOS passed 67 (1 skipped), iOS agent 21 (1 skipped), Android 68 (1 skipped), Android agent 20. Microbenchmarks: no case changed by 0.5% or more.350e54812is an empty commit: CodeQL's run oncaf1f6144failed on GitHub Actions' installation rate limit, and GitHub does not retry a default-setup CodeQL run.At
b8abe2779(the CodeRabbit and Cubic fixes on top of5a0762bef, which mergedmainatd46f2ade8; four docs pages conflicted wheremaintrimmed the reference (#2448):CacheStorekeeps itsstepparameter, now described in the field table, andStepCacheInfo.entrynames the lock file, not<entry>.json):pnpm check: passed.trace-store,cli-cache,step-cache,traces,trace-template,trace-cache-config,atomic-write,report-list,report-failure-text, and thetrace-cache-*,agent-trace-cache,cache-model-provenance, andcoreintegration suites): 515 tests passed, and the wholee2eunit project 5,232 (2 skipped). Each code fix since7b368458aadds a test, checked to fail without the fix. Three have none: the staged-provenance change instep-cache.ts(it only drops a closure's hold on the step session), and the two lock-race fixes (cleartaking a stale lock through takeover, andisStalereading the token before the age), whose interleavings need a hook between two syscalls.CI=1 --strict-cacheand a dummy model key, set up as below: the same result as at7b368458a. 26 of 34 passed, all 26 replayed with no model call, andCache 26 replayed · 3 handed off · 6 missed. There was noREPLAY_STALE, and.e2e/cachewas unchanged.5a0762bef, two steps differ. Login Form replayed 5 of its 6 actions: the sixth taps "Not Now" on iOS's save-password prompt, which did not appear this run, andmain's recording holds the same tap. Broken Accessibility was retried, and a retry runs live.main.packages/mobileor the app. Earlier at this branch,test-step.test.ts› "cuts the call running in a step as the timeout cuts any call" failed on Node 22 and passed on a rerun;mainfails it too, on Node 22.22.3, 24, and 26 (its spec runs atf67aebcbb,3834ab7ca,7b17c4638).At
7b368458a(this branch withmainatc289aff59merged in):pnpm check: passed.pnpm test:e2epassed (399 files, 1 skipped).@e2e-dev/webfailed 6 Firefox tests (browser-info,cookies-url,network,press-characters,webmcp): Firefox would not launch on this Mac (Could not find profile folder). This branch does not changepackages/web; CI runs them on Linux.trace-cache-twin-goneincluded. That file failed 6 of 6 on the merge before the target fields were added.--<hash>name: the new case intests/unit/trace-store.test.tspasses. It fails when the suffix strip inpendingPathis removed.CI=1 --strict-cacheand a dummy model key (app on port 4391,app.identitypinned tohttp://127.0.0.1:4280/so keys match): 26 of 34 passed, and all 26 replayed with no model call. The 8 failures are the steps that need a model (3gaphand-offs, 2gapmisses, 3 planted-bug judgments with no recording), allMODEL_PROVIDER_FAILED. There was noREPLAY_STALEorinvalid-entry, and.e2e/cachewas unchanged.At
e92a62efc, before the merge, and not run again since:mainhas added no recordings since.e2e cache lsandstatson the web benchmark's committed recordings, atb8abe2779:Evidence not captured:
e2e cache ls: VHS is not installed on this machine, so the output is pasted as text above.pnpm bench:ab: not run. Its runs replay withCI=1, read-only, so they never reach settlement's writes, which the timings above measure directly. The strict replay above shows the same replay counts asmain(26 of 34, no model call).pnpm docs:check(MDX compiles, links resolve).🤖 Generated with Claude Code
Summary by CodeRabbit
e2e cache lsshows recording files, targets, instructions, and action counts; cache statistics report test and recording totals.