Skip to content

fix(xtask): eliminate nested-cargo build-lock stalls in workspace tests - #164

Merged
ractive merged 2 commits into
mainfrom
fix/xtask-dogfood-script-lock
Jul 19, 2026
Merged

fix(xtask): eliminate nested-cargo build-lock stalls in workspace tests#164
ractive merged 2 commits into
mainfrom
fix/xtask-dogfood-script-lock

Conversation

@ractive

@ractive ractive commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Four xtask tests spawned a nested cargo run -p xtask child to observe the binary's exit codes; nested cargo contends with the outer cargo test --workspace for the build-directory lock and stalled a cold workspace run 20+ minutes (observed twice on 2026-07-19, noted in iteration-124's out-of-scope).
  • Moved them (fn names preserved) to a new integration test crates/xtask/tests/bin_exit_codes.rs invoking the prebuilt binary via CARGO_BIN_EXE_xtask — Cargo only sets that env var for integration tests, which is why the unit-test location had forced the cargo run workaround.
  • Production spawns are untouched: check_iteration_ready's run_xtask dispatcher fallback and check_pre_fix_repro's worktree-scoped cargo test runs are functional code, not test-harness nesting. Zero nested-cargo spawns remain in any src unit test.

Test plan

  • cargo test --workspace -q: PASS in 1:47 wall, no stall (was 20+ min on cold builds)
  • cargo test -p xtask -q: PASS, 14.3s
  • cargo fmt / cargo clippy --workspace --all-targets -- -D warnings: clean
  • Moved test fn names preserved (kb iteration plans reference the live_* slugs)

🤖 Generated with Claude Code

ractive added 2 commits July 19, 2026 17:08
Three check_dogfood_script tests spawned `cargo run -p xtask -- ...` as a
child process to observe the xtask binary's real exit code, since a unit
test's current_exe is the test runner, not xtask. That nested cargo
invocation contends with the outer `cargo test --workspace` for Cargo's
build-directory lock: on a cold build it stalled a full workspace test run
for 20+ minutes (observed twice on 2026-07-19).

Move xtask_check_dogfood_script_missing_sentinel,
live_check_dogfood_script_fails_without_ff_rdp_live_tests_on_iter_branch, and
live_check_dogfood_script_skips_on_main_without_ff_rdp_live_tests into a new
integration test file (crates/xtask/tests/bin_exit_codes.rs), where
CARGO_BIN_EXE_xtask lets them invoke the prebuilt binary directly with no
nested cargo process at all. Function names and env-handling are unchanged
so existing kb iteration-plan references to the live_* slugs still resolve.

Remaining unit tests (run_inner-based happy/skip paths and
extract_iteration_number) stay in the src module untouched.
…o run

Same defect class as ae1fef0: xtask_check_iteration_ready_calls_dogfood_script
was a unit test that spawned `cargo run -p xtask -- ...` as a child process to
observe the binary's combined stdout/stderr, since current_exe inside a unit
test is the test runner, not xtask. That nested cargo invocation runs during
every `cargo test --workspace` and contends with the outer test run for
Cargo's build-directory lock — the same stall hazard being eliminated here.

Move the test into tests/bin_exit_codes.rs, invoking the prebuilt binary via
CARGO_BIN_EXE_xtask (integration-test-only env var) with no nested cargo
process. Function name and skip-list args are unchanged.

check_iteration_ready.rs's own Command::new("cargo") (in run_xtask, its
production sub-check dispatcher) is untouched — it's the real implementation,
not a test-harness spawn, and falls back to cargo run only when current_exe
isn't the xtask binary itself.
@ractive
ractive merged commit 8b1c291 into main Jul 19, 2026
10 checks passed
@ractive
ractive deleted the fix/xtask-dogfood-script-lock branch July 19, 2026 15:13
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