test(cmux-tui): the returning phone test waits until the daemon saw the phone leave

Merged
LA
2d ago
+26-0

Summary

Test-only. a_phone_back_at_a_larger_size_ends_the_hold (cmux-tui terminal_host_recovery, sized_attach) dropped the phone's connection and attached again at once. When the daemon had not yet read the old connection's end, the 53-column view was still attached, so the new 90-column view was capped by it, as a second view would be. The test failed once so in a loaded full nextest run (R-DAEMON-STATE S1.7 lane-on suite, hq job 126506486693: "the hold of the departed view capped the returning one", 53 columns, not 90) and passed alone 3/3 with the input lane on and 3/3 with it off.

The test now waits until list-clients no longer lists the phone before it comes back. The daemon removes a departed client from its registry and from its sizing state in one step under the sizing lifecycle lock (disconnect_client_with_notice), and a sized attach takes that lock too (attach_lifecycle.rs), so the return is ordered after the departure, which is what the test means to check.

No product change: the daemon behaves the same; only the test's own order is fixed.

Testing

  • No deterministic red: the race needs the daemon to read the old connection's end after the new attach, which happens only under load.
  • Fleet nextest, --arg test --arg sized_attach, at this head, 3 runs: fleet steps bd1c96fd800d812176bc9106, 336df8270941c27e8f461429 and 90d69ba0e99fe73c9233385c (hq runs 41833038540, 41833039048, 41833038236): 14 of 14 sized_attach tests passed in each, this test among them.

Observed / Not run

  • Observed: the fleet runs above.
  • Not run: macOS execution.

Changelog

none

Proof

No capture: test-only change.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes a race in a_phone_back_at_a_larger_size_ends_the_hold so the test no longer fails under load when the daemon hadn't yet processed the phone's dropped connection before it re-attached.

  • The test now waits until list-clients no longer lists the phone before re-attaching, so the return is ordered after the departure.
  • Test-only change; no product behavior changes.

Testing

  • Passed 14 of 14 sized_attach tests across 3 fleet nextest runs.
  • Not run on macOS.