S02-02 - CI
Purpose: How the CI workflow runs the checks, which jobs a pull request or push skips, and the Go and Swift caches.
Design
Section titled “Design”CI uses jdx/mise-action,
SHA-pinned, to install the toolchain. Then it calls mise run <task>.
CI keeps independent parallel jobs per language. Each job re-installs the toolchain. The mise cache makes this cheap, and the logs stay readable.
Change detection
Section titled “Change detection”On a pull request and on a push to main, CI skips a job whose inputs
did not change. scripts/ci-changes.mjs maps the changed files to jobs
and runs every job when in doubt. A pull request’s changed files are its
merge commit against the base branch. A push’s are the last passed
commit against the pushed commit. The last passed commit is the head of
the newest ci.yml run on main, from a push or workflow_dispatch,
that passed. The detect job reads it from the GitHub API, with a token
that has actions: read and only on a push.
The push runs every job instead when it can’t find that commit: the API
call fails, takes more than 30 seconds or lists no such run. So does a
commit that isn’t in the checkout or isn’t an ancestor of the pushed
commit (a force push). It also runs
every job when the checkout isn’t the pushed commit, and on any other
error. workflow_dispatch runs every job.
mise run ci always runs every check. The CI result job is the one
required check (docs/github-settings.md). It needs every job but the
vulnerability scan, and fails unless each passed or was skipped because
detection said so.
Jobs with inputs of their own
Section titled “Jobs with inputs of their own”The scripts job runs scripts:test, the tests of scripts/, which are
part of mise run test and so of mise run ci (I320I320 (closed): CI: run scripts:test in mise run ci and the CI workflowFollow-up from the review of #315 (#120).). It runs when a
file of scripts/, a workflow, renovate.json or a tool pin changed,
because ci-changes.test.mjs reads ci.yml.
The actions job (workflow lint, zizmor, the Renovate config check) runs
when a workflow, .github/actions, renovate.json or a tool pin
(.mise.toml, mise.lock) changed.
The vuln job runs when any of these changed:
- a lockfile:
go.sum,go.work.sum,bun.lock,Package.resolvedormise.lock; osv-scanner.toml, a Go module file or the Go toolchain pin;- any Go source file, because govulncheck reads which functions are reachable.
vuln.yml runs the same task every day, which finds an advisory
published against an unchanged tree (I827I827 (closed): CI: skip actions, vuln and CodeQL when their inputs didn't change, and apply change detection to pushes to mainscripts/ci-changes.mjs (#58, #753) skips the Go, Swift and docs site work on a pull request whose inputs did not change.). So vuln isn’t one of the
checks that every push to main runs. It runs on a push to main that
changes its inputs, and daily. Skipping it on a pull request that
changes none of them can’t hide a finding, and a skipped check counts as
passed for the ruleset.
Other workflows on a push to main
Section titled “Other workflows on a push to main”The CodeQL workflow runs unless every changed file is Markdown, under
docs/, in the Swift package or under .claude/, or is a Swift lint
or format config, an issue form or a label file. The filter
is paths-ignore, so a path nobody listed runs it. Its weekly schedule
covers what a skipped push didn’t. CodeQL Swift has an inclusion
filter of its own.
The docs site deploy runs on a push that changes docs/, the site’s
package, a Markdown file, the tool pins or its own workflow. The site
renders only docs/ and its package
(packages/wraithbox-doc/src/plugins/specs.mjs).
The fuzz smoke and the Windows leg
Section titled “The fuzz smoke and the Windows leg”A pull request into main also skips the fuzz smoke and the Windows leg
of the Go job (I753I753 (closed): ci: run the fuzz smoke and the Windows Go leg on pushes to main, not on every pull requestOn 2026-11-10 CI ran 1,328 jobs over 107 runs.). The local mise run ci gate runs both checks before each
push: go:fuzz, and go:cross, which vets, lints, and builds for
Windows. Only a test that fails on Windows alone waits. When detection
fails, the run includes both.
A push to main runs them, and so do workflow_dispatch and a train’s
pull request into main (head train/**, base main). The train’s
pull request runs each time a builder’s work merges into the train, so
during a campaign they run about once an hour and catch a break before
it reaches main.
A pull request from a builder into a train (base train/**) runs the
Windows leg and skips the fuzz smoke (I971I971 (closed): ci: run the Windows Go leg on pull requests into a trainA builder's pull request into train/ skips the Windows leg of the Go job (#753, S02-02-ci, "The fuzz smoke and the Windows leg").). A campaign ends when CI
fails on its train, so a test that fails on Windows alone and first
runs on the train after its merge stops the campaign. That stopped
campaigns I792I792 (closed): Campaign 2026-11-28 (V1-M3-network-floor, lane mac)/campaign --lane mac --vm-slots 2 --hours 12 --usd 300 --issues 40 --prs 40 and I954I954 (open): Campaign 2026-12-01 (V1-M3-network-floor, lane mac)/campaign 5 --lane mac --vm-slots 2 --hours 10 --usd 300 --issues 40 --prs 40. The leg costs a Windows runner for each Go
pull request in a campaign. The fuzz smoke stopped no campaign, and
go:fuzz in mise run ci runs it before each push.
The rule that mise run ci and the workflow run the same checks holds
for the workflow as a whole. Every check whose inputs changed runs on a
push to main, and mise run ci stays the full gate.
Every change is tested at least once, and running a check twice is better than not running it. A passed run tested each job whose inputs changed since the passed run before it, and skipped the others, whose inputs hadn’t changed. So every job has passed on the inputs of the last passed commit, and the next push tests every job whose inputs changed since then.
A run that was cancelled, never started or failed doesn’t move that
commit. The next push tests its changes again, and a failed change can’t
be hidden by a later push that changes only docs. Each push to main
also has its own concurrency group and is never cancelled by a newer
push. Two runs at once then test each other’s changes, which is fine. A
cache save to a key that exists only logs a message.
This holds for ci.yml only, with these limits:
- The
CodeQLworkflow and the deploy of the docs site filter by the paths of their own push and don’t look back. EachCodeQLrun scans the whole tree, so a cancelled one is covered by the next run and by the weekly schedule. The deploy builds the whole site, so the next push that deploys covers a cancelled one. - A job runs on the inputs that changed, not on a world that changed
around them. The daily
fuzz.ymlandvuln.ymlcover that for the fuzz targets and the dependency scan. - The rule starts with the push that brings it. Before that, every
push to
mainran every job, so any earlier passed run onmainis a sound base. That push changesci.ymlandscripts/, so it runs every job too. - A run passes only when every job that ran passed, the
vulnscan included, althoughCI resultdoesn’t list it. While a new advisory keeps the scan red, the last passed commit stays where it was, and each push runs every job whose inputs changed since then. That costs runner time and hides nothing.
Symbolic links run every job, because a tool follows a link, and a
change to its target changes the link’s path too. Chains, linked
directories and targets outside the repository make that hard to follow.
Detection runs every job when a tracked symbolic link at HEAD isn’t on
the allowlist (today CLAUDE.md -> AGENTS.md) or has another target.
It does the same when a changed path is or was a symbolic link (added,
deleted or retargeted), and when it can’t list the links. A new symbolic link means
a full run until it is on the allowlist in ci-changes.mjs, with a test
that the rules for its own path give no job beyond its target’s.
The Go job’s own checks
Section titled “The Go job’s own checks”The Go job’s Linux leg runs go:worksum-check, which fails a pull
request that leaves go.work.sum stale, a Renovate update included
(S02-03-dependency-updatesS02-03-dependency-updates: Dependency UpdatesHow Renovate keeps every pin current, and what it leaves to the maintainer., “go.work.sum”). One leg is enough, because
the check lists the packages of every GOOS itself. mise run ci runs
it in lint.
The Go module cache
Section titled “The Go module cache”The Go and fuzz smoke jobs restore the Go module cache. Without it every
job downloads the whole module graph, and one slow fetch fails the job
(I723I723 (closed): ci: Go jobs fetch every module from proxy.golang.org on each run, and a fetch timeout failed go:lintFollow-up of #547 (flaky CI runs of the week of 2026-10-26).). The key is the runner OS and architecture and a hash of the
go.sum files and go.work.sum. With no exact match, a run restores
the newest cache of the same OS and architecture.
Only a push to main saves it, from the Go job’s Linux, macOS and
Windows legs, each under its own key, and only when no cache had that
key. A pull request restores and never saves, so it can’t write a cache
that main restores (the cache poisoning audit of zizmor, mise run audit). The fuzz smoke shards run on Linux and restore the key the Go
job’s Linux leg saves, without saving.
Go checks the cached .mod and .ziphash files against go.sum when
it downloads and reads a module, but it doesn’t hash the extracted files
and the zip again. So each job runs go mod verify (mise run go:modverify), which does, right after the restore. A miss costs time
and nothing else, and no step retries a fetch.
The Swift job
Section titled “The Swift job”A change to the Go module alone runs the build, sign, and bundle steps
of the Swift job, because the app bundle holds the Go programs, and
skips its lint, contract, and test steps. It also skips the build of
wb-vmd with the test data root (S06-05-disksS06-05-disks: DisksA VM's system disk and data disk: how the data disk keeps what the guest flushes, and how the guest mounts it., “Test data root”),
which doesn’t read a Go file, unless the run saves the cache. The Go files that the Swift build reads are the exceptions: go.mod, go.sum, the version package
and the stamping tool run the whole Swift job, like the other Swift
inputs, such as Swift sources, the contracts, and the version stamp.
The Swift job caches SwiftPM’s .build, the compiled dependencies,
keyed on the runner image, the runner architecture (RUNNER_ARCH), the
Xcode version, Package.swift, and Package.resolved. Each run
restores it. Without an exact match, a run restores the newest cache of
the same image, architecture, and Xcode, whatever its Package.swift
and Package.resolved (restore-keys).
A push to main saves it, and a pull request doesn’t, so a pull request
can’t write a cache that main restores. Before the save, the job
deletes what every run builds again, such as the package’s own programs
and debug symbols. What the cache keeps is mostly the compiled
dependencies. A miss costs time and nothing else: no step depends on a
hit, and tests always run.
A push to main that skips the Swift job leaves the cache as it was.
The key’s files, Package.swift and Package.resolved, run the Swift
job when they change, so a skipped push has nothing new to save.
Status: Active