Skip to content

The window tests pass at any hour and give the core a minute to answer, and a press on GNOME's title bar selects no text - #309

Merged
pitis merged 3 commits into
mainfrom
fix/said-budget
Nov 30, 2026
Merged

pitis merged 3 commits into
mainfrom
fix/said-budget

Conversation

@pitis

@pitis pitis commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

What changed

  1. The file-click test scrolls first. a_click_on_a_file_presses_it_and_leaves_the_keys_in_the_composer (core/desktop/src/app/files.rs) scrolls the photo's message to the top of the timeline before clicking it, and checks that the scroll happened. It scrolls back to the newest message before the right-click on file-7.
  2. One wait for the core, with one budget. until, in the window tests of core/desktop/src/app/view.rs, runs the window's tasks until a condition holds. It fails after 60 s (ANSWER_WITHIN), at the line that waited (#[track_caller]). Before, each module had its own copy of the loop, with budgets from 2 s to 30 s:
    • said (view.rs) is built on until. The copy of said in chats.rs is gone; chats uses view's.
    • The until/wait helpers in settings.rs, notifications.rs, drafts.rs, running.rs, backup.rs, stories.rs and view_once.rs call the shared until. Their signatures and call sites stay the same.
    • Four waits written out inline use it too: two in chats.rs (a chat picture read, a missing one let go), the reaction's answer in actions/mod.rs, and the core's answer to Esc after a failed history transfer in view.rs.
    • A test that passes still returns at the first check that sees the answer. Only a real hang waits the full 60 s.
  3. A press on GNOME's title bar no longer starts a text selection (core/desktop/src/app/layout.rs). The title bar's drag area calls gpui-base's GlobalState::suppress_text_selection on a press, as gpui-base's own controls that own a press do. The title bar is drawn only on GNOME's Wayland session.
    • Its test, a_click_or_a_pass_over_the_title_bar_neither_moves_nor_maximizes_the_window_nor_selects, moved the pointer to two fixed points of the window.
    • Now it passes the pointer down the timeline, where the others' messages start, and checks that the pointer went over message text before it checks that nothing was selected.

Why

The failure #305 saw came from the hour, not from the load.

  • The demo's files are 20 to 90 minutes old. Between about 00:20 and 01:00 local time, a day line falls between the newer messages. It lifts the photo the test clicks (file-3) until its centre is past the timeline's top. In a probe at 00:38, the photo's bounds ran from y −71 to 169. The click at its centre (y 49) landed on the chat's header, so nothing was asked of the core, and said reported "nothing was said".
  • With no load at all, main's binary fails this test at 00:20, 00:30, 00:40, 00:50 and 01:00. It passes at 00:00, at 00:10, every 10 minutes from 01:10 to 02:00, at 12:00 and at 23:50.
  • The long-history drawing test and the quit test no longer fail just because the machine is busy #305's load runs fell inside that window: its merged head was committed at 00:12 local time.
  • At noon local time, under 84 × yes on 12 cores (load average 106 to 171), main's binary passed this test 4 of 4 times alone. It also passed 3 of 3 full desktop runs, and 3 rounds of three full runs at once. The 2 s budget of said held there.
  • Scrolling the message into view, as a person would, makes the click independent of the hour.

The waits still had small budgets, copied twelve times. They were 2 s in six places, 5 s in two, 10 s in one and 30 s in one. Under heavier load they were the next thing to break. One shared budget, set by the slowest wait, removes that, and the diff deletes more test code than it adds.

  • The slowest wait is a backup's key derivation (Argon2), which takes seconds in a debug build: 0.5 to 9.8 s in the review's measurements.
  • The old backup loop allowed at least 30 s, so 60 s keeps room for it under load.

The title bar test only passed because its pointer missed the text.

  • The review's sweep found that this test also depended on the hour. From 00:42 to 00:44, a day line among the Family chat's messages moved text under its second point, and it failed.
  • A probe showed the two points were over no text at any other hour. When the pointer is moved over a message's text at any hour, the press on the title bar selects it. gpui-base's window selection begins on any press that nothing suppresses, then follows the pointer while that press lasts.
  • The test's own comment describes the case this matters for: when the compositor moves the window, it keeps the press's release, so on GNOME's Wayland session the text the pointer passes over afterwards would be selected.
  • The new test fails at 00:40, 00:43 and 12:00 without the fix. With the fix it passes at every time listed below.

Other tests and the hour. I ran the whole desktop suite with "now" set to different local times. Each time was set with a POSIX TZ string, for example TZ=HUSH-0:51 for UTC+0:51; chrono's Local honours it.

  • Main's binary, at 12:00, 00:05, 00:30, 00:50, 01:10, 01:35, 23:50 and 23:59: only the file-click test failed (at 00:30 and 00:50).
  • This branch's gated binary, at 00:00, 00:02, 00:04, 00:05, 00:20, 00:30, 00:40, every minute from 00:41 to 00:46, 00:50, 00:56, 01:00, 01:10, 01:25, 01:30, 01:58, 01:59, 02:01, 02:03, 02:07, 06:00, 12:00, 18:00, 23:50 and 23:59: 405 of 405 every time.
  • These times include every window in which a day line falls between two of the Family chat's messages (00:00 to 00:45 and 01:57 to 02:05), and every window of the Files chat (00:00 to 01:30). The other demos' windows are sampled, not each one.
  • The other window tests that click at a position find it by an element's bounds, or don't depend on the timeline's rows.

Not changed, on purpose:

  • Waits that check that nothing happens: polls.rs 100 ms, view_once.rs 100 ms twice, and the history Esc test's 2 s for the stages that keep the transfer. On a busy machine they check less, but they can't fail wrongly.
  • running.rs's asked.elapsed() < 1 s ("no second wait"): an upper bound on how long GPUI's own quit takes, not a wait for the core. It held in every run.
  • network.rs's the_monitor_reports_the_network_at_once (5 s): it waits for the system's network monitor, not the core. It is built without snapshot, where the window tests' helper doesn't exist. It held in every run.
  • notifications.rs's the_badge_counts_a_chat_again_when_its_mute_ends: it needs less than 30 ms between setting a mute and counting the badge. That is a different kind of real-time dependency, and it passed every load run. It is left for its own issue.
  • Production timeouts and their shorter test values (QUITTING_WITHIN, notifications' WAIT, running's WITHIN and CONNECT_WITHIN): unchanged.

How it was tested

  • make format && make check, on the head merged with main (through A reply or edit ends, as on Esc, when its chat can no longer be written in #306):
    • cargo fmt --check: passes.
    • cargo clippy --all-targets -q -- -D warnings: passes.
    • cargo clippy --all-targets --features hush-desktop/snapshot -q -- -D warnings: passes.
    • cargo test --features hush-desktop/snapshot -q: desktop 405 passed; sig-core 554 passed, 4 ignored.
  • Each test failed first:
    • The file-click test, unchanged, fails at 00:20 to 01:00 local time, as listed above.
    • The new title bar test fails at every time tried before the layout.rs fix.
    • Both pass at every time in the sweep above.
  • Under 84 × yes (load average 96 to 196):
    • The binary before the review fixes:
      • the file-click test alone: 10 of 10 at noon and 4 of 4 at 00:40;
      • full desktop runs: 2 of 2 at 00:41, and 6 at noon;
      • three full runs at once: 3 rounds, 9 of 9.
    • The gated binary:
      • the file-click test alone at 00:40: 5 of 5;
      • the title bar test alone at 00:43: 3 of 3;
      • full desktop runs: 3 of 3 at 18:00 and 2 of 2 at 00:43 (load 117 to 140).
  • A side effect of my clock trick. Two of the six noon full runs used offset UTC+11:59, and events::tests::failures_in_a_row_show_as_one_notice_answered_by_a_later_reset failed in them. That test's fixed NOON timestamp lands on 23:59 local time there, so its minutes cross midnight. No real time zone has that offset, and the test's own comment covers the real ones. Every other test passed in those runs.
  • I killed every load generator I started.
  • Not run: GNOME itself. GPUI's test platform can't run a Wayland session, so the title bar fix is checked only by its window test.
  • No snapshot: nothing drawn changed. The title bar change is in how a press is handled.

Closes #307

…sts wait for the core with one 30 s budget

The demo's files are 20 to 90 minutes old: from about 00:20 to 01:00 a day line between the newer
messages lifts the photo the test clicks under the chat's header, so the click missed it. The
test now scrolls the photo's message to the top first.

The waits for the core's answer (2 to 30 s, copied in twelve places) are one `until` in view's
window tests, failing after 30 s: a passing test returns as soon as the answer is seen.
…bar test passes the pointer over real text

The test moved the pointer to two fixed points of the window, which missed the messages' text
except from 00:42 to 00:44, when a day line among the demo's messages put one there; then it
failed, because the press did start a selection. It now passes down the timeline over the
messages' text and checks it did, and the title bar's press suppresses text selection, as
gpui-base's own controls that own a press do.

Review: the window tests' budget is 60 s, named after the slowest wait (a backup's Argon2), and
their waits fail at the line that waited; the file-click test checks its scroll and scrolls back
to the newest before the right-click.
@pitis pitis changed the title The file-click test no longer fails after midnight, and the window tests give the core 30 s to answer The window tests pass at any hour and give the core a minute to answer, and a press on GNOME's title bar selects no text Nov 30, 2026
@pitis

pitis commented Nov 30, 2026

Copy link
Copy Markdown
Owner Author

Review (/pr-review-toolkit:review-pr on git diff origin/main...HEAD)

Three reviewers ran: code, tests and comments. None found anything Critical. Each finding below says what I did about it. The fixes are in 70c16c9, gated on the head merged with main.

Important: fixed

  1. Another test depended on the hour, so "no other test" was wrong (tests reviewer).
    • The test: layout::window_tests::a_click_or_a_pass_over_the_title_bar_neither_moves_nor_maximizes_the_window_nor_selects failed from 00:42 to 00:44 local time, on main too. My sweep had sampled every 10 minutes and missed that window.
    • The cause: its two fixed pointer positions were over no text at any other hour. A probe showed that when the pointer passes over a message's text at any hour, the press on the title bar selects it, so the test passed only because it missed the text.
    • The fix: the test now passes the pointer down the timeline, where the others' messages start, and checks that it went over text. The title bar's press now calls GlobalState::suppress_text_selection, as gpui-base's own controls that own a press do.
    • Proof: the new test failed at 00:40, 00:43 and 12:00 before the fix. It passes at every sampled time after it, including every minute from 00:41 to 00:46.
    • The PR body now lists exactly which times were run, instead of making a general claim.

Suggestions: taken

  1. Backup's wait had less room than before (code reviewer). The old loop allowed at least 30 s, and its waits take up to 9.8 s. ANSWER_WITHIN is now 60 s, and its doc names the slowest wait (a backup's Argon2) as the reason (comments reviewer).
  2. #[track_caller] on until, said and the module wrappers (code reviewer). A timeout now names the line that waited, not view.rs.
  3. The file-click test asserts that scroll_to_item scrolled. It also scrolls back to the newest message before the right-click on file-7, so that click no longer depends on how far the first scroll moved (tests reviewer).
  4. Comments:
    • The files.rs comment now says the photo's centre goes past the timeline's top and onto the header, "just after midnight".
    • said's doc says the error is taken.
    • The history Esc comment says the wait is a fixed 2 s, and why it can't fail wrongly.
    • The wording about the 6 noon runs in the PR body is clearer (code reviewer).

Declined

  1. A #[should_panic] test of until's timeout (tests reviewer, who called declining reasonable). It would wait the full 60 s on every run, and the loop is short enough to check by reading.
  2. Rewording the older what strings ("the core didn't answer", "it didn't happen"; comments reviewer). They read fine followed by ": not in 60s", and renaming them changes nothing about what they check.
  3. notifications.rs's 30 ms mute in the_badge_counts_a_chat_again_when_its_mute_ends (tests reviewer). It needs less than 30 ms between setting a mute and counting the badge. That is a real-time dependency of another kind, not a wait for the core. It passed every load run, and is left for its own issue.

After the fixes

  • make check on the merged head: fmt, both clippy runs and the tests (desktop 405, sig-core 554 plus 4 ignored) all pass.
  • The full desktop suite at 29 local times from 00:00 to 23:59: 405 of 405 each time.
  • Under 84 × yes (load average 96 to 140), every run passed:
    • the file-click test: 5 of 5 at 00:40;
    • the title bar test: 3 of 3 at 00:43;
    • full runs: 3 of 3 at 18:00 and 2 of 2 at 00:43.

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.

The desktop tests' wait for the core's answer holds on a very busy machine

1 participant