Repository navigation
ci: run cargo-affected jobs on the full OS matrix - #2810
Conversation
Both `collect-affected` (push to main) and `affected-tests` (PRs, advisory) ran only on ubuntu-24.04. Convert them to the same linux/macos/windows matrix the `test` job uses, so cargo-affected selection is exercised on every OS we ship. The fingerprint embeds `rustc -vV` (host triple), so a DB collected on one OS cache-misses the others; the existing `runner.os` cache key already namespaces per-OS, so each affected-tests leg pairs with a collect DB from the same OS with no key changes. Supporting fixes for the non-Linux legs: - `shell: bash` on the merge-base step (was defaulting to pwsh on Windows, breaking the `$(...)`/`$GITHUB_OUTPUT` heredoc) - Windows D: drive temp dir, mirrored from the `test` job - per-OS artifact name for the cargo-affected report upload Both jobs stay non-required / advisory while selection accuracy is calibrated against the full suite. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Per discussion: the migration to affected-only PRs must not be reached by making the required `test (*)` checks skip=pass on PRs. Relaxing the merge gate is a deliberate branch-protection change owned by the repo admin, not a silent workflow skip. Spell out the confidence bar (advisory legs agreeing with the required full matrix across a sustained run) and keep the periodic-full-run caveat. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
worktrunk-bot
left a comment
There was a problem hiding this comment.
CI diagnostic — calibration finding from the new Windows leg (no action needed for this PR; flagging for follow-up).
The new affected tests (windows, advisory) leg failed two unit tests in config::expansion::tests (test_expand_template_args_sequence, test_expand_template_args_shell_metachar_safety). The required test (windows) leg passes the same tests against the same source tree, so the divergence is in how the binary is invoked, not in what was compiled.
Root cause: shell_escape::escape (the platform-aware crate entry point used at src/config/expansion.rs:23 and applied in shell_join / the bare-{{ args }} formatter) does a runtime check:
pub fn escape(s: Cow<str>) -> Cow<str> {
if cfg!(unix) || env::var("MSYSTEM").is_ok() {
unix::escape(s)
} else {
windows::escape(s)
}
}wt hook pre-merge shells out through Git Bash on Windows (via detect_windows_shell in src/shell_exec.rs), which sets MSYSTEM=MINGW64, so the inherited env satisfies the MSYSTEM branch and the tests see POSIX escaping. cargo affected run is launched directly from GitHub Actions' default shell (pwsh on Windows) — no MSYSTEM, so the same code falls into the windows::escape branch and produces "bar baz" instead of 'bar baz'.
So the failure is a long-latent inconsistency the PR's expanded coverage surfaced — exactly the calibration value the advisory leg was added for. The advisory job is continue-on-error: true, the required matrix still passes, and the test pre-dates this PR (#2280).
The underlying production-code question is for a separate PR: CLAUDE.md mandates shell_escape::unix::escape() over the cross-platform entry point, but expansion.rs (and several other sites — llm.rs, commands/process.rs, commands/worktree/switch.rs, commands/picker/mod.rs) still import the cross-platform escape. Switching expansion.rs to unix::escape would make rendered {{ args }} consistent across PowerShell and bash on Windows and would unblock the Windows advisory leg for this kind of test.
Approval stands — this finding belongs to a follow-up, not to this PR.
Step 1 of moving PR CI onto cargo-affected: make the cargo-affected jobs run on every OS we ship.
collect-affected(push to main) andaffected-tests(PRs, advisory) were pinned toubuntu-24.04. This converts both to the same linux/macos/windows matrix thetestjob uses, so selection accuracy is exercised on macOS and Windows MSVC — not just Linux — before we lean on it.No cache-key changes were needed. The env fingerprint embeds
rustc -vV(host triple), so a DB collected on one OS naturally cache-misses the others, and the existingrunner.oskey already namespaces per-OS. Eachaffected-testsleg pairs with acollect-affectedDB from the same OS.Supporting fixes for the non-Linux legs:
shell: bashon the merge-base step (it was defaulting to pwsh on Windows, which would break the$(...)/$GITHUB_OUTPUTheredoc); the WindowsD:drive temp dir mirrored from thetestjob; and a per-OS artifact name so the matrix legs don't collide on upload.Both jobs stay non-required and advisory (
continue-on-error,fail-fast: false) — this is calibration, the fulltest (linux/macos/windows)matrix is still the required gate. cargo-affected officially supportsx86_64-pc-windows-msvc(whatwindows-2022provides) and macOS; it self-describes as early-stage, so the Windows coverage leg is the one to watch —fail-fast: falseand non-required status mean a flaky leg degrades gracefully rather than blocking.Next step (separate, not in this PR): gate the full matrix so PRs default to affected-only — that one also touches the branch-protection ruleset, so it needs its own change and discussion.
🤖 Generated with Claude Code