Repository navigation
feat(run): keep a timings history that CI can cache - #1639
Conversation
`e2e run` already starts the longest files first, but it read the previous run's durations out of report.json, which a fresh CI checkout never has. Write a small versioned `<output>/timings.json` (timings-1) at the end of every run instead: per target::file milliseconds, smoothed with an exponential moving average, with files that are gone and targets the config dropped pruned. The file is advisory. A missing, corrupt, or schema-invalid file is no history, and an absent one falls back to report.json as before, so a restored cache can reorder files and never change a result. `--timings <file>` moves it. `--last-failed` still reads report.json. Documents the actions/cache recipe for GitHub Actions and the generic restore/save rule in the CI guide. Duration-balanced --shard is left for a separate decision. Refs ENG-1111 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A `--grep`, `--last-failed`, interrupted, or `--repeat-each` run summed only part of a file's tests, or several repeats of them, into the timings history, so a 60 s file could drop to about 40 s after a rerun of one failing test. A file now has a timing only when none of its tests was left out, cut short, or never reached, and repeats past the first do not count. Adds the integration test for the runner wiring. Refs ENG-1111 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
🟢 e2e web agent: 33 passed34 agent steps · 26 replayed from cache · 20 model calls · 88.3k tokens (85% cached) · $0.0054 All 33 tests in 5 files
Tested by e2e 0.23.0 · 1m 27s · web · run artifacts |
🟢 e2e web: 91 passedAll 91 tests in 41 files
Tested by e2e 0.23.0 · 1m 3s · web · run artifacts |
There was a problem hiding this comment.
All reported issues were addressed across 23 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
🟢 e2e android agent: 1 flaky, 19 passed24 agent steps · 15 replayed from cache · 40 model calls
|
| Test | Agent | Time | |
|---|---|---|---|
| tests-agent/scenarios.e2e.ts · 1 flaky, 19 passed | 24 steps · 40 calls | 5m 58s | |
| 🟢 | act completes Login Form | 1 step | 23.3s |
| 🟢 | act completes Infinite Scroll List | 1 step | 20.8s |
| act completes Modal Flow (1 failed attempt first) | 1 step | 14.0s | |
| 🟢 | act completes Bottom Tabs | 1 step | 6.9s |
| 🟢 | act completes Text Input Variations | 1 step | 7.1s |
| 🟢 | act completes Broken Accessibility | 2 steps · 5 calls | 13.2s |
| 🟢 | act completes Vision Only | 2 steps · 1 call | 6.2s |
| 🟢 | act completes Gestures | 1 step · 11 calls | 29.0s |
| 🟢 | act completes Async States | 1 step · 11 calls | 23.1s |
| 🟢 | act completes Debounced Search | 1 step | 6.9s |
| 🟢 | act completes Huge Virtualized List | 1 step | 1m 56s |
| 🟢 | act completes Flattened Registration Form | 2 steps · 1 call | 8.1s |
| 🟢 | act completes Flattened Login | 2 steps · 6 calls | 15.9s |
| 🟢 | act completes Sticky Chrome Target | 1 step | 9.3s |
| 🟢 | act completes WebView Accessibility | 1 step · 5 calls | 14.2s |
| 🟢 | act completes Permission Prompt | 1 step | 6.7s |
| 🟢 | act completes Product Catalog | 1 step | 8.8s |
| 🟢 | act completes Error Recovery | 1 step | 9.4s |
| 🟢 | act completes Choice Controls | 1 step | 9.0s |
| 🟢 | act completes Sequential Onboarding | 1 step | 10.5s |
Tested by e2e 0.23.0 · 6m 7s · android-emulator · run artifacts
…tial, and say when ordering applies - A retry cut short after a failure leaves the result under the earlier verdict; read the attempts, and a serial group's, for an interrupt. - timings-1 keys: a target name, then a project-relative POSIX file with no `..` segment, in the schema and the reader alike. - Rerun cache key adds github.run_attempt, since a rerun shares run_id and actions/cache never saves over an existing key. - Docs and help say the history orders files only with more than one worker, and that the file is `<output>/timings.json`. Refs ENG-1111 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
🟢 e2e ios agent: 21 passed, 1 skipped25 agent steps · 12 replayed from cache · 55 model calls · 336.0k tokens (82% cached) · $0.0226 All 22 tests in 1 file
Tested by e2e 0.23.0 · 8m 16s · ios-simulator · run artifacts |
There was a problem hiding this comment.
All reported issues were addressed across 12 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Refs ENG-1111 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
🟢 e2e android: 57 passed, 1 skippedAll 58 tests in 7 files
Tested by e2e 0.23.0 · 8m 52s · android-emulator · run artifacts |
🟢 e2e ios: 1 flaky, 54 passed, 1 skipped
|
| Test | Time | |
|---|---|---|
| tests/device-fixture.e2e.ts · 1 flaky, 10 passed | 1m 49s | |
| 🟢 | device fixture › setAppearance flips the color scheme the app reads | 13.6s |
| 🟢 | device fixture › setOrientation rotates the window the app measures | 10.3s |
| 🟢 | device fixture › the clipboard reads back what was written | 7.0s |
| 🟢 | device fixture › home leaves the app, openApp brings it back where it was | 10.1s |
| 🟢 | device fixture › closeApp then openApp relaunches on the home list | 10.3s |
| 🟢 | device fixture › closeApp leaves the next commands on the same device | 13.5s |
| 🟢 | device fixture › foregroundApp after closeApp reports the closed session as APP_NOT_OPEN | 7.4s |
| 🟢 | device fixture › device.back pops the scenario | 6.8s |
| 🟢 | device fixture › unstable_raw reaches the test session through agent-device | 5.8s |
| 🟢 | device fixture › setLocation and clearLocation change what the app reads | 13.4s |
| device fixture › enrollBiometrics and setBiometrics answer a biometric prompt (1 failed attempt first) | 11.1s | |
| ⏭️ | tests/controls.e2e.ts · 23 passed, 1 skipped | 3m 25s |
| 🟢 | control inventory › a label query resolves a labeled text field | 12.9s |
| 🟢 | control inventory › a labeled field answers name, display value, value reads, fill, and clear | 17.9s |
| 🟢 | control inventory › a placeholder query and attribute reads find the field | 7.4s |
| 🟢 | control inventory › a secure field takes a fill and denies value reads | 10.5s |
| 🟢 | control inventory › press sends a character and Enter through the soft keyboard | 11.4s |
| 🟢 | control inventory › a field autofocuses on mount and focus() moves the focus | 11.2s |
| 🟢 | control inventory › toBeFocused follows the focus | 10.5s |
| 🟢 | control inventory › a switch checks, unchecks, and reports its state | 11.1s |
| 🟢 | control inventory › checkbox and radio roles answer getByRole, and a checkbox toggles by tap | 9.2s |
| 🟢 | control inventory › checkbox and radio roles check, uncheck, and report their state | 13.3s |
| 🟢 | control inventory › a radio group reports the checked option | 9.4s |
| 🟢 | control inventory › buttons report disabled, enabled, and a state that arrives later | 8.9s |
| 🟢 | control inventory › a display: none element is absent rather than hidden, its visible twin attached | 8.6s |
| 🟢 | control inventory › a header answers its accessible name | 5.0s |
| 🟢 | control inventory › a tab row answers count, all, texts, filters, positions, and switching | 6.8s |
| 🟢 | control inventory › a list answers counts, list-form text, reads, and boxes in order | 7.6s |
| ⏭️ | 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.9s |
| 🟢 | control inventory › pointer verbs land at the point asked for | 10.7s |
| 🟢 | control inventory › an ambiguous locator fails at once | 6.2s |
| 🟢 | control inventory › screenshot, restart, and clearState reopen the app on its home list | 14.9s |
| 🟢 | refusals › verbs a device never declares are refused before the engine | 3ms |
| 🟢 | refusals › keys the soft keyboard cannot send are refused by the engine | 748ms |
| 🟢 | refusals › a missing locator fails as not found once its timeout passes | 1.2s |
| 🟢 | tests/device.e2e.ts · 3 passed | 1m 13s |
| 🟢 | sequential onboarding echoes the exact values | 44.6s |
| 🟢 | onboarding rejects a malformed email before advancing | 15.0s |
| 🟢 | dismissing the keyboard over choice controls leaves them as they were | 13.8s |
| 🟢 | tests/flows-lists.e2e.ts · 7 passed | 4m 25s |
| 🟢 | infinite scroll reaches the target item | 40.0s |
| 🟢 | product catalog adds exactly two of the right variant | 11.5s |
| 🟢 | gestures: long-press, then swipe left | 9.8s |
| 🟢 | sticky chrome: accept below the fold, then continue | 13.2s |
| 🟢 | async states: load, pull to refresh, claim through the toast | 11.2s |
| 🟢 | huge virtualized list reaches row 512 | 2m 46s |
| 🟢 | web view coupon form applies the code shown on the page | 13.0s |
| 🟢 | tests/flows.e2e.ts · 7 passed | 1m 17s |
| 🟢 | text inputs unlock the submit button | 15.7s |
| 🟢 | filled text inputs report their values | 11.6s |
| 🟢 | modal flow confirms through the native alert | 10.9s |
| 🟢 | bottom tabs act inside the last tab | 8.4s |
| 🟢 | error recovery retries, then confirms the delete | 10.0s |
| 🟢 | choice controls place the exact order | 8.1s |
| 🟢 | debounced search selects the target once results arrive | 12.5s |
| 🟢 | tests/login-form.e2e.ts · 3 passed | 51.0s |
| 🟢 | login form › rejects a malformed email | 15.4s |
| 🟢 | login form › rejects an unknown account | 14.5s |
| 🟢 | login form › signs in and logs out | 21.0s |
| 🟢 | tests/smoke.e2e.ts · 1 passed | 8.6s |
| 🟢 | home lists the scenarios and opens one | 8.6s |
Tested by e2e 0.23.0 · 7m 50s · ios-simulator · run artifacts
|
[claude-sonnet-5-5] responding on behalf of kdy1 Left for the human reviewer:
|
…e target A test a `platforms` list excludes is `selected: false` with cause `platform-unavailable`, the same flag a `--grep` or `--last-failed` sets, so a file holding both an iOS-only and an Android-only test never got a time on either target. Only a filter makes a file partial; a permanent platform exclusion does not. Refs ENG-1111 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The timings history (#1639) replaced the previous report as where file durations come from, so the prose that says what orders files inside a relevance band now names it: the filters guide, the `workers` bullet in the config reference, the CI guide, the skill's running reference, and the wording of the integration test that pins the one-worker gate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…1589) * feat(runner): start the tests a change is likeliest to break first A test filter can score the tests it keeps: `relevance` in its result maps test ids to a number from 0 to 1. With `--changed-since`, each target starts the files of the likeliest tests first, in bands at 75%, 50%, and 25%, and the target with the likeliest file goes first. Inside a band the longest-first order from the previous run still decides, with more than one worker. `decisionFilter()` scores every test it hands back: 1 for a test whose file, setup file, or stored screenshots changed, the model's answer for one it judged, and 0.5 for one it did not. It requires e2e 0.23.1 or newer, since an older runner refuses the unknown `relevance` key and drops the whole filter. The run prints `ranked N of M tests by relevance, likeliest first` when the scores change the order. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * test(runner): write the failing fixture as a constant, not built from a parameter CodeQL flagged `failingFile(title)` for putting `JSON.stringify` output into generated code. Only `gamma` used it, so the file is a constant now. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs(runner): say how targets, bands, and the ranking line are decided Review of #1589 found the docs looser than the code: targets go by the band of their best file, not its exact score, with ties in config order; a rating the model did not give counts as 50% and the test takes the higher of its two ratings; the bands are half-open; the ranking line follows when the scores put tests in more than one band; and a filter that returns no scores leaves the order alone. One test title said an empty target goes last, but it keeps its place. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs(runner): score known areas on the fallback path and name files, not tests The areas example now scores the tests whose area a change reaches even when another changed file maps to no area, keeping the no-exclusion fallback. The README, docs, and skill say the run starts the files of the likeliest tests, ordered by relevance band with collection order breaking ties on one worker. The timings test makes beta and gamma wait for each other before they sleep, so a slow second worker cannot start alpha ahead of gamma. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * fix(runner): keep the scores of a filter that fails A filter that threw left every test unscored, so a run with no AI Gateway key (a pull request from a fork) or a model outage fell back to collection order and lost the one thing the decision filter knows without the model: which tests the change touches. The error a filter throws may now carry `relevance`. The runner checks it the way it checks a result's, merges it by the highest score, and still warns, leaves nothing out, and records `outcome: failed`. Scores that fail the check are dropped, and the note says why. A call past its deadline is abandoned, and nothing it throws is read. decisionFilter() puts the scores the change alone gives (1 for a test the change touches, 0.5 for the rest) on the error it throws, as a property that is not enumerable, so printing the error does not list every test. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs(runner): point the ordering prose at the timings history The timings history (#1639) replaced the previous report as where file durations come from, so the prose that says what orders files inside a relevance band now names it: the filters guide, the `workers` bullet in the config reference, the CI guide, the skill's running reference, and the wording of the integration test that pins the one-worker gate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
e2e runalready starts the longest files first, but it read the previous run's durations fromreport.json, which a fresh CI checkout never has. This writes a small versioned history a CI cache can restore and save.<output>/timings.json(timings-1):target::fileto milliseconds. It merges into the existing file with a moving average (a run moves an entry a third of the way), and drops files that are gone and targets the config no longer has.--grep,--last-failed, interrupted (including a retry cut short after a failure), or limit-cut run leaves that file's entry alone, and repeats past the first do not count...segment. The schema and the reader use the same pattern, and a table test keeps them in step.report.json, so nothing regresses. A restored cache can reorder files, never change a result.--timings <file>moves it.--last-failedstill readsreport.jsononly.actions/cacherecipe indocs/ci/github-actions.mdx(the key ends ingithub.run_attempt, since a rerun sharesrun_idandactions/cachenever overwrites a key), the provider-neutral rule indocs/ci.mdx.timings.jsonjoins thee2e initand repo.gitignoreentries.schema/timings-v1.schema.jsonwith a valid and an invalid fixture, in the same change as the producer.Not here: duration-balanced
--shard, atimings.fileconfig key, and dogfooding the recipe inbenchmark.yml.Refs ENG-1111
Verified
Ran it locally: yes
e2e run tests/check.e2e.ts tests/click.e2e.ts tests/controls.e2e.ts tests/browser.e2e.ts --workers 2, once with no history and once seeded with thetimings.jsonthe first run wrote:timings.jsoncontrols(16 s file) startsclick(14 s file) startscheck,browser(short) startOne run per cell on one machine, so the size of the gain is indicative. The order is the point.
__proto__key is ignored and rewritten, tests still pass. ANO_TESTSrun writes nothing.--last-failedreadsreport.json, nottimings.json(NO_LAST_RUNwith only a timings file). An unwritable--timingspath is one stderr line and exit 0.--grepon one test leaves the file byte for byte unchanged.pnpm check,pnpm test, the testbed suite (587 passed), and the web benchmark (91 passed) are green locally.pnpm testran before the review fixes; after them I reranpnpm check, the unit suite (3447 passed), the new integration file, and the testbed ordering check. CI is green on the final head.Review
A fresh-context review found two things, both fixed in the second commit (cubic-dev-ai then raised nine smaller points, all fixed in the third and fourth): partial runs wrote non-comparable durations (a
--last-failedrerun of one 2 s test cut a 60 s entry to about 40 s), and nothing tested the runner wiring. The new integration test fails with the partial guard removed. The review also noted--timingsis not confined to the project root like--output; left as is, since the path is one the user names on their own command line and test code already runs with full authority.CI notes
packages/acpexecutor.test.ts"retries the session directory removal after the agent exits" failed ontest (22),(24), and(22.22.3)in earlier runs of this PR (kill ESRCHafter a 500 ms wait), and onoskar/fix-main-failing-testsbefore it. It does not reproduce locally and this PR does not touchpackages/acp; reruns passed. It needs its own fix.Huge Virtualized Liststep failed once withREPLAY_STALEand passed on rerun, with nothing in this diff that reaches it.🤖 Generated with Claude Code