Repository navigation
test(ci): retry transient wt-spawn ENOENT in the integration suite - #3119
Closed
worktrunk-bot wants to merge 1 commit into
Closed
worktrunk-bot wants to merge 1 commit into
worktrunk-bot wants to merge 1 commit into
Conversation
Integration tests spawn the built `wt` binary by absolute path
(`target/debug/wt`). If the file is momentarily absent at spawn time the
test fails hard with `Os { code: 2, kind: NotFound }` from insta-cmd's
spawn, and `terminate-after = 1` then fails the whole run.
The known cause of that window is real `cargo` rebuilding `wt` (unlink +
re-link on every invocation, a ~4% non-existence window measured locally;
see the test_source_flag_forwards_errors comment in shell_wrapper.rs).
Every in-suite path that could run real cargo against `wt` is already
shielded (stub cargo for the --source path; create_mock_cargo for the
hook/alias tests), so this is not a reproducible relink race in the suite.
What remains is a rare environment-level transient, observed once on macOS
CI (test_config_alias_show_lists_all, in a run that also reported 1 leaky).
A bounded retry scoped to binary(integration) is the proportionate fix: it
doesn't weaken coverage (a real assertion failure fails all attempts), and
a spawn flake that passes on retry is reported as flaky rather than
silently swallowed. Only integration tests spawn `wt` by path; lib/bin/
doctest tests call into the library in-process and cannot hit this.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.
Problem
The macOS
testjob on #3097 failed once with a hard spawn error, then passed on re-run:The
NotFound(ENOENT) comes from spawning the builtwtbinary. Integration tests spawn it by absolute path (target/debug/wt, viawt_bin()); if the file is momentarily absent at spawn time the test fails hard, andterminate-after = 1then fails the whole run with no recourse.Diagnosis
The known cause of a
target/debug/wtnon-existence window is realcargorebuilding it — cargo unlinks and re-links the output file on every invocation (a ~4% non-existence window measured locally), which races a concurrentspawn(target/debug/wt). This mechanism is already documented in the repo, in thetest_source_flag_forwards_errorscomment intests/integration_tests/shell_wrapper.rs.I searched the suite exhaustively for any path that still runs real cargo against
wtduring a test run. Every one is already shielded:--sourcewrapper path (cargo run --bin wt) stubs cargo so it execs the existing binary instead of relinking (shell_wrapper.rs);cargo …commands (merge.rs,user_hooks.rs) mock cargo viacreate_mock_cargo;cargo …strings are display/completion/approval tests that never execute the command.So this is not a reproducible relink race in the suite. What remains is a rare, environment-level transient spawn failure (the run also reported
1 leaky), which I can't reproduce on demand.Fix
A bounded nextest retry, scoped to
binary(integration)— the only tests that spawnwtby path:This is proportionate to a transient and doesn't weaken coverage: a real assertion failure fails all attempts, while a spawn flake that passes on retry is reported as
flaky(visible) rather than silently swallowed. Lib/bin/doctest tests call into the library in-process and can't hit this, so they're left untouched.Testing
cargo nextest list/runparse the new override cleanly (nextest rejects unknown override keys, so a bad config would error) andtest_config_alias_show_lists_allpasses.I couldn't reproduce the original flake locally (it's rare and macOS-specific), so this is a mitigation rather than a root-cause elimination — the deterministic relink sources were already eliminated in earlier work. Happy to take a different direction if you'd prefer to chase the residual transient further rather than retry it.