rust-cache caches and, at save, prunes the registry, git and bin directories
under CARGO_HOME, with no input to leave them out. The cluster runners'
CARGO_HOME is a crate cache shared across jobs, and align-environment refused
it outright. When CARGO_HOME is the directory the runner names in
CRAFT_RUNNER_CARGO_HOME, rust-cache gets a job-private directory as its
CARGO_HOME, with or without align-environment; a CARGO_HOME the job sets
itself is still refused. GitHub-hosted runs take the same steps as before.
- rust-cache: a saving leg's crates entry is <job>-crates-<os>-<arch>-<parent run>-0, from
.ci-cache-meta/entry, so of two runs that restored the same entry only the first to finish
saves (GitHub refuses an existing key). Nothing restored gives -0-0; a cold build writes
-<run>-<attempt>. A saving leg gets CRAFT_CACHE_UNITS, a file for the build's Cargo JSON
messages; the name is outside the prefixes rust-cache hashes into its key.
- cache-trim: deletes every unit directory (<profile>/build/<package>/<hash>/) the record does
not name, before rust-cache's post step saves; rust-cache's own cleanup matches package names
only and keeps older builds of updated dependencies. No record, no change.
- cache-prune: for a caller job with actions: write. Keeps the newest rolling crates entry per
job/OS/arch, and of other rust-cache entries and named <name>-<sha256> entries removes an older
one once nothing used it since the newest was created. watch: prunes as the run's saving jobs
finish and ends when none is queued or running.
actions/rust-cache gains cache-workspace-crates and restore. With
cache-workspace-crates the entry also keeps the workspace crates' compiled
libraries and unit-test executables, as a rolling entry: a saving run writes
an entry of its own and every run restores the newest under the job's prefix,
since rust-cache never replaces an existing key. Both inputs default to
today's behaviour.
actions/restore-mtimes records the commit an entry was built from (and the
commits of the craft-i18n and craft-fonts checkouts), and after a restore
touches only the files that changed since then, so Cargo rebuilds only what
they reach.
actions/gate-run runs one of gate.yml's commands with its optional timeout.
gate.yml is unchanged; it moves to these actions in a separate change.
StepSecurity's v2.9.1 cut every target/<profile>/build entry at its last '-',
so Cargo's new build-dir layout (build/<package>/<hash>/) lost most dependency
packages from each saved entry. v2.9.3 checks the exact name first (#371 there)
and keeps the Windows path fix (#355 there) that v2.9.1 was pinned for.
The cache-version default moves to v2 once: rust-cache never replaces an
exact-key entry, so the pruned v1 entries would otherwise be restored as they
are until the lockfile changes.
The rust-cache key hashes the root [profile] tables except wasm-only ones (web, wasm-*), so a
web-profile edit no longer starts every native cache cold. A new warm-command input adds a
default-branch leg that runs only the build and saves the gate entry as soon as it succeeds,
instead of after the tests.
The fail-closed warning printed the caller's value with printf %q. That value is
configuration and a misdirected one can be a token, which the log has no use for, so
the warning names the policy instead of the value. Normalization is unchanged; a direct
test asserts a synthetic sentinel never reaches the log.
rust-cache's trim strips U+00A0 (NBSP) and the other Unicode spaces but leaves U+0085
(NEL) in place. The comment claimed it strips neither. Say what each one does: the
wrapper matches it on U+0085 and is deliberately narrower on U+00A0, so it is never
looser than the cache action. Comments and test intent only; the accepted-input policy
and its tests are unchanged.
rust-cache trims its save-if input and falls back to true when nothing is left, so a
whitespace-only value arrived at the shipped action as "save= " and granted a save the
caller never asked for. Emit one canonical word instead: an accepted true (ASCII
whitespace trimmed, ASCII case ignored) saves; empty, whitespace-only and unrecognized
values restore only, in a single GITHUB_OUTPUT record so a newline in the input cannot
override the decision.
Lock the gate's cache-write condition by tokens rather than substrings, and add an
event/ref/default-branch/dispatch truth table plus a gate-to-action contract test, so
an appended "|| true" or a dropped pull-request guard fails instead of passing. The
gate expression and its behaviour are unchanged.
step-security/rust-cache v2.9.2 ships an ES-module bundle. Its bundled
minimatch 3 calls require('path'), which throws in an ES module, so it
falls back to '/' as the separator. On Windows no cache path then
matches and every save fails with "Path Validation Error". Windows legs
never saved a cache and built every dependency from scratch.
v2.9.1 is a CommonJS (ncc) bundle with the same inputs. Pin it
everywhere rust-cache is used and add a test that keeps every pin on
the action's commit and off v2.9.2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FypgCXtSjB6e5jmy9Uq7u8
Disable Rust cache saves after failed runs and resolve CARGO_TARGET_DIR relative to the checkout. Use dated FreeBSD cache entries and skip a matching same-day save. Keep inherited-target tests independent of the caller environment.
Contributor: @benandez.
Validated with the passing hosted test job, 95 focused passes plus one existing csh skip, and four inherited-target tests. Native Windows/FreeBSD VM and live cache-service execution were not claimed.
* ci: share the gate dependency-cache key and read-only restores
* fix(rust-cache): compare cache directories, not their spelling
A Windows runner spells one directory two ways: git-bash reports $HOME/.cargo as
/c/Users/x/.cargo, and a native tool or workflow input passes C:\Users\x\.cargo. The
align-environment guard compared the strings, so the first Windows caller copying the
README example exited 1 with "sets ...; drop the input". It now resolves both sides when
they exist and otherwise normalises backslashes, a drive letter and its case before
comparing. Refusing a genuinely different cargo home is unchanged.
Regressions cover both Windows spellings, a trailing separator, a drive letter in either
case, two different Windows homes, and a symlinked home that resolves to $HOME/.cargo;
the five positive cases fail against the previous guard.