Repository navigation
feat(runner): start the tests a change is likeliest to break first - #1589
Conversation
🟢 e2e web: 91 passedAll 91 tests in 41 files
Tested by e2e 0.23.0 · 1m 5s · web · run artifacts |
🟢 e2e web agent: 33 passed34 agent steps · 26 replayed from cache · 20 model calls · 88.6k tokens (94% cached) · $0.0036 All 33 tests in 5 files
Tested by e2e 0.23.0 · 1m 31s · web · run artifacts |
🟢 e2e ios agent: 1 flaky, 20 passed, 1 skipped25 agent steps · 11 replayed from cache · 66 model calls · 493.4k tokens (82% cached) · $0.0341
|
| Test | Agent | Time | |
|---|---|---|---|
| tests-agent/scenarios.e2e.ts · 1 flaky, 20 passed, 1 skipped | 25 steps · 66 calls | 9m 41s | |
| 🟢 | act completes Login Form | 1 step · 4 calls | 1m 22s |
| 🟢 | act completes Infinite Scroll List | 1 step | 37.9s |
| 🟢 | act completes Modal Flow | 1 step | 10.1s |
| 🟢 | act completes Bottom Tabs | 1 step | 7.4s |
| 🟢 | act completes Text Input Variations | 1 step | 13.2s |
| 🟢 | act completes Broken Accessibility | 2 steps · 6 calls | 27.4s |
| 🟢 | act completes Vision Only | 2 steps · 6 calls | 29.1s |
| act completes Gestures (1 failed attempt first) | 1 step · 12 calls | 59.6s | |
| 🟢 | act completes Async States | 1 step · 9 calls | 34.2s |
| 🟢 | act completes Debounced Search | 1 step · 1 call | 28.8s |
| 🟢 | act completes Flattened Registration Form | 2 steps · 1 call | 29.8s |
| 🟢 | act completes Flattened Login | 2 steps · 11 calls | 57.5s |
| 🟢 | act completes Sticky Chrome Target | 1 step | 13.7s |
| 🟢 | act completes WebView Accessibility | 1 step | 12.1s |
| 🟢 | act completes Permission Prompt | 1 step | 11.0s |
| 🟢 | act completes Photo Picker | 1 step · 2 calls | 28.8s |
| 🟢 | act completes Product Catalog | 1 step | 10.0s |
| 🟢 | act completes Error Recovery | 1 step | 10.2s |
| 🟢 | act completes Choice Controls | 1 step · 6 calls | 36.1s |
| 🟢 | act completes Stripe PaymentSheet | 1 step · 8 calls | 30.9s |
| 🟢 | act completes Apple Pay | 1 step | 10.7s |
| ⏭️ | 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) |
Tested by e2e 0.23.0 · 10m 47s · ios-simulator · run artifacts
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
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>
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
🟢 e2e android agent: 20 passed24 agent steps · 15 replayed from cache · 43 model calls · 251.7k tokens (84% cached) · $0.0162 All 20 tests in 1 file
Tested by e2e 0.23.0 · 6m 24s · android-emulator · run artifacts |
🟢 e2e android: 57 passed, 1 skippedAll 58 tests in 7 files
Tested by e2e 0.23.0 · 9m 38s · android-emulator · run artifacts |
🟢 e2e ios: 55 passed, 1 skippedAll 56 tests in 7 files
Tested by e2e 0.23.0 · 7m 21s · ios-simulator · run artifacts |
|
[claude-sonnet-5-5] responding on behalf of kdy1 Left for the human reviewer:
|
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>
fa1bf6a to
0eb9a07
Compare
|
[claude-sonnet-5-5] responding on behalf of kdy1 Review fix pushed at 0eb9a07, and the thread on
The ios agent comment shows one flaky retry ( |
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>
… 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>
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>
…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>
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>
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>
0eb9a07 to
a81baf1
Compare
TestFilterResult.relevancemaps 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%. Targets go by the band of their best file, ties in config order.docs/filters.mdx,docs/reference/config.mdx, anddocs/ci.mdxsay how it combines with the bands.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: the higher of the test's rating and its setup's, where a rating the model did not give counts as 0.5. It asks the model nothing new.relevance, which the run checks like a result's, and the failure still warns, leaves nothing out, and recordsoutcome: failed.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 when every call fails, so a run with no key, or with the model down, still starts the touched tests first.ranked 7 of 12 tests by relevance, likeliest firstwhen the scores put tests in more than one band.e2e listsays nothing, since it starts nothing.@e2e-dev/decisionnow needse2e >=0.23.1. An older runner rejects the unknownrelevancekey and drops the whole filter, as the main column below shows.This shortens the time to the first failure:
--max-failures,maxDuration, Ctrl-C, and CI with its default single worker, where longest-first never applied. It does not shorten a run that finishes whole. With several workers it can lengthen one, since a likely short file now starts before an unlikely long one.The sort key is the file's band (its likeliest test), then its time in the timings history (untimed first), then collection order. A target ranks by its best file, ties in config order.
scheduler.tsis unchanged: it already drains targets and files in plan order, andscheduler.test.tspins that. The report lists tests in the same order whatever starts first, and the report format is unchanged.Verified
Ran it locally: yes
@e2e-dev/web(real Chromium) and a file-backed config whose local filter scores tests, main (0c1b3572) against this branch. The filter needs no model.pnpm bench:ab --suite testbed -- tests/forms.e2e.ts, a run with no scores (4 pairs): every test ran the same steps with the same outcome on both builds, every counter matched, and the timings were the same (wall +1.3%, interval -2.0% to +1.7%). It ran before the last commit, which changes only what a failed filter leaves.filter-runner.test.tsruns the realliston the decision filter's result. The band edges (75%, 50%, 25%) are my estimate until real scores are seen. The peer floor assumes the next release is 0.23.1.e2e run --changed-since main --workers 1 --max-failures 1on three tests:alphaandbetasleep 3 s,gammafails at once and is collected last. The filter scoresgamma1.warning: likeliest returned an invalid result ... unknown key "relevance"ranked 1 of 3 tests by relevance, likeliest firstalpha,betafailure-limite2e run --changed-since main --workers 1 --max-failures 1with the realdecisionFilter()ontypesafe-ai/jevand no AI Gateway key, so every model call fails. The tests are the same three, and the change editsgamma's test file, so the change touches it. "Before" is this PR's previous head (d2c2217e), which dropped the scores of a failed filter.warning: decision failed, so it leaves nothing out: AI Gateway authentication failed: No authentication provided.ranked 3 of 3 tests by relevance, likeliest firstrun.filtersoutcome: failedoutcome: failed, same notealpha,betafailure-limite2e listwith the same filter prints the warning and the three tests, and no ranking line, as before.The same failure on the testbed's own config, which runs
decisionFilter()on Jev:e2e run --changed-since HEAD --workers 1 tests/forms.e2e.ts tests/todos.e2e.tswith no key and an uncommitted comment added totodos.e2e.ts(reverted after), so the change touches that file.formsis collected first.d2c2217e)decision failedwarningranked 11 of 11 tests by relevance, likeliest firstfills, clears, and submits a profile(forms)adds todos with the button and the keyboard(todos)todostests startede2e run --changed-since main --workers 2right after a run that recorded the timings, on four tests:a1 s,b3 s,c4 s,d1 s. The filter scoresd0.9 andc0.3. Both builds read the same recorded times. This table was taken before the timings history (#1639) landed on main.dis in the top band andcin a lower one, thenbgoes beforeaby timeAfter rebasing onto the timings history, the same four tests on this branch (a first run wrote
timings.json, then--changed-since main --workers 2) start c, d, b, a again, in 5.7 s.Two integration tests pin the wiring. In
test-filters.test.ts, a filter that throws with scores still starts the failing test first under--max-failures 1, and its warning andoutcome: failedstay. Inparallel-workers.test.ts, a run with one worker ignores the timings history and a run with two workers uses it; that test fails when therunWorkers > 1gate is removed or always on.🤖 Generated with Claude Code