Skip to content

Form scroll after a late error row; look tests wait for the footer - #58

Merged
jkosber merged 6 commits into
mainfrom
fix/form-scroll-footer-waits
Nov 24, 2026
Merged

jkosber merged 6 commits into
mainfrom
fix/form-scroll-footer-waits

Conversation

@jkosber

@jkosber jkosber commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Purpose

No roadmap task number; a "-" row in Done. Two intermittent CI failures and their close relatives:

  • test_an_error_above_the_focused_field_keeps_it_in_view failed on ubuntu-latest in runs 45134828365 and 45137084908. The defect is in the app: MachineForm._validate shows an error row and queues _show_focused_field with call_after_refresh, but the error row's layout reaches the screen only when the row's own message loop goes idle. When the screen runs its queued callbacks first, the scroll runs on the old layout and nothing scrolls again, so the focused field ends one row below the fields area. The form now also watches #form-fields's virtual_size and scrolls to the focused field again after the new layout, as the key picker already does for its body.
  • test_empty_screen_scrolls_to_its_last_line failed on windows-latest in run 45095854850. The defect is in the test: it measured after one pilot.pause(), before the footer had its keys, while the panes were still three rows taller. It now waits until the footer has its keys, as do four tests with the same startup pattern. Two existing waits, in test_footer_rows_follow_width and test_size_matrix_holds, were true when the footer had no keys at all; they now need at least one.

For the user: on a small terminal, the form keeps the field being typed in visible when an error row appears above it.

Acceptance

  • A test that forces the late layout (test_an_error_laid_out_after_the_scroll_keeps_the_field_in_view) fails before the form fix and passes after it
  • test_empty_screen_scrolls_to_its_last_line, test_empty_screen_is_muted_with_a_footer_style_key, the three result-line height tests, test_footer_rows_follow_width and test_size_matrix_holds pass at TEXTUAL_FPS=45 and TEXTUAL_FPS=30, with waits added and no assertion changed
  • A backlog row for the same scroll pattern in app.py

The new test patches two Textual internals, Widget._check_refresh and Screen._invoke_and_clear_callbacks, to hold the layout of the form's fields until the screen has run its queued callbacks; the form itself is not patched. It fails with a message naming the hook if either internal is gone, or if nothing was held. TEXTUAL_FPS was a diagnostic only; no test or CI step sets it.

Checks

  • ruff check, ruff format --check, pytest, uv build and check_package.py pass
  • Manual terminal checks, if the screen, terminal handoff or SSH changed (recorded in docs/validation.md): headless only; see the validation entry

Commits: the new form test is its own commit before the fix and fails there (10 of 10 runs); after the fix it passes (10 of 10). The test changes for the footer are in a separate test-only commit.

What remains untested: the form in a real terminal; a Windows machine (the Windows CI runner is the coverage); whether the list scroll after a rebuild in app.py, which uses the same call_after_refresh pattern, can run before the rebuilt list is laid out (backlog row). test_initial_selection_order_and_keyboard_details still fails at times with TEXTUAL_FPS=30, on main as well; it is a backlog row and is not changed here.

Docs

  • User guide or README, if behavior changed: not needed, the guide does not describe this case
  • Changelog line under Unreleased, if a user would notice
  • Roadmap row moved to Done
  • No private hosts, aliases, addresses, paths or credentials in code, fixtures or evidence

@jkosber
jkosber merged commit 39010a9 into main Nov 24, 2026
2 checks passed
@jkosber
jkosber deleted the fix/form-scroll-footer-waits branch November 24, 2026 03:20
This was referenced Nov 24, 2026
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