Skip to content

ci: let a release recover from a registry or signing outage - #592

Merged
JuroOravec merged 3 commits into
mainfrom
ci/release-recovery
Nov 2, 2026
Merged

JuroOravec merged 3 commits into
mainfrom
ci/release-recovery

Conversation

@JuroOravec

Copy link
Copy Markdown
Member

Summary

The publish workflows now build every release from a clean runner. No job in
a *--publish.yml workflow restores or saves a GitHub Actions cache, and a
new validator fails the gate if one starts to again. The qualify build and
smoke jobs also check out github.sha instead of inputs.release_commit.
verify-version already requires the two to be the same commit, so this is
what closes the CodeQL alerts.

Ordinary CI keeps all of its caches.

What CodeQL reports, and why removing caches alone does not close it

The 28 open actions/cache-poisoning/poisonable-step alerts (#15-#29,
#31-#42, #75; #30 was already marked fixed) are on the build and smoke jobs
of all six publish workflows. CodeQL's rule fires when a job started on the
default branch checks out a ref it treats as untrusted and then runs a script
from that checkout. It does not look at whether the job uses a cache: code
from that checkout could read the runner's cache token and save entries into
main's cache, which other main runs restore later. CodeQL treats
inputs.release_commit as untrusted because it is an input.

So there are two separate problems, and this PR fixes both:

  1. Release jobs restored caches. A cache restored on main may have been
    saved by any earlier main run, in any workflow. One correction to how
    this was first described: GitHub keeps each pull request's caches in the
    pull request's own scope, so a pull request cannot save a cache that a run
    on main restores. The risk comes from every workflow that runs on main
    (and every action those runs use), not from pull requests directly.
    The caches restored were:
    • sccache in every citry-core wheel build (sccache: "true" on
      maturin-action);
    • setup-uv's cache, which is on by default (enable-cache: auto) in every
      job that installs uv;
    • the pnpm store in the citry-ui build and the VS Code build, smoke, and
      release jobs. The VS Code release job holds the marketplace
      credentials;
    • the 516 MB Pyodide cross environment in the PyEmscripten builds
      (actions/cache).
  2. The alerts themselves. In qualify mode, verify-version stops the run
    unless release_commit equals github.sha, and every build and smoke job
    needs verify-version. Checking out github.sha in those jobs builds the
    same commit as before. It also tells CodeQL that the job runs the code of
    the run's own ref, which CodeQL trusts. The second commit holds only this
    change, so it can be dropped on its own if you would rather dismiss the
    alerts.

Changes

  • Caches off in all six publish workflows. I removed sccache: "true"
    and the Pyodide actions/cache step. Each setup-uv step now sets
    enable-cache: false. Each setup-node step drops cache: pnpm and sets
    package-manager-cache: false, because setup-node caches npm projects on
    its own. Every setup-uv step keeps prune-cache: true, which the toolchain
    validator still requires.
  • Checkout of github.sha in the jobs CodeQL flags: the citry-core
    linux, musllinux, macos, sdist, and pyemscripten-build jobs, plus
    windows, which has the same shape (CodeQL does not read its pwsh
    steps). Also the build and smoke-python jobs of citry, citry-lsp,
    citry-ui, and pygments-citry, and the VS Code build and
    smoke-installed-extension jobs.
  • scripts/validators/release_caches.py (new) reads every
    *--publish.yml workflow. It reports cache actions, any cache or
    sccache input that is not false, a setup-uv or setup-node step that
    leaves its default cache on, and sccache turned on through env:. Tests
    are in packages/py/citry/tests/test_release_caches_validator.py.
  • docs/codebase.md, "Publishing" gains one paragraph on the rule. Each
    publish workflow's header comment gains a three-line note.

Time cost for release runs

I took the numbers from two citry-core qualify runs of 2026-11-02: one where
sccache found nothing (41463054673) and one where it found most
crates (41509159532). The first wheel build in each job is the one
sccache affects.

Job First build, no cache hits First build, cache hits
linux (x86), the longest job 10m 35s 10m 18s (0 hits)
linux (x86_64) 5m 58s 2m 07s
musllinux (x86_64) 5m 44s 2m 36s
macos (aarch64) 9m 56s 3m 49s
macos (x86_64) 14m 37s 12m 10s
windows (x86) 11m 20s 6m 35s
  • Longest release path: no measured change. The longest job is
    linux (x86), about 26 minutes in both runs, and sccache never got a hit
    there. The slowest other jobs ran about 17 minutes with no hits, which is
    still shorter.
  • Single jobs: 2 to 6 minutes longer each for the jobs that did get hits.
    Those hits only happen when the same source tree is qualified again. The
    first qualify run for a new release commit already found nothing in the
    cold run above.
  • Pyodide cross environment: about 20 to 30 seconds more per PyEmscripten
    job (about 34 s to restore nothing and install, against 13 s to restore and check
    it). Those jobs take about 7 minutes, well under the longest job.
  • uv and pnpm: a few seconds for uv. The pnpm store is 175 MB, so a cold
    pnpm install should add tens of seconds per Node job, including the VS
    Code promotion job. I did not measure this.

The total time of a qualify run depends mostly on when runners pick up its 22
jobs (54 minutes in the cold run, 42 in the warm one, with the same longest
job). Nothing here is expected to add more than a minute to the longest path.

Merging with the #590 and #589 branches

Other branches are editing scripts/release.py and the publish and verify
steps of these workflows (#590), and the VS Code publish steps (#589). To
keep the merge clean, this PR changes only:

  • cache settings on setup and build steps;
  • the removed Pyodide cache step;
  • the ref: line of the checkout step in the jobs listed above;
  • the header comment of each workflow.

It leaves the publish, verify, and promote steps alone. verify-version, the
verify-distributions and verify-extension jobs, and the promote-mode
release jobs still check out inputs.release_commit. In promote mode
main may have moved on, so release must keep it. CodeQL does not flag the
verify jobs.

Checks

  • scripts/validate.py: every validator passes, including the new
    release_caches.
  • release_caches run against the workflows on origin/main reports 35
    cache uses, so it catches the old state.
  • pytest on the new validator test plus the release security, toolchain,
    run-expression, CI workflow, and release controller tests: 142 passed.
  • actionlint on the six publish workflows: no findings.
  • ruff check, ruff format --check, and mypy on the new files: clean.
  • I did not dispatch any workflow. CodeQL runs on this pull request, and the
    alerts should close once it analyses main after the merge.

Not covered

  • Ordinary CI on main still saves caches that later CI runs restore. That
    affects test results, not released bytes, and the task was to keep it.
  • The docs workflows (repo--docs-deploy.yml, repo--docs-release.yml)
    still use sccache, Rust, pnpm, and image caches. They publish the website,
    not packages, so I left them alone. Say if you want the same rule there.

🤖 Generated with Claude Code

JuroOravec and others added 3 commits November 2, 2026 21:59
A release run that stops partway can now be started again for the same
candidate. The controller skips a package whose tag and GitHub Release
exist and whose registry files match the qualified bytes by SHA-256, and
sends every other package back to its publish worker. A public file with
other bytes stops the release and names the file.

A publish step that fails while uploading or signing is retried twice,
five minutes apart, by re-running the run's failed jobs. A worker that
finds some qualified files already on PyPI uploads the rest with
skip-existing, and the strict check after the upload proves every file.

The VS Code worker now waits up to 45 minutes for the Open VSX review and
logs "still under review" while Open VSX answers 404.

Closes #590
Part of #589

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The check after a PyPI upload requires every file again when PyPI lists
  none, so an empty or hash-less file list cannot pass it.
- A restart skips a package only when its tag is annotated and its GitHub
  Release holds exactly the qualified files; otherwise the worker runs.
- A retry scheduled near the time limit still runs, and a run someone
  restarted by hand during the delay is followed rather than restarted.
- release.py also imports pypi_release when validate.py loads it.
- The Open VSX and Marketplace waits survive a single network error.
- docs/codebase.md describes the partial-upload rule in every package
  section, and says to wait for the stopped run's workers before a restart.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@JuroOravec
JuroOravec merged commit 9e4df71 into main Nov 2, 2026
26 checks passed
@JuroOravec
JuroOravec deleted the ci/release-recovery branch November 2, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant