Skip to content

test: expect a held t on a phone to land on the panel's thread - #5350

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-5137
Nov 4, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-5137

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

#5039 opens page threads in the floating panel on windows narrower than the rail room (--lf-rail-room, 958px). test_a_key_pressed_before_presentation_runs_once_the_page_presents runs its touch cases at 390px, so the t it holds before presentation now replays into the panel's thread view instead of a margin card. The test read [data-lf-thread="held-thread"] and took .first, which on a phone resolves to the panel's head (.lf-fp-head), an element that never takes focus, so the scheduled runs failed on Linux and macOS (e.g. 41432142330) with to_be_focused reading inactive.

The assertion now looks for the thread in the panel's thread view or in a margin card. #5337 made the same change for the 600px Threads test (test_go_to_threads_lands_on_threads_from_a_page_thread). No product behavior changes. The held key is still held, echoed and replayed once the page presents, which is the behavior this test protects.

On current main the [True-module] and [True-state] cases failed locally with the same message. All four cases pass with this change.

Closes #5137 — automated triage

#5039 opens page threads in the floating panel on windows narrower than
the rail room, so on the 390px touch window a `t` held before
presentation now replays into the panel's thread view. The test read
`[data-lf-thread="held-thread"]`.first, which on a phone resolves to the
panel's head, an element that never takes focus. It now looks for the
thread in the panel or in a margin card, as #5337 did for the 600px
Threads test. No product behavior changes.

Closes #5137
@leaf-agent
leaf-agent merged commit 6075926 into main Nov 4, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-5137 branch November 4, 2026 10:35
max-sixty added a commit that referenced this pull request Nov 4, 2026
max-sixty added a commit that referenced this pull request Nov 4, 2026
Leaf holds printed keys pressed before its runtime loads and shows "Page
still loading — `t` runs when it's ready". Since #1213 it also dropped
them if the page hadn't upgraded ten seconds after it started, reading
such a page as faulted. On a loaded Mac a healthy page takes longer than
that, so keys the notice promised to run were dropped:

- `test_held_keys_after_one_that_opens_a_box_are_typed_into_it` failed
at load ~107. A page-side trace showed the keys held at 2.6 s, the
notice gone at 15.4 s, and the page upgrading at 15.6 s with nothing
left to take.
- The phone variant of
`test_a_key_pressed_before_presentation_runs_once_the_page_presents[True-module]`
failed the same way at load ~90.
- 8× CPU throttle reproduces both. Over the same hour `dynamic-widgets`
took 18.8 s to upgrade under `leaf-dev probe`.

This reverses #1213's deadline. The hold now ends when the runtime takes
it, when the page reports it cannot start, or when the user lets go, and
never on a clock. On a page that truly hangs the hold costs little: only
printed page keys are held, any other key or a pointer press already
ends the run and acts natively, and "Page still loading" is then true.

Every mode that runs the hold now ends it:

- **Upgrade:** the keyboard controller takes the run, as before.
- **A startup fault:** a failed entry module or stylesheet, an uncaught
error before upgrade, or `boot()` rejecting all reach `recover`, which
ends the hold, as before.
- **A document the runtime gives up on:** `prepareDocument` returns
false when the registry names another layer, and `boot` returns without
upgrading. Only the deadline ended the hold here. It now ends at that
return, through `letHeldKeysGo` in `keyboard/controller.js`.
- **A sample opened as a window of its own:** no containing page will
connect it, so `boot` waits on `lfSample.ready` forever. It now holds
nothing. This one is confirmed by reading the code rather than running
it.
- **Quick shortcuts off:** each key lets go at once, as before.
- **Exports:** they don't run `bootstrap.js`.

The tests follow:

- `test_upgrade_relinquishes_the_bootstrap_timeout_for_held_keys`
becomes `test_held_keys_outlast_any_wait_for_the_runtime`, which
advances the page's clock 30 s past a held `t` and checks the `t` still
walks to the thread.
- The journey `test_a_page_that_never_presents_lets_its_held_keys_go`
waited ten real seconds for the deadline. It becomes
`test_a_page_that_cannot_start_lets_its_held_keys_go` in
`browser/startup/test_keys.py`, where a failed runtime module ends the
hold and later presses reach the page.
- `test_a_document_the_runtime_gives_up_on_lets_its_held_keys_go` covers
the give-up path. With `letHeldKeysGo` taken out it fails with the
notice still standing.
- The tests that hold the runtime module now press their keys once the
body is parsed, since holding the module's request doesn't prove
bootstrap is listening. One local run lost its first key that way, with
Playwright's fake clock installed; that hasn't reproduced without the
clock, and the wait costs nothing either way.

## Testing

After merging `main`: the six held-key tests above and
`test_a_key_that_is_not_printed_ends_the_held_run` (10 items), serially
under `taskpolicy -b`, pass; `pnpm run test:runtime` (813) and `pnpm run
check:browser` pass. Before the merge, B and the phone's `[True-module]`
also passed at `--cpu-throttle 8`, where both failed with the deadline.
`main` has since fixed the phone variant's stale locator itself (#5350),
so this branch keeps main's reading of it.

> _This was written by Claude Code on behalf of max-sixty_
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.

Held startup key leaves the thread header unfocused

1 participant