ci: the wai-quantum legs build the commit they test, and fail when they did not #666
Loading…
Reference in a new issue
No description provided.
Delete branch "ci/quantum-archive-mtime"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What was wrong
Seven wai-quantum workflows (processors, dsp, dataflow, sme, tensor-engine, tensor-program, vector) fetch the forge's archive of the commit, extract it to the same path in every job container, and build into a target directory kept in the runner's
/ci-cache.targave every file its commit's time, and cargo takes a crate as built when no source file is newer than its last build. So a leg whose commit was older than the cache's last build ran the binary another commit had built there, and its result said nothing about its own code.Measured on 5 Nov (job logs, every emulated leg from 15:00 to 19:00 EST):
Compiling wai-quantumline, each on a binary from a commit whosewai/wai-quantumdiffers (1 to 13 files): 6 of #646's 7 finished legs, #645 powerpc64le, #648 i686, #659 aarch64, loongarch64 and s390x, and others.frame_referencetests against #662's check for three. #662's code passes on both targets when built fresh in the pinned images.The change
tar -xmf: every file gets the time it was extracted.flockafter its extraction, and legs wait on it for many minutes. Another run can build in the cache meanwhile, and then this run's files are the older again. So every step that builds touches the extracted tree (find ../.. -type f -exec touch {} +) once it holds the lock. That is 10 steps: processors 1, dsp 3 (one per target directory), dataflow 2, sme, tensor-engine, tensor-program's cpu leg and vector's container leg 1 each.Compiling wai-quantum v<version>, anchored, so it cannot match wai-quantum-cli, -service or -writer. A build that compiled nothing fails the leg with "the build compiled no wai-quantum: its tests ran a binary already in the cache". Dataflow's encoder build drops-qso its lines are visible.Cost: each of those steps recompiles wai-quantum (about 35 s to 4 min per leg in the 5 Nov logs), which every leg that tested its own code already paid. Registry dependencies stay cached.
Not changed: the host-runner legs (macOS, linux-hw, linux-amd, linux-arm64). They check out with git into a fresh tree, so their files carry the checkout's time. The hardware legs that share
$HOME/hw-targethave a narrower form of the same race, through cargo's own lock on the target directory, if two run at once on one host. That is left for a separate change.No changelog entry: nothing under
wai/changes, andscripts/check-changelog-fragment.pyasks for one only then.An open pull request picks this up only once its branch has it (a pull request runs its head's workflow file), so the open wai-quantum PRs need main merged in after this lands.
The guard's proof
I took wai-quantum-processors.yml's two steps from git, this commit's and main's, unchanged except for the target (native x86_64), the head SHA and the cache path. I ran them on the Linux x86_64 build host against one persistent cache, with no rustup on PATH, as in the job container. X is #660's head and Y is main; both have two
frame_referencetests, so a stale binary passes every test-count check and only the guard can tell.Compiling wai-quantumlinestar -xfand main's step, i.e. main todaythe build compiled no wai-quantum: its tests ran a binary already in the cache-m, then another run builds X before Y holds the locktar -malone does not close the raceApplied to the 5 Nov job logs, the guard's pattern fails #662's three stale jobs (86809, 86815, 86773) and passes the fresh ones (86810, 86631).
Also checked locally: all seven files parse, and every changed step goes lock, refresh, first build, guard, in that order.
check-workflow-concurrency.sh,check-wasmtime-pin.pyandcheck-tests-in-ci.pypass. The branch merges cleanly with #662, the one open pull request that edits these files.🤖 Generated with Claude Code