Skip to content

Make the bridge screen tests wait for saves, not for time - #16

Merged
dhivadhiva merged 3 commits into
mainfrom
fix/tests-wait-for-saves
Nov 16, 2026
Merged

dhivadhiva merged 3 commits into
mainfrom
fix/tests-wait-for-saves

Conversation

@dhivadhiva

Copy link
Copy Markdown
Contributor

Why

main fails on Linux arm64 and Windows x64 since 1.6.0 was merged, and
the same failures block #13 and #14. Three widget tests are the cause:

  • bridge_one_click_test.dart: "leaves a bridge that was already on
    alone" and "starts from what is shared, and Save writes the ticked
    set"
  • ai_bridge_screens_test.dart: "a Windows path with spaces makes valid
    JSON"

Their settle helper waited a fixed time. Saving a pairing or a host
writes a file and runs chmod as a separate process, which needs both
real event-loop time and timers on the test's fake clock. On a slow
runner the save had not finished when the test moved on.

What changes

Tests only; nothing under lib/.

  • test/support/settle.dart: settleWhile turns both event loops and
    advances the fake clock until nothing is busy for two turns in a row,
    with a 30 second real-time limit.
  • test/support/tracked_stores.dart: subclasses of the real
    HostStore, BridgeClientStore and BridgeAuditLog that count the
    calls still running.
  • Both test files use them: settle waits until no store call is
    running and no progress indicator is showing.

No assertion changed, nothing is skipped, and no fixed delay was added.

Evidence

Each of the three tests passed 20 of 20 runs, and 10 of 10 pinned to one
busy core at the lowest priority. The same loops were not run against
the old helper here; the proof that it fails is CI's own runs.

Local CI on a clean checkout passed.

Order

Merging this first turns main green. #13, #14 and #15 can then be
re-run. #15 already contains this change.

Three widget tests fail on slower runners (Linux arm64, Windows x64).
Their settle helper waited a fixed time. Saving a pairing or a host
writes a file and runs chmod as a separate process, which needs both
real event-loop time and timers on the test's fake clock, so on a slow
runner the save had not finished when the test moved on.

The helper now waits until no store call is running and no progress
indicator is showing. Tracked subclasses of the real stores count the
calls still in flight. No assertion changed and nothing is skipped.

Each of the three tests passed 20 of 20 runs, and 10 of 10 pinned to
one busy core.
The Flatpak job updates the GNOME SDK that ships inside the build
container. On some hosted runner images that update stops with
"Invalid cross-device link" and the builder crashes, because the
installation lives in the image and its directories cannot be renamed
there. Copy the installation into the container's writable layer before
the build, so the update works whichever runner the job lands on.
The outbound stream's failure was swallowed with catchError and a
handler that returns nothing. The socket's future carries its own type
at run time, so that handler was refused and the failure surfaced as an
uncaught ArgumentError whenever a peer left before its reply was
written. Handle it with a typed then/onError instead.
@dhivadhiva
dhivadhiva merged commit dbeb0a7 into main Nov 16, 2026
16 checks passed
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