Skip to content

Chart the daily scaling readings at 64 sections, and flag a 50% jump - #5515

Merged
max-sixty merged 4 commits into
mainfrom
quadratic-audit
Nov 5, 2026
Merged

max-sixty merged 4 commits into
mainfrom
quadratic-audit

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

The daily scaling test fails a cost that grows faster than the page, and nothing else, and each run's readings left with its temporary directory. A change that slowed pages of every size alike passed unseen: the Tab cost #5479 halved was 17.5 ms on a page of any size, and no test saw it. Max chose to keep the readings and chart them.

  • tests/journeys/test_scaling.py now takes each size's lower reading once and uses it for both jobs: the growth check, as before, and a file per axis under .tmp/test-results/scaling/, holding the readings at 64 sections (the size of the largest real pages) in github-action-benchmark's customSmallerIsBetter form. The test job's existing artifact upload carries them.
  • The test now measures the page a user gets, through browser.unwatched, as leaf-dev scaling does. Until now it measured the suite's watched page, whose watches instrument every timer, write and input: this PR's first CI run read a keystroke at 64 sections as 404 ms on the asks page and 167 on prose, and the prose page read 49 ms watched against 7 unwatched on this Mac. The growth check's exponents carried that overhead too.
  • A new scaling-chart job in ci.yaml runs after test on the daily schedule only. It downloads that artifact, merges the four axes' files with jq, and hands them to github-action-benchmark, which appends them to dev/bench/data.js on the gh-pages branch, keeps a chart of each reading there, and comments on the commit whose run reads 50% above the run before. It has its own checkout because the action switches the checkout to gh-pages, and contents: write for that push and the comment.
  • Each run's job summary also shows its readings beside the run before (summary-always).
  • The gh-pages branch exists, empty, so the first run has somewhere to write. GitHub Pages doesn't serve it: the repo's Pages settings still name leaf.page, which Cloudflare serves, and no workflow deploys Pages. The chart is dev/bench/index.html on the branch, which https://raw.githack.com/max-sixty/leaf/gh-pages/dev/bench/index.html renders once the first run has written it.
  • The action compares a reading with the last one from another commit, so a day with no merge compares with the day before it, and could repeat an alert or miss the first day's.

50% is a first guess at CI's run-to-run spread on CPU time; tighten it once a few weeks of the chart show the real spread.

This pull request runs the edited test, which writes the readings in its artifact; the chart job itself first runs on the next daily schedule after merge.

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

The daily scaling test failed only growth, so a change that slowed pages of
every size alike passed, and each run's readings were discarded. The test now
writes each axis's lower readings at 64 sections into the test job's artifact,
and a scaling-chart job on the daily schedule appends them to the gh-pages
branch with github-action-benchmark, which charts them and comments on a commit
whose run reads 50% above the one before.
leaf-agent
leaf-agent previously approved these changes Nov 5, 2026
leaf-agent
leaf-agent previously approved these changes Nov 5, 2026
The suite's watches instrument every timer, write and input on a watched page,
so the daily test's readings were mostly the watches: a keystroke at 64
sections read 404 ms on CI's asks page, and 49 ms against 7 unwatched on prose
here. The growth check's exponents carried that overhead too.
@max-sixty
max-sixty merged commit f3dc503 into main Nov 5, 2026
5 checks passed
@max-sixty
max-sixty deleted the quadratic-audit branch November 5, 2026 18:44
max-sixty added a commit that referenced this pull request Nov 5, 2026
…ine ten times slower (#5523)

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_

---------

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