Skip to content

ADR-0047: The self-host image's workerd pin: an npm lockfile that Dependabot bumps weekly, gated on the image's smokes

Context

Cloudhal has two workerd pins, and they move for different reasons.

  • The test suites run workerd through Miniflare 4.20260730.0. That pin is patched (#190) and stays until Miniflare 5 is stable (ADR-0012).
  • The self-host image runs a workerd of its own (RFC-0047 §1). The cluster, D1, R2-on-S3 and OTLP features it needs are weeks old, so it has to follow workerd closely. RFC-0047 §11 asks for a weekly bump that lands only when the store conformance suite and the cluster smoke pass on the new binary.

Until now the image’s pin was a text file (deploy/docker/workerd-version). The build installed that version with npm install and no lockfile, so the binary was checked against whatever the registry answered that day, and no tool could see the pin to bump it.

Decision

  1. The pin is an npm package of its own: deploy/docker/workerd/package.json, which depends on exactly one workerd version, plus its package-lock.json.
    • The lockfile holds the SHA-512 integrity of the workerd package and of every platform’s binary package (@cloudflare/workerd-linux-64, -linux-arm64, …).
    • It is outside the pnpm workspace, so the monorepo’s lockfile and its Miniflare pin never see it.
  2. The image installs from that lockfile. install.mjs runs npm ci --ignore-scripts there, so npm refuses a tarball whose hash differs. It then checks that the installed platform package is the pinned version, and copies that platform’s binary.
  3. Dependabot bumps it weekly. An npm entry for /deploy/docker/workerd in .github/dependabot.yml allows only workerd. Each PR updates the version and every checksum together, in one commit.
    • Why not a scheduled workflow. A PR it opens with GITHUB_TOKEN starts no workflows, so the gates would never run. Using an App or a personal token instead means a long-lived write credential for one file. Dependabot’s PRs run CI like any other.
  4. The gate is docker.yml on the PR. The PR touches deploy/docker/**, so it runs the full image build: store conformance (SeaweedFS, RustFS), the docker, Swarm and Helm (kind) smokes, the cluster failover test (#290) and Trivy, all on the new binary.
    • A bump is merged only when that run is green.
    • “Build edge” is deliberately not a required check of main’s ruleset. docker.yml runs only on PRs that touch its paths, and a required check that never reports would block every other PR. Bumps follow the same rule as every image PR: they merge on a green Build edge.
  5. The Miniflare pin is untouched. The root npm entry is unchanged, and ADR-0012’s upgrade recipe still governs Miniflare.
  6. The tcmalloc-free arm64 build follows when it can. workerd-no-tcmalloc is used only when its version equals the image’s workerd. When a bump outruns the community build, the build warns and the arm64 image carries no fallback until a matching build is pinned. 39-bit kernels then get the message that says what to do. Before this change the build failed instead, which would have blocked every bump.

Consequences

  • The image’s workerd has a checksum pin for every platform, and it is reviewed in the same diff as the version.
  • One Dependabot PR a week at most, and each one runs the image’s whole gate (about 30–40 minutes of CI).
  • A bump that breaks the cluster shows up as a red failover or smoke step on its own PR, never on main.