Skip to content

ritmo-devtools keyboard: faster walk, waitFor steps, and no hang on a frozen page - #236

Merged
SandroMaglione merged 1 commit into
mainfrom
devtools/keyboard-walk-speed
Nov 17, 2026
Merged

SandroMaglione merged 1 commit into
mainfrom
devtools/keyboard-walk-speed

Conversation

@SandroMaglione

Copy link
Copy Markdown
Member

What this changes

ritmo-devtools keyboard (merged in #234, not released yet) was slow because focus-dropped reloads the screen for every control it presses, one at a time, with fixed waits. This makes it faster without changing what it reports, and stops it from hanging.

  • Presses on several pages at once. The real presses run on up to four pages (half the cores, four at most). A press that did not keep focus is run again with no other page open, and only that second result is reported, so a failure never comes from a busy machine.
  • A ready signal. A loaded screen is walked once no request is in flight and its menu, focus, and visible controls have not changed for 400 ms, or after 1.5 s at the latest (the old fixed wait). It is never slower than before.
  • A waitFor route step. { "waitFor": { "role": "button", "name": "Play" } } waits up to 15 s for that control to show. It replaces a fixed wait, which is paid again for every control pressed.
  • A guard for a page that stops answering. A page that does not run a script for 20 s is closed and reported as a page-error, with that screen's checks not checked. The merged walk hung once on tabletop-grand-prix for over seven minutes with no output. I could not reproduce it in six more runs, so the cause is not confirmed; a frozen page is the likeliest one, and the new test freezes a page on purpose.

There is no new flag. The changeset of #234 is amended, since the command is not released.

Acceptance: same report as the merged walk

Each game was walked with the merged walk once and with this one repeatedly, on clones, same route. Reports were compared byte for byte (port removed).

game merged walk this walk same report
still-time (3 screens) 78 s 47 s, 48 s, 47 s 3 of 3
tabletop-grand-prix (3 screens) about 60 s 59 to 73 s 4 of 4
landkeep ui-sdk (6 screens) 328 s 121 s, 124 s, 122 s 3 of 3
landkeep, dusk route step changed from wait 2500 to waitFor "Got it" 97 s 1 of 1

tabletop-grand-prix gains nothing: none of its controls can be reached, so nothing is pressed, and its page keeps loading past the 1.5 s limit.

Limits

  • The ready signal can fire early on a screen that shows its controls after a quiet moment (a splash, a fade) with no request in flight. The README says such a screen needs a waitFor step. Before this change the same screen needed a wait whenever the quiet moment passed 1.5 s.
  • A press that keeps focus under load but would drop it later than 0.7 s is not re-run. The merged walk has the same 0.7 s window.
  • The guard closes a page that stops answering; it does not cover a browser that stops answering as a whole.
  • One lint exception: setTimeout in the guard, with its reason on the line. A page that no longer answers cannot be timed by its own timers.

Tests

test/KeyboardWalk.test.ts gains: the same report with one page and with three; a control shown 300 ms after load is seen, one shown after 2.5 s is reached only with waitFor; a frozen page is reported and the next screen is walked; waitFor in route parsing. pnpm run check (2,003 tests, Chromium ones included) and pnpm pack:check pass locally.

🤖 Generated with Claude Code

…s, and a guard for a page that stops answering

- focus-dropped presses on up to four pages at once; a press that did not
  keep focus is run again alone, and that result is the one reported.
- A loaded screen is walked once it stops changing (no request in flight,
  same menu, focus, and controls for 400 ms), 1.5 s at the latest.
- A route step waitFor waits up to 15 s for a named control to show.
- A page that stops answering for 20 s is closed and reported as a
  page-error, so the walk fails instead of hanging.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@SandroMaglione
SandroMaglione merged commit 4e46848 into main Nov 17, 2026
5 checks passed
@SandroMaglione
SandroMaglione deleted the devtools/keyboard-walk-speed branch November 17, 2026 05:40
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.

1 participant