Repository navigation
test(native): await SSH fixture startup and exit - #181
Merged
Merged
Conversation
This was referenced Nov 3, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The fake SSH fixture polled PID files and process status against wall-clock bounds. Under parallel build load the fixture could fail before the fake process reached startup, even though shutdown worked correctly.
Replace every such wait in
crates/client/src/ssh/tests.rswith a nonce-bearing startup message over a loopback socket and EOF for exit. The fake launch and tunnels block on socket reads rather than sleeps. Unrelated HTTP probes and silent peers cannot block the startup event. The stop-script fixture now owns and concurrently reaps a process blocked on stdin rather than relying on a detached process's 30-second lifetime.Every startup caller watches its owner as well as the startup socket. Pending launch/tunnel attempts race their operation task; callers whose connection operation has already succeeded race the tunnel monitor's exit watch. An early failure is reported with the owning result instead of leaving the listener waiting forever. The failure branch takes priority over queued socket data.
A five-row regression covers launch exit, tunnel exit, EOF before a startup line, an invalid line, and a missing interpreter. It observes one poll after the owner has failed, making a missing completion branch fail immediately rather than hang the regression, then checks an in-flight operation too. With the previous waiting behavior this assertion failed; with the race it returns the operation's actual error. No sleep, polling loop, test timeout or retry is involved.
A shared scratch-directory guard is established before the remaining fallible fixture initialization, and also owns the stop-script test's directory. Both successful completion and unwinding clean up these directories without adding a dependency.
The SIGTERM-resistant quit test holds Tokio's monitor unpolled while reading EOF. It therefore proves shutdown sends the kill synchronously, without measuring elapsed time or relying on the async grace period. Removing production's synchronous SIGKILL temporarily makes this test fail with
fake ssh survived synchronous shutdown: survived; production code was restored.Audited the remainder of
crates/client: no other test uses this helper or a wall-clock polling loop. Existing local CLI process tests already use event sockets. No production race was found for the reported milestone: both spawn paths register the PID before their first await, and shutdown synchronously signals those registered process groups. Production behavior, CN-SSH and #88 are unchanged; no ledger edit is needed.Validation:
09b16e2539: interleaved 200 unchanged and 200 fixed complete SSH suites, eight concurrent workers, four test threads per suite, alongside an ownedcargo build -p t3-native, followed by required Clippy/workspace-test compilation. Every result is retained; no retries or increased bounds.launch.pid was never recorded, 7tunnel.pid was never recorded).cargo build -p t3-native,cargo clippy --workspace --all-targets -- -D warnings, andcargo test --workspacepassed (1,226 tests).packages/client-runtime, andvp run check:changedpassed.Local evidence:
/private/tmp/native-172-review-audit.txt: ownership-watch and cleanup changes./private/tmp/native-172-review-red.log,/private/tmp/native-172-review-green.log: failing/passing early-exit regression./private/tmp/native-172-review-load/,/private/tmp/native-172-review-load.py: updated 50-run transcripts, runner, summary and build log./private/tmp/native-172-review-workspace-tests.log,/private/tmp/native-172-review-clippy.log,/private/tmp/native-172-review-check-changed.log: updated gates./private/tmp/native-172-load/: runner results, per-iteration transcripts, summary, build-overlap details and build log./private/tmp/native-172-load.py: exact stress runner./private/tmp/native-172-audit.txt: full client audit and production-race assessment./private/tmp/native-172-mutation.log: missing synchronous kill is rejected./private/tmp/native-172-workspace-tests.log,/private/tmp/native-172-clippy.log,/private/tmp/native-172-check-changed.log./private/tmp/native-172-theme.log,/private/tmp/native-172-parity.log,/private/tmp/native-172-conformance.log.Closes #172.
Built with GPT-6.1 Sol in Codex