feat(ci): read a registry build cache in the Runner image build (#21310)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The Runner is the part that executes agent work: a daemon
(`paperclip-runnerd`) and a provider pack of agent tools
> - `.github/workflows/runner-image.yml` builds the Runner alone and
publishes it from `master` as `ghcr.io/paperclipai/paperclip-runner`,
one time for each set of inputs
> - The build used no cache, so every run compiled the daemon again. The
first publication took 25m46s from push to tag
> - The toolchain and the daemon change only with the Rust sources. Most
commits that change the Runner's inputs do not touch them
> - This pull request lets the build legs read a registry build cache
for those stages. Only a new job can write the cache, and only for a
`master` push
> - A weekly run builds with no cache, so the cache cannot hide a broken
build for long
> - The benefit is about 3 minutes less on each build leg when the Rust
sources did not change, with no change to the published image

## Linked Issues or Issue Description

Refs #21230 (publication of the Runner image), #21229 and #21204 (the
build this change makes faster). No issue exists for this change.

**What existing behavior does this improve?**

The Runner image build in `.github/workflows/runner-image.yml`. It
builds the same image in less time.

**Current behavior**

Each build leg starts from an empty builder. It installs the Rust
toolchain and compiles the daemon in every run. In the first `master`
publication (run 43365670428) the amd64 leg spent 7m22s in the build
step. The toolchain and the cargo build took 3m26s of that.

**Proposed behavior**

The build legs read
`ghcr.io/paperclipai/paperclip-runner-buildcache:<arch>` for the stages
up to the compiled daemon. A new `cache` job writes that cache after a
publication. A scheduled run builds with no cache one time each week.

**Reason and benefit**

The stages before the last one read the Rust sources, the protocol files
and the toolchain pin. In the last 30 days, 438 `master` commits changed
an input of the image, and at most 181 of them changed a file those
stages read. For the other commits, and for each pull request that does
not touch those files, the build step is about 3 minutes shorter on each
leg.

**Breaking changes**

None. The `Dockerfile` and each file in the image identity are
unchanged. The published digest for a set of inputs does not change.

This is part 4 of 4 of a stack ([stack
#21309](https://github.com/paperclipai/paperclip/stack/21309)). Merge
the parts in order:

1. #21306: the resolver and the no-rebuild mode
2. #21307: the report-only job in `docker.yml` and the pull-request
check of the application image's Runner path
3. #21308: reading a retained provider pack from its Runner image
4. #21310: a registry build cache for the Runner image build (this pull
request)

This pull request uses no code from parts 1 to 3. It is stacked on them
because all four parts edit `doc/runner-image-contract.md`.

## What Changed

- The build legs pass `--cache-from
type=registry,ref=ghcr.io/paperclipai/paperclip-runner-buildcache:<arch>`
to the first build command. They do not log in. Their permissions stay
`contents: read` and `packages: read`.
- A new `cache` job writes the cache with `--cache-to
type=registry,...,mode=max` and `--output type=cacheonly`. It runs only
for a `master` push in the canonical repository, for inputs that had no
image. Its permissions are `contents: read` and `packages: write`. It
has no `id-token` and no `attestations` permission.
- The `cache` job needs the `publish` job, and no job needs the `cache`
job. A cache write cannot delay or fail a publication.
- The `cache` job builds the target `runner-artifacts-runnerd` and no
later stage. The last stage takes the commit as a build argument, so no
other commit can reuse it. The install and its dependency lifecycle
scripts are in that stage, so the job with the write token does not run
them.
- The `cache` job has one concurrency group for each architecture, a job
time limit and a step time limit.
- A `schedule` trigger starts a weekly build. It passes `--no-cache` to
the first command and reads no cache. It runs all checks and publishes
nothing. A fork's schedule runs nothing.
- `server/src/__tests__/runner-image-workflow.test.ts` pins the new
security properties: which jobs hold `packages: write`, that the build
legs have no credential and cannot write the cache, the conditions of
the `cache` job, that the `publish` job does not depend on it, and that
a scheduled run cannot publish or write the cache.
- `doc/runner-image-contract.md` has a "Build cache" section.

## Verification

Tests, on macOS (Node 26.12.0) and in a `node:24.22.3-bookworm`
container (Linux arm64, Node 24.22.3):

- `pnpm exec vitest run src/__tests__/runner-image-workflow.test.ts
src/__tests__/runner-image-identity.test.ts` in `server/`: 55 of 55
tests pass on both.
- `node --test .github/scripts/tests/*.test.mjs`: 807 of 807 tests pass
on both. The container needs `jq`.
- `pnpm verify` exits 2 for this change, because a workflow file is a
global CI input. Required CI supplies the broad coverage.
- Each new assertion fails when the workflow breaks its rule. I checked
seven such edits, for example: the `publish` job needs the `cache` job,
the `cache` job gets `id-token: write`, a build leg gets `--cache-to`.

Cache mechanics, on linux/arm64 with a local registry, BuildKit v0.34.2
(the version the hosted runners use), and an empty builder for each
build:

| Build of both variants | Time | Result |
| --- | --- | --- |
| No cache, cache ref does not exist | 260 s | An importer error in the
log, exit 0 |
| One changed TypeScript file, with the cache | 149 s | Toolchain and
cargo steps cached |
| Unchanged inputs and a new commit, with the cache | 129 s | Toolchain
and cargo steps cached |
| Each stage in the cache (a whole-build cache, which this change does
not write) | 16 s | Both OCI archives complete |
| `--no-cache` on the first command | 272 s | No cached step in the
first command. The second command reuses all of it |

- The images built from the cache pass `runner-image-layout.mjs check`
and `runner-image-oci.mjs check-layers`. The daemon has the same SHA-256
as the daemon of a cold build.
- A cache ref that does not exist, a host that refuses the connection, a
name that does not resolve, and the real
`ghcr.io/paperclipai/paperclip-runner-buildcache:arm64` (which does not
exist yet) each give an importer error in the log and a complete build
with exit 0.
- The `cache` job command on an empty builder with the cache present
takes 6 s. It downloads no layer.

Not tested before merge:

- The `cache` job. It runs only on `master`.
- The scheduled run. It starts only from the default branch.
- The cache package. It does not exist. I did not test a private
package, which answers an anonymous read with an authorization error. I
expect the same importer error and a cold build.
- A fully cached build on the hosted runners. The local test used the
same BuildKit version and a different buildx version (0.37.0, and the
runners have 0.38.1).

## Risks

- **A second job can write packages.** Before this change, only the
`publish` job held `packages: write`, and it runs no build. Now the
`cache` job holds it too, and it runs BuildKit on the repository's
`Dockerfile`. GitHub cannot limit that token to one package, so it can
also write to `ghcr.io/paperclipai/paperclip-runner`. The limits are:
the job runs only for a `master` push in the canonical repository, the
token goes only to the registry login, the build steps run inside
BuildKit without it, the job does not run the install, and the job
cannot sign. An image that it wrote has no attestation.
- **Part of a published image can come from an earlier run.** The daemon
in a published image can come from a step that an earlier `master` run
compiled and cached. The attestation names the run that published, not
the run that compiled. BuildKit reuses a step only for the same
instruction and the same file content, but a party that can write the
cache package can replace what a later build reuses. Write access to the
cache package must stay as narrow as write access to the image package.
- **A cached download is not repeated.** The toolchain installer, the
toolchain and the crates are not downloaded again until the inputs of
their step change. The weekly cold build finds a download that is gone.
It does not compare its output with the cache.
- **A registry failure after the cache import fails the leg.** A cache
that cannot be read at the start is not a failure. A layer download that
fails later is a failure. Run the job again.
- **The cache package starts private.** GitHub creates it on the first
write. A maintainer must make it public one time. Until then each build
runs cold and nothing fails.
- **The first cache write waits for an input change.** The merge of this
pull request changes no input of the image, so its `master` run builds
nothing and writes no cache.
- **A cancelled cache job marks its run as cancelled.** When three cache
writes for one architecture wait at the same time, GitHub cancels the
middle one. The image of that run is published.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.

## Model Used

Claude Fable 5.2 (`claude-fable-5-2`), Anthropic, through Claude Code.
Tool use and shell execution. It wrote the change, ran the local builds
and tests, and wrote this description.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Nicky LeachandClaude Fable 5.2 authored and GitHub committed 2026-11-12 23:46:15 -08:00
1 parent 4f4d823cfc
commit 503a736195
3 files changed
+191 -11

No files matched your search

+67 -4
View File
@@ -50,9 +50,11 @@ on:
- scripts/standard-image-contract.mjs
- docker/runner-image/**
workflow_dispatch:
schedule:
- cron: "23 6 * * 3"
# Least privilege: nothing at the workflow level. Only the publish job, which
# runs no build, can write to the registry or sign.
# runs no build, can write images to the registry or sign.
permissions: {}
# A newer push to a pull request replaces its older run. A master run has a
@@ -64,13 +66,14 @@ concurrency:
env:
IMAGE: ghcr.io/paperclipai/paperclip-runner
BUILD_CACHE: ghcr.io/paperclipai/paperclip-runner-buildcache
jobs:
identity:
name: Resolve the Runner image identity
# A fork's own pushes do not run this workflow. Pull requests and manual
# runs are not affected.
if: github.event_name != 'push' || (github.repository == 'paperclipai/paperclip' && github.repository_id == '1170821064')
if: (github.event_name != 'push' && github.event_name != 'schedule') || (github.repository == 'paperclipai/paperclip' && github.repository_id == '1170821064')
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
@@ -92,7 +95,7 @@ jobs:
version: 9.15.4
run_install: false
# No dependency cache: a restored cache must not reach a published image.
# No dependency cache: the Actions cache must not reach a published image.
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
@@ -209,7 +212,7 @@ jobs:
# Multi-arch by native runner, not QEMU, as in docker.yml. GitHub-hosted
# runners: the protected release fleets admit only docker.yml on master.
#
# These legs cannot write to the registry on any event, and they read and
# These legs cannot write to the registry on any event, and they
# write no registry build cache. The install runs dependency lifecycle
# scripts; the only token in the job can read packages, and only the lookup
# step receives it.
@@ -317,6 +320,8 @@ jobs:
timeout-minutes: 30
run: |
set -euo pipefail
cache=(--cache-from "type=registry,ref=$BUILD_CACHE:$ARCH")
if [ "$GITHUB_EVENT_NAME" = schedule ]; then cache=(--no-cache); fi
for variant in full slim; do
target=runner-artifacts
if [ "$variant" = slim ]; then target=runner-artifacts-slim; fi
@@ -328,7 +333,9 @@ jobs:
--provenance=false --sbom=false \
--output "type=oci,dest=$RUNNER_TEMP/runner-image/$variant.oci.tar" \
--metadata-file "$RUNNER_TEMP/runner-image/$variant.metadata.json" \
"${cache[@]}" \
.
cache=()
done
# The trees the checks below read are the layers of those archives,
@@ -665,3 +672,59 @@ jobs:
- name: Report images another run published first
if: steps.early.outputs.exists == 'true' || steps.prepush.outputs.exists == 'true' || steps.gate.outputs.state == 'published'
run: echo "\`$IMAGE:inputs-$DIGEST\` and its slim variant already exist. Another run published first; this run published nothing." >> "$GITHUB_STEP_SUMMARY"
cache:
name: Write the build cache (${{ matrix.arch }})
needs: [identity, publish]
if: github.repository == 'paperclipai/paperclip' && github.repository_id == '1170821064' && github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.identity.outputs.lock == 'current' && needs.identity.outputs.exists != 'true'
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
runner: ubuntu-latest
arch: amd64
- platform: linux/arm64
runner: ubuntu-24.04-arm
arch: arm64
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
permissions:
contents: read
packages: write
concurrency:
group: runner-image-buildcache-${{ matrix.arch }}
cancel-in-progress: false
env:
ARCH: ${{ matrix.arch }}
PLATFORM: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Login to GitHub Container Registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4
with:
buildkitd-config-inline: |
[registry."docker.io"]
mirrors = ["mirror.gcr.io"]
- name: Build the cached stages and write the cache
timeout-minutes: 20
run: |
docker buildx build \
--target runner-artifacts-runnerd \
--platform "$PLATFORM" \
--cache-from "type=registry,ref=$BUILD_CACHE:$ARCH" \
--cache-to "type=registry,ref=$BUILD_CACHE:$ARCH,mode=max" \
--output type=cacheonly \
.
+48
View File
@@ -216,6 +216,54 @@ repository and nowhere else. Other runs build and check, and publish nothing.
- **First publication.** GitHub creates the package private. A maintainer
must make it public once.
## Build cache
The build legs read a registry build cache,
`ghcr.io/paperclipai/paperclip-runner-buildcache:<arch>`. It is a package of
its own and holds no image, so the image package holds only attested images.
It covers the stages that do not take the commit: the Rust toolchain and the
compiled daemon. The last stage takes the source revision as a build
argument, so every build runs it: the frozen install, the Runner's build and
the provider pack. Of the two build commands of a leg, only the first reads
the registry cache; the second reads what the first left in the job's builder.
- **Effect.** BuildKit reuses a cached step only when the step and the
content of every file it reads are the same. The cache changes how long a
build takes, not what it builds, and the identity does not cover it.
- **Writer.** Only the `cache` job of the workflow writes it: on a `master`
push in this repository, after the publish job, for inputs that had no
image. When the image exists, nothing was built, and the run that published
it wrote the cache for those inputs. That job cannot sign, builds no further
than the daemon and never runs the install. Its token reaches the registry
login and no other step. It reads the cache it writes and keeps every step
of the cached stages (`mode=max`). Every other run reads the cache without
a credential and cannot write it.
- **Not on the way to an image.** No job waits for the `cache` job. When it
fails, the image is published and the next build is slower.
- **One write at a time.** The job holds one concurrency slot for each
architecture. GitHub keeps one waiting job in a group and cancels the one
that waited before it, so the newest write waits. A write from an older
commit that lands last costs time and nothing else.
- **No Actions cache.** The workflow never uses it: workflows that handle
pull requests can write it, and what they write must not reach a published
image.
- **Trust.** The daemon in a published image can come from a cached step
that an earlier `master` run compiled. Whoever can write the cache package
can decide what a later build reuses, so write access to it must stay as
narrow as write access to the image package.
- **Fetches.** A cached step does not run again. A download inside one (the
toolchain installer, the toolchain, the crates) is not repeated until the
inputs of that step change.
- **Weekly cold build.** A scheduled run builds both variants once a week
with no cache: it passes `--no-cache` and reads no registry cache. Like a
manual run, it resolves the lockfile, always builds, runs every check and
publishes nothing. A fork's schedule runs nothing. It fails when a download
is gone or when a step only works from the cache.
- **Missing cache.** A cache that does not exist or cannot be read is a
line in the build log, not a failure. The build then runs every step.
- **First write.** GitHub creates the cache package private. A maintainer
must make it public once. Until then every build runs cold.
## Reading the transport archives alone
The server needs the transport form of an older pack when a retained session
@@ -1,4 +1,6 @@
import { readFileSync } from "node:fs";
import { spawnSync } from "node:child_process";
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import os from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";
@@ -32,18 +34,84 @@ describe("Runner image workflow", () => {
const steps = (job: string) => job.slice(job.indexOf("\n steps:\n")).split(/\n(?= {6}- )/).slice(1);
const credential = /github\.token|secrets\.|GITHUB_TOKEN|REGISTRY_PASSWORD/;
it("lets only the publish job write to the registry or sign", () => {
it("lets only the publish job write images or sign, and only the cache job write the build cache, never the Actions cache", () => {
expect(workflow).toMatch(/^permissions: \{\}$/m);
expect(Object.keys(jobs)).toEqual(["identity", "build", "publish"]);
expect(Object.keys(jobs)).toEqual(["identity", "build", "publish", "cache"]);
expect(permissions(jobs.identity)).toEqual(["contents: read", "packages: read"]);
expect(permissions(jobs.build)).toEqual(["contents: read", "packages: read"]);
expect(permissions(jobs.publish)).toEqual(["contents: read", "packages: write", "id-token: write", "attestations: write"]);
expect(permissions(jobs.cache)).toEqual(["contents: read", "packages: write"]);
for (const job of [jobs.identity, jobs.build]) {
expect(job).not.toMatch(/docker\/login-action|skopeo|imagetools create|actions\/attest|secrets\.|--push|push=true/);
expect(job).not.toMatch(/docker\/login-action|skopeo|imagetools create|actions\/attest|secrets\.|--push|push=true|cache-to/);
}
expect(Object.keys(jobs).filter((name) => jobs[name].includes("cache-to"))).toEqual(["cache"]);
expect(jobs.cache).not.toMatch(/skopeo|imagetools|actions\/attest|--push|push=true|type=image|type=oci|upload-artifact/);
expect(workflow).not.toMatch(/type=gha|actions\/cache/);
expect(workflow).not.toMatch(/pull_request_target|workflow_run/);
});
it("writes the build cache only for a master push in the canonical repository, never on the way to publication, with the token in the login step alone and no stage past the daemon", () => {
for (const job of [jobs.publish, jobs.cache]) {
expect(jobCondition(job).startsWith(`${canonical} && `)).toBe(true);
expect(jobCondition(job)).not.toContain("||");
}
expect(jobCondition(jobs.cache)).toContain("needs.identity.outputs.lock == 'current'");
for (const job of Object.values(jobs)) expect(/^ {4}needs: (.+)$/m.exec(job)?.[1] ?? "").not.toMatch(/\bcache\b/);
const withCredential = steps(jobs.cache).filter((step) => credential.test(step));
expect(withCredential).toHaveLength(1);
expect(withCredential[0]).toContain("docker/login-action@");
const building = steps(jobs.cache).filter((step) => step.includes("docker buildx build"));
expect(building).toHaveLength(1);
expect([...building[0].matchAll(/--target (\S+)/g)].map((match) => match[1])).toEqual(["runner-artifacts-runnerd"]);
expect(jobs.cache).not.toMatch(/pnpm|setup-node|node scripts/);
});
it("neither publishes nor writes the cache from a scheduled run, and runs nothing on a fork's schedule", () => {
expect(workflow).toMatch(/^ {2}schedule:\n {4}- cron: /m);
expect(canonical).toContain("github.event_name == 'push'");
expect(jobs.build).toContain(`KEEP_IMAGE: \${{ ${canonical} }}`);
expect(jobCondition(jobs.identity)).toBe(`(github.event_name != 'push' && github.event_name != 'schedule') || (${repository})`);
});
const imageBuild = scripts.find((script) => script.includes('--target "$target"'))!;
const bashExpandsEmptyArrays = spawnSync("bash", ["-uc", 'empty=(); : "${empty[@]}"']).status === 0;
function imageBuildCommands(event: string) {
const directory = mkdtempSync(path.join(os.tmpdir(), "runner-image-build-"));
try {
writeFileSync(path.join(directory, "docker"), `#!/bin/sh\nprintf '%s\\n' "$*" >> "$RUNNER_TEMP/docker.log"\n`, { mode: 0o755 });
const run = spawnSync("bash", ["--noprofile", "--norc", "-eo", "pipefail", "-c", imageBuild], {
cwd: directory,
encoding: "utf8",
env: { PATH: `${directory}${path.delimiter}${process.env.PATH}`, RUNNER_TEMP: directory, GITHUB_EVENT_NAME: event, GITHUB_SHA: "a".repeat(40),
BUILD_CACHE: "registry.invalid/buildcache", ARCH: "amd64", PLATFORM: "linux/amd64" },
});
expect(run.status, run.stderr).toBe(0);
return readFileSync(path.join(directory, "docker.log"), "utf8").trimEnd().split("\n");
} finally {
rmSync(directory, { recursive: true, force: true });
}
}
it("replaces the cache read of the image build with --no-cache when the event is a schedule", () => {
expect(imageBuild).toContain('cache=(--cache-from "type=registry,ref=$BUILD_CACHE:$ARCH")\n if [ "$GITHUB_EVENT_NAME" = schedule ]; then cache=(--no-cache); fi\n');
expect(imageBuild).toContain('"${cache[@]}"');
});
it.skipIf(!bashExpandsEmptyArrays)("runs the image build step: a scheduled run builds with --no-cache and no cache read, any other run reads the cache (needs bash 4.4)", () => {
const cacheRead = "--cache-from type=registry,ref=registry.invalid/buildcache:amd64";
const scheduled = imageBuildCommands("schedule");
expect(scheduled.map((command) => /--target (\S+)/.exec(command)?.[1])).toEqual(["runner-artifacts", "runner-artifacts-slim"]);
expect(scheduled[0]).toContain(" --no-cache ");
for (const command of scheduled) expect(command).not.toContain("--cache-from");
for (const event of ["pull_request", "push", "workflow_dispatch"]) {
const commands = imageBuildCommands(event);
expect(commands).toHaveLength(2);
expect(commands[0]).toContain(` ${cacheRead} `);
expect(commands[1]).not.toContain("--cache-from");
for (const command of commands) expect(command).not.toContain("--no-cache");
}
});
it("publishes, and keeps the images for publication, only for a master push in the canonical repository", () => {
expect(jobCondition(jobs.publish).startsWith(`${canonical} && `)).toBe(true);
expect(jobs.publish).toContain(" needs: [identity, build]\n");
@@ -58,11 +126,11 @@ describe("Runner image workflow", () => {
expect(recording[0]).not.toMatch(/KEEP_IMAGE/);
expect(recording[0]).not.toMatch(credential);
// A fork's own pushes run nothing; no job overrides a skipped or failed dependency.
expect(jobCondition(jobs.identity)).toBe(`github.event_name != 'push' || (${repository})`);
expect(jobCondition(jobs.identity)).toContain(`github.event_name != 'push' && `);
expect(workflow).not.toMatch(/always\(\)|!cancelled\(\)|failure\(\)|continue-on-error/);
});
it("keeps the build legs free of credentials and of any registry build cache", () => {
it("keeps the build legs free of credentials, and lets them read the build cache but not write it", () => {
// No job-level token: the block before the steps holds none, in any job.
for (const job of Object.values(jobs)) expect(job.slice(0, job.indexOf("\n steps:\n"))).not.toMatch(credential);
// The steps that build, check and smoke the image never receive one.
@@ -74,7 +142,8 @@ describe("Runner image workflow", () => {
expect(step).toContain("runner-image-publish.mjs publication-state");
expect(step).not.toContain("--strict");
}
expect(workflow).not.toMatch(/cache-to|cache-from|type=registry|type=gha/);
expect(jobs.build).toContain('--cache-from "type=registry,ref=$BUILD_CACHE:$ARCH"');
expect(jobs.build).not.toMatch(/cache-to|docker login|docker\/login-action/);
});
it("writes the full tag last, after a strict lookup and after both images are attested", () => {