CI: self-hosted jobs run the aft binary their own build produced

Merged
AF
2h ago
+292-35

Main's Tests run 45211694839 failed "E2E (Windows native)" with no code at fault. Self-hosted runners (narli, mac-mini) share one Cargo target folder. A release/0.67 run had built 0.67.1 into it; main's build of 0.67.0 found its unit fresh ("Finished ... in 0.63s") and left the 0.67.1 aft.exe in place; the plugin then refused it ("reports 0.67.1, expected 0.67.0"). With two commits of the same version, these jobs could test another commit's binary without any error.

Changes:

  • Each of the six steps that built into the shared folder and then ran or packaged the uplifted binary (Windows and macOS E2E, macOS Bun conformance, Windows bash-permission E2E, Windows x64 and ARM64 release) now builds its final output into a job-private CARGO_TARGET_DIR. The shared folder stays as CARGO_BUILD_BUILD_DIR, so dependencies stay warm.
  • scripts/ci-stage-aft.py takes the executable (and, for release, the PDB) from Cargo's JSON record and copies it into the job folder. The aft bin is keyed with -C metadata=aft-<commit>.
  • On Cargo 1.99 with MSVC, deps/aft.exe has no per-unit name, so the script deletes only that file and its PDB before building; Cargo relinks aft and keeps every dependency. The workaround is skipped on Cargo 1.100 and later.

Evidence: a native Windows A → B → A → A build staged 0.67.0 → 0.67.1 → 0.67.0 → 0.67.0 with matching PDBs; the old layout staged 0.67.1 on the return to A. A new workflow test fails on the old Windows and macOS E2E paths. All 139 workflow and native-release tests pass. A GNU-stat test that cannot run on macOS is now Linux-only.


Summary by cubic

Fixes a race where self-hosted CI jobs (narli, mac-mini) shared one Cargo target folder and could stage a binary built from a different commit than the one under test. Each job's Windows and macOS builds now produce their final aft executable (and release PDB) in a private directory, while the shared folder stays as the warm dependency cache.

  • New scripts/ci-stage-aft.py stages the executable and PDB that Cargo reports, keying the aft bin with -C metadata=aft-<commit>.
  • On Cargo 1.99 with MSVC, the script deletes the unversioned deps/aft.exe and its PDB before linking to force a relink; the workaround is skipped on Cargo 1.100+.
  • All Windows and macOS E2E, macOS conformance, and Windows release jobs now run and package the job-private binary; artifact names and checksums are unchanged.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable regression was found.

Summary

Native CI now stages each job’s aft executable from Cargo’s reported output while keeping shared build files warm.

  • Native CI jobs use the aft binary built for their own run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Shared[Shared Cargo build files] --> Build[Job build]
  Commit[Commit-specific binary key] --> Build
  Build --> Private[Private Cargo output]
  Private --> Record[Cargo artifact record]
  Record --> Stage[Copy executable and optional PDB]
  Stage --> Tests[Native tests]
  Stage --> Release[Release packaging]

Reviews (1) · Last reviewed commit: "mason: relink the legacy MSVC aft output..." · Reviewed by Greptile