ci(tests): the Swift suite runner's fake swift answers the binary-module guard

Merged
TE
16d ago
+60-17

Summary

tests/test_swift_testing_suite_timeout.py (ci-guards.yml's app-host-execution step "Validate Swift Testing suite timeout guard") is red on feat-cmux-next, with 21 failures and 1 error. It broke when e6c6b4a2a506 and a9d9b47dc978 made scripts/ci/run-swift-testing-suites.sh run scripts/ci/swiftpm-binary-module-guard.sh before its build. The guard calls swift package resolve and swift --version, and the test's fake swift scripts were written before the guard existed:

  • Hangs: fakes that hang on every call except the list call also hung the resolve, so the runner hit its 180 s deadline.
  • Purged builds: fakes that exit non-zero on the resolve made the guard drop its digest and purge .build. That deleted the direct tests' pre-built .xctest bundle ("no .xctest bundle", and the "Swift test suites:" summary went missing) and the settings export's warm Settings.bundle.
  • Recorded calls: fakes that record their calls saw the resolve as the first call (the debug-info test).

The fix is in the test only; the runner and guard are unchanged:

  • Every fake swift is now a small wrapper. It answers --version and package resolve itself and passes every other call to the test's own fake (write_fake_swift).
  • The tests that set up a warm .build stamp it with the fake toolchain's digest (keep_warm_build). That models a warm slot whose binary-target headers did not change, so the guard keeps their outputs.

Changelog

none

Testing

Focused command: python3 tests/test_swift_testing_suite_timeout.py

Observed / Not run

Observed: the file parses (ast) and the prepush gate passes. I checked the generated wrapper text statically.
Not run: the test itself. Python tests are not run on cosmic-gray; they run only on CI or Blacksmith Linux.

Agent session: cosmic-gray

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes tests/test_swift_testing_suite_timeout.py, which fails on feat-cmux-next because the runner's pre-build guard now calls swift package resolve and swift --version, calls the test's fake swift scripts predate. Fakes that hang on non-list calls stalled the resolve until the 180-second deadline; fakes that exited non-zero triggered a .build purge that deleted pre-built test bundles and the settings export's Settings.bundle; fakes that recorded calls logged the resolve as the first call. The runner and guard are unchanged.

Each fake swift is now a wrapper answering the two guard calls itself and delegating every other call to the test's own fake, and tests that set up a warm build stamp it with the fake toolchain's digest so the guard keeps their outputs.