Skip to content

Release gating: a gate.yml in the canary tests the candidate before v0 moves #135

Closed

Description

@mmcky

Decision from the consumer side: a red canary should block a release. The lecture family wants quantecon/actions verified green — within the bounds of current testing — before a release is published, and is sequencing its move to floating @v0 behind that. Consumer-side context in QuantEcon/workspace-lectures#33; this issue is the implementation.

This is stage 4 of #100, plus the thing #100 did not specify: how a gate is supposed to work when the canary is pinned to the very tag the release moves.

The blocker: the canary cannot gate a release as built

Every one of the canary's action references is @v0:

Ref Count in test-actions-lecture-intro
build-lectures@v0 6
build-jupyter-cache@v0 1
restore-jupyter-cache@v0 1
preview-netlify@v0 1
publish-gh-pages@v0 1

v0 is what a release moves. So the canary always exercises the previous release, never the candidate — it is a post-release regression detector, and no amount of scheduling changes that. "Green before we release" is not expressible against it today.

Two further facts shape any fix. GitHub does not allow expressions in uses:, so a ref can never be parameterised. And build-jupyter-cache reaches its siblings at a hardcoded @v0 — setup-environment@v0 at action.yml:149 and build-lectures@v0 at :164, :174, :184.

Proposal: a v0-next staging tag

Add a second floating tag that always points at the release candidate, and give the canary a workflow set pinned to it. The release then becomes:

  1. move v0-next to the candidate commit;
  2. dispatch the canary's v0-next workflows;
  3. green is a precondition for step 4 — red stops the release;
  4. move v0 to the same commit.

This works precisely because it does not need parameterised refs: @v0-next is as static as @v0. It costs a duplicate workflow set in the canary, which is the price of the uses: constraint rather than a design smell.

What it gates, and what it cannot

Gated — every action the canary calls directly, which is the whole publish path and the highest-consequence surface:

publish-gh-pages, preview-netlify, build-lectures, restore-jupyter-cache, setup-environment.

Not gated — the build-jupyter-cache sibling chain. A build-jupyter-cache@v0-next run still executes setup-environment@v0 and build-lectures@v0, i.e. the previous release's siblings. The candidate's cache action is tested against stale siblings, so the pairing that consumers will actually run remains untested until after v0 moves. That is the structural limit named in #100 and this proposal does not remove it; it narrows the ungated surface to one action's internal chain.

Worth stating plainly so the gate is not over-trusted: "100% before release" will mean "everything except the build-jupyter-cache sibling chain", unless that chain is addressed separately (see below).

Options for the residual, not recommended unilaterally

  • Rewrite sibling refs at release time. A release step rewrites @v0 → the candidate SHA in build-jupyter-cache/action.yml on the tagged tree. Fully self-consistent and testable, but the tagged tree then differs from main, which is a real cost to reasoning about the repo.
  • Accept it, and lean on cadence. The cache path already has the longest post-release lead of any consumer path — the canary's weekly build runs Sunday 03:00 UTC against lecture repos' Monday 02:00/03:00 UTC. Combined with rollback, exposure is bounded to roughly a day.

Work

Gate mechanism

  • Introduce the v0-next tag and document its meaning alongside v0
  • Add a v0-next workflow set to QuantEcon/test-actions-lecture-intro
  • Add a release step that moves v0-next, dispatches the canary, and requires green before v0 moves
  • Document the rollback: v0 is movable, so recovery from a bad release is git tag -f v0 <previous>. Write it down before it is needed, with who is expected to act

Close the ungated consumer paths (these matter whether or not the gate lands, since they are also the post-release safety net)

  • Schedule the canary's ci.yml — the preview path currently runs only when a human opens a PR in the canary (last: 2026-08-05, before that 2026-07-15)
  • Schedule the canary's publish.yml, and give it a workflow_dispatch — it currently has neither, so it cannot even be run by hand
  • Keep any canary schedule strictly ahead of consumers' Monday 02:00/03:00 UTC cache builds

Prove the gate is real

A gate that has never been exercised is not a gate, and this repo has precedent on both halves: the container smoke tests could not fail for three independent reasons and still reported green (#108), and the canary failed eight consecutive weeks (2026-02-22 → 2026-04-12) filing zero issues (#83).

  • Self-test the gate — stage a deliberately broken candidate, confirm the canary goes red and the release is actually stopped, then revert
  • Confirm a red canary reaches a human, separately from the above. The eight silent weeks were failures that alerted nobody

Open questions

Question Why it matters
Is the release blocked automatically, or by convention in the runbook? There is no release automation here today — v0 is moved by hand — so "blocked" may initially mean a documented step rather than an enforced one
Does v0-next also get a scheduled canary run, or only on release? Only-on-release is cheaper; scheduled would catch drift on main between releases
Is the build-jupyter-cache residual acceptable? It decides whether "100%" is qualified or whether the ref-rewrite option is worth its cost

Related

Activity

  1. added
    infrastructure
    high-priority
    on Aug 11, 2026
  2. mmcky commented on Aug 11, 2026

    @mmcky
    ContributorAuthor

    Sequenced under #138, the tracking issue for the gating work — it holds the order, the definition of done, and the open decisions. This issue keeps the design detail; #138 does not duplicate it.

    PLAN.md now carries the same work as backlog items 0a–0d at P0 (#137).

  3. mmcky commented on Nov 4, 2026

    @mmcky
    ContributorAuthor

    From the 2026-10-06 codebase review (finding H2; record: .qe/dev/log/2026-10-06-codebase-review.md, #220).

    Input for #138's open decision on whether the build-jupyter-cache residual is accepted or worth the ref rewrite. This issue frames the residual as release gating. Since decision 1 on #143 (2026-11-04), the gate is a gate.yml in the canary with no v0-next tag, and it can test the candidate's own sibling chain by rewriting the four uses: lines at test time, as the #143 spike did. The review found a consumer-facing side that a test-time rewrite does not reach:

    • Pins are not hermetic. A composite action's nested uses: is resolved when the job runs. So pinning build-jupyter-cache to an exact tag or a commit does not pin setup-environment or build-lectures (build-jupyter-cache/action.yml:216, :232, :242, :252): they follow v0. Because 0.x minor releases may break, an exactly pinned cache build can break when v0 moves.
    • The docs disagree. CONTRIBUTING.md:36 and README.md:181 offer exact pins as "maximum reproducibility". docs/user/actions/build-jupyter-cache.md:129 says this action follows v0 for its siblings. A one-line caveat in the version tables should land whichever way Tracking: release gating — get to a candidate that is verified before v0 moves #138 decides.
    • A release-time rewrite closes both. Rewriting the sibling refs in the tagged tree (to the release tag, or to a commit) makes pins hermetic, and the gate then tests the tree as released rather than a test-time rewrite of it. The costs:
      • release tags point at commits that are not ancestors of main;
      • every release, patches included, repeats the rewrite, so a release check is needed that no quantecon/actions/…@v0 remains in a tagged tree.

    Impact as of 2026-10-06 is nil: every build-jupyter-cache consumer is on @v0, and every exact pin is on an action that calls no sibling. #83 part 1 asked for the same hermeticity. It was marked resolved by the earlier move of the refs from @main to @v0 (#83 closed with #122), which met half of the ask.

  4. mmcky commented on Nov 4, 2026

    @mmcky
    ContributorAuthor

    Re-scoped, 2026-11-04, following the decisions on #143: no v0-next tag. The gate is a gate.yml in the canary. It takes the candidate commit as a workflow_dispatch input, accepts only commits reachable from main or a v* tag of this repo (checked before any secret is read), checks the candidate out, and runs the actions through local uses: ./actions-repo/<action> paths. In the gate run, the four nested uses: lines in build-jupyter-cache are rewritten to local paths, so its sibling chain is also tested at the candidate, which v0-next could not do. Deploy secrets live in a canary environment that only the canary's main can use. Builds are frozen (committed image digest, cold, intersphinx off). publish-gh-pages is included and redeploys the canary's own Pages site.

    Release flow: dispatch the gate on the candidate, require green, then move v0. Until the gate exists, releases stay staged by hand (CONTRIBUTING, Staged Releases).

    One work item is already done: the rollback is documented in CONTRIBUTING (Staged Releases → Rollback). This issue is now blocked by #227 (the preview opt-in deploy, for the preview leg) as well as by #136 (the fixture).

    Posted by Claude Code (on behalf of mmcky), from the 2026-11-04 decision session.

  5. changed the title [-]Release gating: require a green canary before v0 moves (adds a v0-next staging tag)[/-] [+]Release gating: a gate.yml in the canary tests the candidate before v0 moves[/+] on Nov 4, 2026
  6. mmcky commented on Nov 10, 2026

    @mmcky
    ContributorAuthor

    Issue check, 2026-11-10, against main at a8a4eca. The re-scope of 2026-11-04 holds, and #240 (v0.14.0) removed the last blocker: both preview actions take dispatch-alias and report deployed.

    Re-checked. build-jupyter-cache still calls its siblings at @v0 four times, now at action.yml:254, :270, :281 and :292. The canary's release-gate environment allows main only and holds the four gate-only secrets. The canary's ci.yml now has workflow_dispatch but passes no dispatch-alias, so a dispatch deploys nothing, and publish.yml still runs only on a publish* tag. The rollback is documented in CONTRIBUTING.

    The design. gate.yml is dispatched with candidate, a commit SHA or a v* tag of this repository, and self-test: off, build-fails or nothing-deployed. A first job with no secret resolves the candidate to one SHA, and refuses it unless it is reachable from main or a v* tag; every later job checks out that SHA. A cache job runs build-jupyter-cache cold with all three builders, after rewriting every nested uses: quantecon/actions/… to a local path and failing if any is left. Two site jobs restore that run's caches, one the execution cache as the templates' ci.yml does and one the build cache as the canary's ci.yml does, and build the HTML. The deploys run in jobs of their own that execute no notebook. The previews deploy under release-gate to dispatch-release-gate, and the job asserts deployed and that each URL serves a marker holding the candidate's SHA, compared by content, since a Cloudflare preview answers every path (#291). Pages deploys under github-pages, in the pages concurrency group, with the same marker check. A last job passes only if every job passed.

    A red reaches a person: the release procedure waits on the run and moves v0 only on green, and a red run from main opens or comments on one canary issue assigned to whoever dispatched it. The build-fails self-test on main shows both.

    The release procedure. For a release that changes an action, the gate replaces the cache.yml dispatch, the publish-* tag and the generic part of the canary PR. A canary PR, or a throwaway workflow, stays only for what a fixed gate cannot reach: a preview's pull-request half, a standard-runner install, or a release's own scenario. The lecture-matrix condition for moving v0 is unchanged. The first release after the gate lands runs both, once.

    Not covered, stated up front: how consumers fetch the actions by tag; build-jupyter-cache as shipped, since the gate runs a copy with its nested lines rewritten; standard-runner installs (setup-environment outside a container, setup-latex); deploy-cloudflare; and the previews' pull-request half (the pr-<N> alias, change detection, the comment), which the harness tests against stand-ins. The comment of 2026-11-04, on exact pins of build-jupyter-cache not being hermetic, is not addressed here.

    How it is shown. Up to the deploys, on a canary branch, where the deploy jobs are refused by the environments' branch rules, so a branch run is always red. Then, after the merge, a green run on main, and both self-tests red.

    The maintainer's decisions, 2026-11-10, taken one at a time, each as recommended:

    • the release procedure becomes the gate plus targeted staging, as described above;
    • a red reaches a person through the procedure, plus one canary issue assigned to whoever dispatched the run;
    • candidate takes a full SHA or a v* tag name, resolved once. self-test is off, build-fails or nothing-deployed, and the preview alias is dispatch-release-gate;
    • PLAN 0c, scheduling the canary's ci.yml and publish.yml, is not in this wave. It is revisited once the gate has replaced the generic hand-staged legs.

    Claude Code (on behalf of mmcky), organiser session; the check by the mini:actions-gate session

  7. mmcky commented on Nov 10, 2026

    @mmcky
    ContributorAuthor

    The release gate is live: gate.yml in the canary, from QuantEcon/test-actions-lecture-intro#85 with a docs follow-up in QuantEcon/test-actions-lecture-intro#87. #301 makes it part of the release procedure in CONTRIBUTING's Staged Releases, and describes it in TESTING and PLAN.

    Its runs on the canary's main:

    • v0.16.0, where v0 points: green (run 42769820139).
    • Self-test nothing-deployed: red at the preview deploy, and it opened a release-gate issue assigned to the dispatcher (run 42770761791).
    • Self-test build-fails: red at the cache build (run 42773299612).
    • v0.17.0, the first real candidate: green, with GitHub Pages and both previews serving the marker for fae622c (run 42776388278).

    What remains of release gating, PLAN's P0 item 0c, stays on #138. Closing as done.

    Claude Code (on behalf of mmcky)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    high-priorityinfrastructure

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions