Skip to content

test(windows): ConPTY e2e coverage for the #124 parity fixes - #127

Merged
pquerna merged 3 commits into
mainfrom
paul.querna/windows-conpty-e2e-tests
Jul 29, 2026
Merged

test(windows): ConPTY e2e coverage for the #124 parity fixes#127
pquerna merged 3 commits into
mainfrom
paul.querna/windows-conpty-e2e-tests

Conversation

@c1-squire-dev

@c1-squire-dev c1-squire-dev Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Automated end-to-end coverage for the Windows/ConPTY parity fixes in #124,
whose evidence was host-run only. The suite is #[cfg(windows)] with no
Cargo-feature gate
, so the stock cargo test --workspace CI leg on
windows-latest runs it (the docker/bwrap suites stay feature-gated and
Linux-only). Six tests, one per fix:

  1. run | consumer no-hang — faithful cmd.exe pipeline repro; asserts
    the consumer sees EOF within 90s (the pre-fix hang lasted until the 15-min
    daemon idle timeout). Guards the win_spawn handle-inheritance allow-list.
  2. Startup DSR answered — new dsr_probe bin (src/bin/) enables VT
    input on its own console, emits ESC[6n, and prints the reply; without the
    take_pty_writes write-back it blocks forever and the sentinel never
    appears.
  3. tail --follow trailing bytes — a 200-lines-then-exit-fast child;
    asserts line200 arrives before the stream ends (exit_drained /
    DRAIN_GRACE) and that the stream ends at all.
  4. die descendant tree-kill — grandchild carries a per-test sentinel in
    its command line; Win32_Process verifies it is gone after die.
  5. signal SIGINT — ETX via the ConPTY input stops ping -t
    (wait --exit confirms).
  6. signal SIGBREAK — rejected with the actionable "cannot be delivered"
    error, not a false success.

Each test runs an isolated session + socket dir and ties the daemon to the
test process (AGENT_TUI_MONITOR_PARENT_PID) plus a best-effort
daemon shutdown on drop — parallel-safe, no orphaned daemons.

Testing

  • cargo check / cargo clippy --all-targets -- -D warnings for
    x86_64-pc-windows-msvc — the suite and dsr_probe compile for Windows.
  • cargo fmt --check, cargo test -p agent-tui-integration (Linux aarch64;
    the new file is cfg-stripped there).
  • The tests themselves require Windows: authored on Linux, so the
    windows-latest CI leg is their first execution environment. The DSR probe
    mechanics (VT-input read of the cursor reply) are the most likely spot to
    need a tweak after a real run.

🤖 Generated with Claude Code + Squire

pquerna and others added 3 commits July 29, 2026 18:19
Adds a #[cfg(windows)] integration suite with no Cargo-feature gate, so
the stock 'cargo test --workspace' CI leg on windows-latest runs it (the
docker/bwrap suites stay feature-gated and Linux-only). Six tests, one
per fix in #124:

1. run | consumer in a cmd.exe pipeline sees prompt EOF (win_spawn
   handle-inheritance allow-list; 90s bound vs the 15min idle timeout
   that masked the pre-fix hang).
2. Interactive pane's startup DSR (ESC[6n) is answered — new dsr_probe
   bin (src/bin) enables VT input on its own console, emits the query,
   and prints the reply; without take_pty_writes write-back it blocks
   forever.
3. tail --follow delivers a fast-exiting child's trailing bytes before
   the stream ends (exit_drained / DRAIN_GRACE).
4. die reaps the descendant tree (verified via Win32_Process with a
   per-test sentinel in the grandchild's command line).
5. signal SIGINT interrupts via ConPTY ETX (ping -t exits).
6. signal SIGBREAK is rejected with an actionable error.

Each test runs an isolated session + socket dir and ties the daemon to
the test process (AGENT_TUI_MONITOR_PARENT_PID) plus a best-effort
'daemon shutdown' on drop, so the file is parallel-safe and leaves no
orphaned daemons.

Verified: cargo check/clippy --all-targets -D warnings for
x86_64-pc-windows-msvc, cargo fmt --check, cargo test -p
agent-tui-integration (Linux aarch64; the new file is cfg-stripped
there). The tests themselves require a Windows host — the windows-latest
CI leg is the first execution environment.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Iteration 2 from windows-latest CI data (3 passed, 3 failed):

- run-pipe-eof: Rust's CommandLineToArgvW quoting (" for embedded
  quotes) collides with cmd /c's outer-quote stripping ('"...exe" is
  not recognized'). Write the pipeline to a .cmd file instead — cmd
  parses batch lines natively.
- dsr: probe read 0 bytes (reply never became readable stdin). Probe is
  now conpty_probe with MODE-SET/DSR-READ diagnostics, and the test
  parses the tail JSON envelope's data.text instead of raw stdout.
- sigint: the signal RPC succeeded (ETX written) but ping never exited —
  conhost's ETX -> CTRL_C_EVENT translation is mode- and Windows-
  version-dependent (author's Win11 e2e saw it land; windows-latest CI
  did not). Repin the test on the deterministic daemon-side half: ETX
  byte delivery to the child's stdin, via conpty_probe read-stdin.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
CI diagnostics showed the probe DID receive the cursor-position report
(DSR-READ:n=6:status=stop-byte, i.e. ESC[1;1R) — but printing it raw
into the pane means the pane's own terminal parser swallows the escape
sequence, so the stripped text showed an empty reply. Print
DSR-REPLY-HEX instead and assert the decoded shape
(ESC [ <digits> ; <digits> R).

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@c1-squire-dev
c1-squire-dev Bot force-pushed the paul.querna/windows-conpty-e2e-tests branch from 0ddc17d to 04d5119 Compare July 29, 2026 18:19
@pquerna
pquerna merged commit 0893007 into main Jul 29, 2026
17 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