Skip to content

Persistent PTY live test: the post-resize screen read on Windows can miss the echoed line #544

Closed

Description

@Blind-Striker

PersistentPtyLiveTests.Terminal_Lifecycle_Should_Round_Trip_Or_Answer_The_Daemon_Absent_Arm can fail on Windows at its server-side screen check. This test path is new: from the v2.1.x pin on (#532), Windows runs the daemon-present arm.

Observed: PR #543's CI (Windows, net10.0 only; net11.0 and net472 passed in the same run). The change under test was documentation and XML only:

AssertionException: Expected to contain "sdk-live" but received "PowerShell 7.6.7 PS D:\>                            "
  at Assert.That(read.Read!.Screen.Text).Contains(EchoMarker)

The same test passed on all three Windows target frameworks in #532's CI.

Likely cause: DriveRoundTripAsync performs four steps in order:

  1. it writes the echo command;
  2. it reads the stream until the echoed marker arrives (that assertion passed);
  3. it resizes the terminal;
  4. it asks the server for its screen (PersistentPtys.ReadAsync) and expects the marker on it.

On Windows a resize can make ConPTY repaint the console, and a screen snapshot taken after the repaint can hold only the prompt. Whether the repaint lands before the read is timing-dependent, so the check is nondeterministic there. Linux and macOS have not shown it.

Proposed: keep the assertion on what the server reports, and make it deterministic on every OS. Either read the server's screen before the resize, while the echoed line is still on it, or poll the screen read until the marker appears within an explicit bound, so it fails on its oracle, not on a timeout. Do not weaken the check to the stream alone; the screen read is what proves the read route selects this session's terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions