Skip to content

Let the scaling journeys and the playground leave test pass on a machine ten times slower - #5523

Merged
max-sixty merged 3 commits into
mainfrom
grind/slow-machine-fixes
Nov 5, 2026
Merged

max-sixty merged 3 commits into
mainfrom
grind/slow-machine-fixes

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Max's rule is that every test still passes on a machine ten times slower than the one
it was set on (#5522). Two places this changes broke it.

The scaling journeys' noise floors were milliseconds. exponent leaves out a size
whose growth above BASE is under a floor, 10 ms (50 ms for the server's time to answer).
On a slower machine every reading grows and the noise with it, so more sizes clear a
fixed floor and noise gets fitted; on a faster one, real growth falls under it. A floor
is now a share of a reading from the same run: the BASE page's load for the browser's
costs (scaling.floors, 5%, and 25% for the server's time to answer), and each
server path's own reading on the BASE page (server_scaling.floors), so a cheap path
isn't judged against a dearer one's fixed work. On this Mac the browser's come to 8-10 ms
and 39-52 ms. The event answer's size stays 10 KB, since no machine's speed changes it.
exponent takes the floor from its caller.

On the growth test's readings of all four pages, scaled as a machine 10 times faster or
slower would scale them, the ms floors fit different sizes to different exponents at
each speed (asks' click: none, 0.89 over two sizes, 0.67 over three), and the new floors
fit the same sizes to the same exponent at every speed.

The browser growth test's time. With the suite's health sensors, the growth test's
document page took 1,203 s on CI's daily run, and at CPU rate 10 the document and asks
pages ran past the 1,800 s per-test limit. #5515 has since moved the test onto
browser.unwatched, as this branch also did, so that part merged without a change here.
On the merged head, the growth test's logic at CPU rate 10 passes the document page in
199 s. The per-test limit stays at 1,800 s.

The playground leave test waited a fixed second. After two reloads it waited
1,000 ms for a leaving document's post, then read the log to check that leaving recorded
nothing. On a slower machine that post could land after the read, and the test would
pass without checking. It now leaves one real edit for a third reload and waits for that
edit's record, which arrives after anything the two reloads' leaving documents posted,
then checks that it is the only new record. With leaving changed to record the drawn
default, the test fails (7 records where 5 belong); restored, it passes, also at
--cpu-throttle 10.

The other deadlines leave at least ten times their work's normal duration and are
unchanged: SERVED_TIMEOUT_MS (120 s) bounds one probe or request; STATED_TIMEOUT
(120 s) bounds a server start or a short subprocess; HANDOVER_DEADLINE_MS (240 s)
bounds a corpus handover of 16-18 s; and the lease holder's 60 s in
test_interact_server.py outlives a nested run that takes 1 s here and 1.9 s on CI.

The scaling journeys are the daily gate on the costs #5194 tracks.

Checks run

  • uv run pytest tests/journeys/test_scaling.py -n 2: all four pages pass, 115-131 s
    each.
  • uv run pytest tests/journeys/test_server_scaling.py -n 2: eight pass, and cards,
    marked xfail because its exponent fits 1.3-1.6 from run to run, passed this run.
  • The server test's measurement three more times on all nine pages: each run fitted 40
    of 48 paths, where a floor of the BASE page's paths together fitted 20 or 21 of the
    same readings. Outside cards the largest exponents were 1.25, 1.11 and 1.13, and
    cards' delivery fitted 1.49, 1.51 and 1.47 under either floor. Unfitted are the
    revisions page's five paths, which stay flat as versions accumulate, and activate
    on threads, messages and batch.
  • The growth test's logic at CPU rate 10, outside pytest (.tmp/review/growth_check.py
    in the worktree), on document and asks: both pass, in 196 s and 254 s. Rerun on
    document after merging main (4130d3e): passes in 199 s.
  • After merging main, uv run --frozen pytest tests/journeys/test_scaling.py -n 2: all
    four pages pass, in 250 s.
  • The same with 100 ms of busy work at the 256 page added to each press, key and wheel
    step, scaled with the square of the page's size, at rate 1: click, key and scroll fail
    on prose and document.
  • The growth test's dumped readings from all four pages, watched and unwatched, with
    every duration scaled by 0.1 and by 10: the share floors fit the same sizes and
    exponents at each scale; the ms floors didn't.
  • test_a_playground_records_an_edit_made_while_loading_or_as_the_page_leaves: fails
    with leaving recording the drawn default, passes restored, and passes with
    --cpu-throttle 10. test_a_wait_takes_the_suites_deadline passes.
  • pre-commit run --files on the changed files.

Not covered

--cpu-throttle and CDP's Emulation.setCPUThrottlingRate slow only Chromium's
renderer. Page building, the server, Python and Playwright's driver ran at full speed in
the rate-10 runs, so those runs don't show how the server's time to answer, or a
journey's setup, behaves on a machine ten times slower. --cpu-throttle also doesn't
reach a page from browser.unwatched, so the rate-10 runs of the growth test wrapped
the tab themselves.

The rule this follows is in #5522, and the fixed waits before absence assertions are in
#5541.

This was written by Claude Code on behalf of max-sixty

…ine ten times slower

Max's rule is that every test still passes on a machine ten times slower than the one
it was set on (#5522). Three places broke it.

**The scaling journeys' noise floors were milliseconds.** `exponent` leaves out a size
whose growth above BASE is under a floor, 10 ms (50 ms for the server's time to answer).
On a slower machine every reading grows and the noise with it, so more sizes clear a
fixed floor and noise gets fitted; on a faster one, real growth falls under it. A floor
is now a share of a reading from the same run: the BASE page's load for the browser's
costs (`scaling.floors`, 5%, and 25% for the server's time to answer), and the BASE
page's paths together for the server's (`server_scaling.floors`). On this Mac those come
to 8-10 ms, 39-52 ms and 7-15 ms. The event answer's size stays 10 KB, since no
machine's speed changes it. `exponent` takes the floor from its caller.

On the growth test's readings of all four pages, scaled as a machine 10 times faster or
slower would scale them, the ms floors fit different sizes to different exponents at
each speed (asks' click: none, 0.89 over two sizes, 0.67 over three), and the new floors
fit the same sizes to the same exponent at every speed.

**The browser growth test measured the suite's health sensors.** Its pages came from
the `browser` fixture, whose sensors work on the main thread at every input: on the
prose page at 512 they added about 290 ms to a click and 210 ms to a keystroke, more
than the page's own work. `test_no_cost_grows_faster_than_the_page` now reads pages
from `browser.unwatched`. Each page's test took 195-480 s here with the sensors and
115-131 s without them; on CI's daily run the document page took 1,203 s, inside the
suite's 1,800 s per-test limit by a factor of 1.5. At CPU rate 10 the document and asks
pages ran past that limit with the sensors, and now finish in 196 s and 254 s.

The limit stays at 1,800 s. Ten times the suite's longest test on CI, the 1,614 s
Firefox console sweep of the feature gallery, is 4.5 hours, and the whole suite runs
under a 5-hour bound, so a limit that wide would let one hung test spend the run.
The long tests have to get shorter instead, as this one did.

**The playground leave test waited a fixed second.** After two reloads it waited
1,000 ms for a leaving document's post, then read the log to check that leaving recorded
nothing. On a slower machine that post could land after the read, and the test would
pass without checking. It now leaves one real edit for a third reload and waits for that
edit's record, which arrives after anything the two reloads' leaving documents posted,
then checks that it is the only new record. With leaving changed to record the drawn
default, the test fails (7 records where 5 belong); restored, it passes, also at
`--cpu-throttle 10`.

The other deadlines leave at least ten times their work's normal duration and are
unchanged: `SERVED_TIMEOUT_MS` (120 s) bounds one probe or request; `STATED_TIMEOUT`
(120 s) bounds a server start or a short subprocess; `HANDOVER_DEADLINE_MS` (240 s)
bounds a corpus handover of 16-18 s; and the lease holder's 60 s in
`test_interact_server.py` outlives a nested run that takes 1 s here and 1.9 s on CI.

Co-authored-by: Claude Opus 5.5 <[email protected]>
`server_scaling.floors` gave every path the BASE page's paths together as its floor, so a
cheap path was judged against `activate`'s and `delivery`'s fixed work: on `threads`,
`append` starts near 1 ms against a floor near 13 ms here and 26 ms on the efficiency
cores, and a quadratic `append` would have to grow by that much before it was fitted.
Each path's floor is now its own reading on the BASE page, which a slower machine slows
as much as the path and which couples no path to another.

Three runs of the server growth test's measurement on all nine pages fitted 40 of 48
paths each time, where the paths-together floor fitted 20 or 21 of the same readings.
Outside `cards`, which is marked `xfail` for its column-order record, the largest
exponents were 1.25, 1.11 and 1.13; `cards`' `delivery` fitted 1.49, 1.51 and 1.47 under
either floor. The paths left unfitted are the `revisions` page's five, which stay flat as
versions accumulate, and `activate` on `threads`, `messages` and `batch`.

Co-authored-by: Claude Opus 5.5 <[email protected]>
leaf-agent
leaf-agent previously approved these changes Nov 5, 2026
max-sixty added a commit that referenced this pull request Nov 5, 2026
The suite's shift watch (`tests/shift_watch.js`) no longer reads content
the browser skips: a shut tab's panel, a closed disclosure's content,
the contents of an off-screen `content-visibility: auto` box. On the
feature gallery that cuts the watch's cost of opening the page by more
than half, and every watched test whose page holds shut tabs or folds
pays less on each frame it changes. This is the sensor half of what
#5522 asks of the longest tests; the other half is the page's own load,
below.

## Where a gallery test's time goes

Measured on this Mac (one-minute load 6–25 from other sessions),
Chromium headless shell, 1200×900, reduced motion, opening the gallery
and waiting for `wait_until_ready`, three interleaved rounds per arm:

| Arm | Time to ready | The shift watch's complete readings |
| --- | --- | --- |
| `browser.unwatched` (the page's own work) | 7.0–8.4 s | none |
| `browser`, the watch as on `main` | 13.6–16.1 s | 85–99 readings of
5,913 nodes, 6.8–8.5 s |
| `browser`, this branch | 9.5–10.9 s | 92–94 readings of at most 2,923
nodes, 3.1 s |

All of the sensors' cost was the shift watch's complete reading. On each
frame after an announced change, `read()` asked every node for its rect,
about fifteen computed-style properties, its visibility and its
ancestry, at about 14 µs a node; a CPU profile of a watched load put 8.7
s of its 14.9 s in the watch's frame callback, 7.5 s of it in `read()`.
About 3,700 of the gallery's 5,913 nodes stand in skipped content,
nearly all in shut tabs. The runtime's own readings already leave
skipped content out (`skipped`), because asking about it makes Chrome
style and lay out the whole skipped subtree first.

The page's own 7–8 s is mostly its 16 live samples: the page presents at
about 1.6 s, the samples report ready one after another from about 2.6 s
to 6.7–7.6 s, and the page is ready within 0.1 s of the last.

Of the long gallery tests on CI's daily run, only
`test_the_feature_gallery_exercises_its_core_journeys` runs the shift
watch; `test_render_gate.py`, `test_render_pages.py` and
`test_render_anchors.py` are marked `shifts_unsurveyed`. Call seconds,
`-n0`, base and this branch interleaved over two rounds, then once each
with the shift watch removed and with every sensor removed (a scratch
switch in `watched`, not committed):

| Test | `main` | This branch | No shift watch | No sensors |
| --- | --- | --- | --- | --- |
| `test_the_feature_gallery_exercises_its_core_journeys` | 63, 63 | 43,
44 | 19 | 20 |
| `test_page_fixture_renders[feature-gallery]` | 110, 115 | 116, 110 |
109 | 113 |
|
`test_an_anchor_written_from_the_mapped_revision_lands_on_the_page[feature-gallery]`
| 25, 24 | 25, 24 | 23 | 24 |
| `test_real_page_passages_can_be_quoted[feature-gallery]` | 24, 22 |
25, 22 | 22 | 23 |

`test_page_fixture_renders[feature-gallery]` spends about 55 s of its
110 s here in seven `wait_until_ready` calls, about 8 s per gallery
load, and the rest in its journeys' own probes; on CI's daily runs of
November 4 and 5 those seven calls took 292 s and 327 s. So for that
test, the longest on CI after the Firefox sweep, the cost is the page's
own load, chiefly its live samples, rather than the sensors.

## The change

- `everything()`, the population of a complete reading, leaves out nodes
in skipped content. A node the last reading read while it was drawn gets
one more reading, the one that sees it go. Without it, a fold that
shrinks to nothing and moves into a closed `<details>` in one task, as a
settled thread does into history, lost the flow credit for the control
its shrinking carried, and all six cases of
`test_fold_reparenting_keeps_only_its_original_flow_credit` failed.
Content is read again from the frame it is drawn; what reveals it, or
makes the browser stop drawing it without a scroll, is a DOM write or a
`contentvisibilityautostatechange`, both of which the watch has
announced since #1951 (the header's list of announcements now names the
second).
- A layout-shift entry taken at a paint checkpoint now records `held`,
the population the reading at that time covers, rather than asking
`everything()` again right after `read()`: the second call left out the
nodes `read()` had just taken a departure reading of, so a
`content-visibility: auto` box carried off screen without input could go
unjudged on that path. No control exercises that path with a departure;
the change follows from what the population means.
- `test_a_control_drawn_out_of_skipped_content_is_watched` holds that a
control drawn out of a closed disclosure, a hidden-until-found panel or
an off-screen `content-visibility: auto` box, then moved by script, is
still reported. With revealed content never read again, all three cases
fail.
-
`test_a_box_the_browser_stops_drawing_without_a_scroll_leaves_no_stale_reading`
pushes a drawn `content-visibility: auto` box past the browser's drawing
margin with a write above it, so no scroll announces the change. Without
the `contentvisibilityautostatechange` announcement the verdict's own
complete reading reports "shift watch missed a change to the page's
nodes (population)" in 5 runs of 5; with it, 5 of 5 pass.
- `skipper` and `skipped` move from `shown-box.js` to `shadow-tree.js`,
which imports nothing (`.dependency-cruiser.mjs` holds it to that), so
the sensor bundles the runtime's own rule. `shown-box.js` imports
`rendering.js`, whose dependencies run code at load, so it can't go into
an init script. Every importer names the new home, and
`browser/AGENTS.md` gains the owner's row.
- `notes/shift-watch-cost.md` records the findings (about 14 µs a node
per complete reading; most of the gallery's own time to ready is its
live samples arriving), the `leaf-dev probe` command that reproduces the
gallery's presented and settled times, and the open design below.
`skipper` stays in `shadow-tree.js` beside `excludedByInert` and
`nativeLayerHolding`, which also ask the browser about state along the
rendered ancestry; a module of its own would add a file and move every
importer again.

## Checks run

- `uv run pytest tests/browser/test_render_shift_watch.py
tests/journeys/test_render_shift_watch.py
tests/browser/test_render_words_watch.py
tests/browser/test_render_swap_watch.py
tests/browser/test_render_write_watch.py
tests/browser/test_page_layout_shifts.py
tests/journeys/test_page_layout_shifts.py -n 4`, plus the watched
gallery journey: 466 passed. The sensors' controls (a real shift, lost
typed words, a swap, a needless write) still fail where they should.
- The sensor suites with `VERIFY = 1`, which checks every frame for an
unannounced change: 459 passed; the four gallery tests above also passed
with it before the review follow-up.
- The watched browser and smoke files whose pages hold tabs,
disclosures, text documents or samples (18 files, 302 tests): 11
failures and 3 errors across 11 tests, the same set with `main`'s watch
and with this one; 8 of those 11 tests also fail on CI's November 5
daily run.
- `pnpm run test:runtime` (820 passed) and `pnpm run check`.


`test_a_pressed_panel_control_keeps_its_face_and_takes_the_next_press[feature-gallery]`
fails on this Mac with `main`'s watch and with this one alike ("Resolve
thread" shows `cursor: zoom-in` while its gesture travels) and passes on
CI's Linux runner, so it is left out of the comparison.

Not verified: the rest of `tests/browser` and `tests/journeys`, which
run under this sensor; CI's push to `main` is the first run of them all
with it.

## What's left

- **The page's own load.** Every live sample's child page starts as its
sample mounts, below the window or not, and the page reads as arriving
until the last has; on the gallery that is 16 Leaf runtimes and about 5
s of every load, which users on leaf.page pay too. Starting a child only
as its sample nears the window would cut both, but changes when a
sample's state is ready, so it is Max's call.
- **The reading still grows with the drawn page.** A page that skips
nothing, like the 512-section prose page `leaf-dev scaling` generates,
gets nothing from this; #5523 measured the sensors adding about 290 ms
to a click there. Reading the full record only for nodes near the
window, as the runtime's input work follows the window, would change
what a verdict can look back to for a box that jumps into view, so it is
in the note as a design for Max.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@max-sixty
max-sixty merged commit 56c6be6 into main Nov 5, 2026
5 checks passed
@max-sixty
max-sixty deleted the grind/slow-machine-fixes branch November 5, 2026 20:53
max-sixty added a commit that referenced this pull request Nov 5, 2026
Fifteen tests waited a fixed time, from 50 ms to 11 s, and then asserted
that something had not happened: a receipt not sent, a probe not
repeated, a pane not scrolled. On a slower machine the unwanted thing
can land after the wait, and the test passes with the bug present.
`tests/AGENTS.md`'s "Absences", as #5522 rewrites it, says to wait
instead for an event the page orders after the moment the unwanted thing
would have happened, and then check that it is absent. Fourteen of these
tests now do that, and the fifteenth drops its check, since nothing can
produce what it checked for.

| Test | Waited | Now waits for |
|---|---|---|
|
`test_render_read_state::test_modal_blocks_exposure_until_user_returns_to_threads`
| 100 ms | `rendered`, then `round_trip`: the read pass the resize set
off has run, and any receipt it sent has come back |
|
`test_render_read_state::test_oversized_message_needs_contiguous_traversal`
| 100 ms | the same, after the scroll |
|
`test_render_read_state::test_a_page_seat_the_open_panel_stands_over_is_not_read`
| 1.5 s | the same, after the scroll |
|
`test_render_drawing::test_a_second_finger_takes_back_the_stroke_the_first_began`
| 100 ms | `rendered`: every repaint the release queued has run |
|
`test_render_floating_panel::test_writing_reaches_the_field_however_the_panel_stands`
| 300 ms | `rendered`: the resume has drawn what it decided |
|
`test_render_anchors::test_a_failed_deferred_hydration_waits_for_a_user_retry`
| 250 ms | the page's clock run a minute forward, past any backoff a
retry would wait out, then `rendered`, with the page counting its own
`/api/deferred` fetches |
|
`test_render_startup::test_slow_history_keeps_decisions_safe_and_status_honest[ready]`
| 50 ms | the planted fault's `pageerror`, then `rendered` |
|
`test_render_startup::test_user_view_context_waits_for_a_samples_viewport_allocation`
| 11 s | the page's clock run 11 s forward, then a check that the view
restoring the frame is the only one sent since it went to zero |
|
`test_panes::test_reading_keys_follow_the_focused_pane_without_moving_its_sibling`,
first press | 250 ms | `scroll_settled` on the pane, then on the
document |
| the same, second press | 250 ms | the same |
| `test_freshness::test_status_changes_coalesce_behind_one_state_read`,
two waits | 500 ms each | the second freshness look asked after the
change, which the page asks only once it has handled the first, with the
page counting its own looks and state reads |
| `test_changes_in_place::test_a_to_do_running_on_an_element_marks_it` |
300 ms | `told`: the page has taken in the to-do |
| `test_wait::test_the_stop_hook_watch_wakes_the_session_only_for_input`
| 1 s | two more passes of the watch over the pending input, with each
pass's wait shortened to zero |
|
`test_site::test_a_page_that_starts_after_a_fault_takes_its_notice_back`
| 3 s | the page's clock stepped a second at a time, three times, each
step taken with no probe round in flight, with the page counting the
probe's own fetches |
| `test_site::test_a_probe_in_flight_leaves_a_page_that_started_alone` |
2 s | the page having handled the held probe round's answer |
|
`test_projected_data::test_data_written_while_a_fresh_revision_starts_shows_once_it_has_started`
(renamed from
`test_data_written_during_fresh_revision_startup_waits_for_activation`)
| 100 ms | nothing: the check is removed (below) |

Four of these count requests in the page rather than through Playwright.
A route handler's list and a `request` event reach Python on their own
schedule, after the page's call, so a count read right after an ordered
event could still be missing the request it is checking for.

Three of the waits needed more than an ordered event:

- **The started-page probe test.** The supervisor sets the timer for its
next round only once the last round's answer lands, so a clock run while
a round is in flight fires nothing. The test therefore waits until no
round is in flight and steps the clock a second at a time, waiting out
any round each step starts. It throws its planted fault from a
`DOMContentLoaded` listener, because a timer's callback under
Playwright's installed clock throws without firing the page's `error`
event (measured: the callback ran, the page's `error` listeners saw
nothing, and `data-lf-startup-error` stayed unset), and the supervisor
would never start. The test first checks that the supervisor recorded
the fault in `data-lf-startup-error`.
- **Both probe tests** count only the supervisor's probe, which asks for
`registry.json` past the cache. The runtime's own read of the same
address used to count too, so `handled >= 1` could hold before the held
round was answered. Each probe also carries a `Leaf-Test-Probe` header,
so the in-flight test's route holds the probe alone; the runtime's read
goes through, and the page comes up on its own rather than through a
planted `data-lf-upgraded`.
- **The deferred-hydration test** runs the page's clock forward, since
`rendered` doesn't wait for a timer and a retry on a backoff would come
after it.

The projected-data test checked, 100 ms after writing data during a
fresh revision document's startup, that the update had not painted. That
guarded a newer source reading painting into a document that was still
activating, a case from before #666, when an activation could hold the
page while the new document was already mounted. Since #666 a revision
that changes the page's code starts a fresh document. The test holds
that document's `registry.json` for all of startup, and widgets import
their modules only after it arrives (`widget-loader.js`), so no widget
exists to paint the update. No product change short of drawing widgets
before their registry can bring the case back. The checks after the
release stay: the update shows, and so does the new revision's text.

## Controls

For each test, a throwaway product change made the unwanted thing
happen, and the converted check caught it. Each browser test ran four
ways: as is and with the change, at CPU 1x and at `--cpu-throttle 10`.
As is, every run passed; with the change, every run failed at the
converted check. None of the changes is committed.

| Test | Change |
|---|---|
| modal | `thread/read.js` reads a message under an open modal |
| oversized message | `thread/read.js` takes any traversal as contiguous
|
| page seat under the panel | `thread/read.js` measures the message
without the panel's clip |
| second finger | `drawing.js` keeps the stroke when it is dropped |
| resume | `drafts.js` reports the writing place unavailable after
resuming it |
| deferred hydration | `lf-diff.js` retries a failed load on the next
task, and separately on a 1.5 s backoff |
| post-upgrade fault | `prepaint.js` marks a startup error, a task
later, for an error after upgrade |
| sample viewport | `user-view.js` reports a zero-sized view |
| panes, first press | the `d` key also scrolls the sibling pane two
frames later |
| panes, second press | the `d` key scrolls the focused pane a further
40 px two frames later |
| freshness | `state-feed.js` asks again while a read is in flight |
| to-do | `margin-bars.js` marks a to-do's target before it is running |
| stop-hook watch | `session.py` wakes on the second pass over pending
input (a model test, so no throttle) |
| started page's probe | `bootstrap.js` drops both of the probe's
`started` checks; over the clock's three steps the count rose from 1 to
4 at 1x and from 2 to 5 at 10x |
| in-flight round | `bootstrap.js` acts on a round's answer after the
page started; a second document, `?_leaf-recovered=`, was requested |

## What ran

Each touched test as is and with its change, at CPU 1x and 10x, one at a
time (`uv run --frozen pytest <test> -n0 -q`, then with `--cpu-throttle
10`), from scripts that applied and restored each change, and the
projected-data test as is at both. Every touched test together at
51e0bf3, with `-n 2`: 19 passed; the four tests changed since then
each passed as is at 1x and 10x, and the freshness and projected-data
tests again at 1x after the last change. Not run: Firefox or WebKit, and
the rest of each test file.

The sleeps removed total about 21 s, 11 s of it in the sample-viewport
test; the deferred-hydration test's minute of clock adds about 3 s.

The rule is #5522; #5523 holds the fixes to the scaling checks and the
playground wait.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
max-sixty added a commit that referenced this pull request Nov 5, 2026
…one by a benchmark (#5522)

`tests/AGENTS.md` held functional tests to giving the same result when
the system runs
ten times slower, and sent performance to be tested "separately, under
controlled
conditions". Max's rules now cover every test: "we should never have the
timings be a
test, we should have a rule that running on a 10x slower machine still
passes", and "we
should never pass/fail based on benchmark results".

The section "Functional results do not depend on execution speed"
becomes "Results do not
depend on execution speed", and says:

- every test, fixtures and watches included, gives the same result on a
machine ten times
slower than the one it was written on, since CI's runner and a host
running other
  sessions' suites are both slower than an idle development machine;
- so no test asserts a duration, and no test passes or fails on a
benchmark's reading: a
benchmark reports its readings (`leaf-dev scaling`, charted daily), and
a reader judges
  them;
- `--cpu-throttle 10` checks a test against the rule; it slows only
Chromium's renderer,
  not the server, Python or the driver, and doesn't reach a page from
  `browser.unwatched`;
- each operation that could hang gets a deadline at least ten times the
longest it takes
on CI's runner, whose `test` job records each test's time in its junit
results
  (`leaf-dev suite-profile`).

"Absences" now says how to assert that something didn't happen, the
commonest violation:
wait for a later event ordered after the moment the forbidden behavior
would have
happened, then check it is absent. It names the events the suite already
waits on: the
page's sends coming back (`round_trip`), the page taking in what the
server holds
(`told`), the shared clock's next tick (`ticked`), and a later gesture
of the same kind.
"Wait for the operation's own completion signal" already covers a fixed
wait before an
assertion that something happened.

Three other places follow:

- `test_a_wait_takes_the_suites_deadline` called a sleep "an absence
window"; it now says
a sleep bounds nothing and points at "Absences". Its check never read
sleeps, so only
  the docstring changes.
- `faulthandler_timeout`'s comment in `pyproject.toml` said the slowest
test takes under
three minutes on CI. On the 2026-11-05 nightly, sixteen tests took
longer than 180 s,
the slowest 1,614 s. Max decided the half-hour limit stays a guard
against a hang,
outside the ten-times rule, and the comment now says so. The limit
itself is unchanged.
- "Races" said `--cpu-throttle` slows every page the browser fixtures
open; it now says
the pages the `browser` fixture watches. The two comments that cite the
section by
  heading follow its new name.

`dev/AGENTS.md` says nothing about timing; `leaf-dev scaling`'s own
header owns how it
measures. No eval was run on this wording.

Related: #5563 took the daily growth tests' pass/fail out, so nothing
gates on a benchmark's reading; #5523 holds the playground wait and the
scaling changes, and #5541 the fixed
waits before absence assertions.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants