Repository navigation
feat: refuse a regular release train while another release branch exists - #1630
Merged
Merged
Conversation
This was referenced Sep 14, 2026
c-vigo
added a commit
that referenced
this pull request
Sep 14, 2026
## Description Phase 2 of #1621: ports the hotfix release lane (#1623) to the workspace scaffold so gitflow consumers get `prepare-hotfix.yml` and `just prepare-hotfix X.Y.Z` before they need it — `workflow_dispatch` only works once the file is on the consumer's default branch, so the lane cannot be adopted and used in the same emergency. The scaffold copy is written in the scaffold dialect: every job runs on the mode-aware devkit toolchain (`resolve-toolchain` + `setup-devkit-toolchain`, no `uv run`), the latest-tag lookup and the collision check honour `DEVKIT_TAG_PREFIX`, every checkout sets `persist-credentials: false`, and `prepare-release-extension.yml` stays the only project-specific seam. The lane is gitflow-only: copy-excluded under `DEVKIT_WORKFLOW=trunk` and pruned on a gitflow → trunk upgrade, the same mechanism as `sync-main-to-dev.yml` — the two now share one `TRUNK_EXCLUDED_WORKFLOWS` list in `init-workspace.sh` instead of a sixth special case. The scaffold `release-core.yml` validate job switched from grepping for the bare `## [X.Y.Z] - TBD` heading to `prepare-changelog validate --version`, so a seeded-but-unfilled hotfix section cannot ship downstream (the `--version` flag ships in the same devkit release, so the toolchain contract holds). Stacked on #1631 (#1626), which is stacked on #1630 (#1627): all three rewrite the same hotfix runbook paragraphs and workflow validate jobs. Once #1631 merges, this branch gets rebased onto `dev` so the diff shrinks to the commits listed below. ## Type of Change - [x] `feat` -- New feature - [ ] `fix` -- Bug fix - [ ] `docs` -- Documentation only - [ ] `chore` -- Maintenance task (deps, config, etc.) - [ ] `refactor` -- Code restructuring (no behavior change) - [ ] `test` -- Adding or updating tests - [ ] `ci` -- CI/CD pipeline changes - [ ] `build` -- Build system or dependency changes - [ ] `revert` -- Reverts a previous commit - [ ] `style` -- Code style (formatting, whitespace) ### Modifiers - [ ] Breaking change (`!`) -- This change breaks backward compatibility ## Changes Made - `assets/workspace/.github/workflows/prepare-hotfix.yml` (new) — the scaffold lane: `resolve-toolchain` → `validate` (patch increment of the latest `main` tag, single-train refusal, empty-Unreleased refusal via `prepare-changelog`) → `prepare` (cut from `main`, seed the `## [X.Y.Z] - TBD` section) → `extension` hook → `open-pr` (draft, targets `main`) → `rollback` (deletes only the release branch). `dry_run` gates every job but `validate`. - `zizmor.yml` (root + scaffold) — baseline the managed basename for `github-app`, `secrets-inherit` and `unpinned-images`; `artipacked` not needed. - `assets/workspace/.github/renovate-default.json` — the new managed basename joins the trailing `enabled: false` rule (drift gate `test_renovate_preset_managed_exclusion`). - `assets/init-workspace.sh` — `TRUNK_EXCLUDED_WORKFLOWS` list + `trunk_excluded()` replacing the five `sync-main-to-dev.yml` special cases (preview classifier, upgrade deletions, rsync exclude, post-copy prune, preserved-class carve-out); the hotfix lane joins the `release` feature group; the `prepare-hotfix` recipe is stripped from `justfile.gh` under trunk only. - `scripts/manifest.toml` — drop the `RemoveBlock` that stripped `just prepare-hotfix` from the scaffolded `justfile.gh`; `assets/workspace/.devcontainer/justfile.gh` regenerated. - `assets/workspace/.github/workflows/release-core.yml` — **Verify CHANGELOG has TBD entry** now runs `prepare-changelog validate --version "$VERSION"`. - Tests — `tests/test_workflow_prepare_hotfix.py` parametrised over both copies plus scaffold-only pins (toolchain, tag-prefix awareness, `release-core.yml` content gate, recipe present); `tests/test_workflow_model.py` pins gitflow-has / trunk-lacks and the upgrade prune; `tests/test_workflow_zizmor_baseline.py` covers the baseline entries; `tests/test_workflow_prepare_extension.py` adds the scaffold lane to the callers. - Docs — `docs/DOWNSTREAM_RELEASE.md` (+ mirror) hotfix-lane runbook and trunk carve-out, `docs/MIGRATION.md` workflow lists and `release` group, `docs/RELEASE_CYCLE.md` consumer-scaffold paragraph; `CHANGELOG.md` (+ mirror), including dropping the "devkit-only for now" note from the #1623 entry. ## Changelog Entry ### Added - **Hotfix release lane in the consumer scaffold** ([#1625](#1625)) - `assets/workspace/.github/workflows/prepare-hotfix.yml` (Phase 2 of [#1621](#1621)): the same lane in the scaffold dialect — every job runs on the mode-aware devkit toolchain (`resolve-toolchain` + `setup-devkit-toolchain`, no `uv run`), the latest-tag lookup and the collision check honour `DEVKIT_TAG_PREFIX`, and every checkout drops its git credential. `just prepare-hotfix X.Y.Z` now reaches consumers too - Gitflow only: copy-excluded under `DEVKIT_WORKFLOW=trunk` and pruned on a gitflow → trunk upgrade exactly like `sync-main-to-dev.yml` (the two now share one `TRUNK_EXCLUDED_WORKFLOWS` list in `init-workspace.sh`), with the recipe dropped from the trunk `justfile.gh`; part of the `release` feature group - The scaffold `release-core.yml` now gates on `prepare-changelog validate --version` (content, not just the `## [X.Y.Z] - TBD` heading), so a seeded-but-unfilled hotfix section cannot ship downstream - `zizmor.yml` baselines the managed basename for `github-app`, `secrets-inherit` and `unpinned-images` only; consumer runbook in `docs/DOWNSTREAM_RELEASE.md` (Hotfix lane) ## Testing - [x] Tests pass locally (`just test`) - [x] Manual testing performed (describe below) ### Manual Testing Details - `uv run pytest tests/test_workflow_prepare_hotfix.py tests/test_workflow_model.py tests/test_workflow_zizmor_baseline.py tests/test_workflow_prepare_extension.py tests/test_promote_release.py tests/test_promote_latest_guard.py`: 148 passed. The new cases were RED before the scaffold file landed (commit 564ebad). - Full suite: 1608 passed, 1 skipped. Excluded: 201 errors in `test_image.py` / `test_integration.py` / `test_install_script.py` (no local `ghcr.io/vig-os/devcontainer:dev` image, environmental) and 4 `packages/vig-utils` CLI e2e cases that fail only under the Nix devshell's `PYTHONPATH` (store build shadows the venv; 143 passed with `PYTHONPATH` unset). The one real red, `test_renovate_preset_managed_exclusion`, caught the new lane missing from the preset's disabled list — fixed in commit 32cbfa1. - `just precommit` (`prek run --all-files`): green. - zizmor over `assets/workspace/.github/workflows/` with the shipped baseline: the only unsuppressed findings are `self-repository` (an audit newer than the CI-pinned 1.25.2) and they hit every existing managed workflow identically, so the new lane adds nothing against the baseline. CI's pinned run is the authority. - Smoke-test rehearsal on `devkit-smoke-test` (prepare → fix PR → candidate → abandon) is post-merge: it needs a devkit release to ship the asset and `devkit-upgrade` to adopt it. Tracked on #1625. ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have updated the documentation accordingly (edit `docs/templates/`, then run `just docs`) - [x] I have updated `CHANGELOG.md` in the `[Unreleased]` section (and pasted the entry above) - [x] My changes generate no new warnings or errors - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published (#1630, #1631 pending) ## Additional Notes Acceptance criteria not closable in this PR: the smoke-test rehearsal (see Testing). Refs: #1625
4 tasks
c-vigo
added a commit
that referenced
this pull request
Sep 14, 2026
## Description Adds a semver guard to `promote-release.yml` so a promote can never move the floating refs backwards. Devkit moves GHCR `:latest` unconditionally; with the hotfix lane (#1621, #1623) a patch cut from `main` and a train cut from `dev` could, if both existed, promote in the wrong order and walk `:latest` back to an older version. The guard is the last line of defence behind the single-train refusals (#1627): the `validate` job compares the version against the highest **published final** GitHub Release — the version the floating refs follow — and fails before the irreversible publish when it is lower. Design notes (plan comment on #1626): no `org.opencontainers.image.version` label exists (the image is built by Nix; `flake.nix` sets only title/source/licenses) and reading GHCR metadata needs a `packages` scope the scaffold token lacks, so the published-final list is the source of truth. No override input; the recovery is to abandon the stale train and re-cut the fix as the next patch of the published line. Stacked on #1630 (#1627): this branch is based on `feature/1627-prepare-release-single-train` because both PRs rewrite the same hotfix runbook paragraph. Once #1630 merges, this branch gets rebased onto `dev` so the diff shrinks to the commits listed below. ## Type of Change - [x] `feat` -- New feature - [ ] `fix` -- Bug fix - [ ] `docs` -- Documentation only - [ ] `chore` -- Maintenance task (deps, config, etc.) - [ ] `refactor` -- Code restructuring (no behavior change) - [ ] `test` -- Adding or updating tests - [ ] `ci` -- CI/CD pipeline changes - [ ] `build` -- Build system or dependency changes - [ ] `revert` -- Reverts a previous commit - [ ] `style` -- Code style (formatting, whitespace) ### Modifiers - [ ] Breaking change (`!`) -- This change breaks backward compatibility ## Changes Made - `.github/workflows/promote-release.yml` — new validate step **Verify version does not move :latest backwards**, after the draft-release check: pages `repos/{repo}/releases`, keeps `draft == false && prerelease == false` bare-semver tags, takes the highest with `sort -V`, and fails when `VERSION` sorts below it. Passes when no final release exists yet. A failed API call fails the step (no fail-open). - `assets/workspace/.github/workflows/promote-release.yml` — the same step for the opt-in git floating tags, gated on `needs.resolve-toolchain.outputs.floating-tags != ''`; release tags are filtered to the `TAG_PREFIX` line and compared after the prefix is stripped, so pre-devkit bare tags are ignored. Consumers without floating tags are unaffected. - `tests/test_promote_release.py` — shape pins for both copies (data source, filters, `sort -V`, placement after the draft check; devkit unconditional, scaffold gated and prefix-aware). - `tests/test_promote_latest_guard.py` (new) — runs the extracted step body with `gh` stubbed to answer the release listing: lower refused with the message and remedy, higher passes, numeric (not lexical) ordering, empty list / drafts-only passes, drafts and pre-releases ignored, prefix stripped, tags outside the prefix ignored. - `docs/RELEASE_CYCLE.md` — release-phases step 6, the hotfix runbook rule (now points at the guard), and a troubleshooting entry for the refusal. `docs/DOWNSTREAM_RELEASE.md` (+ mirror) — floating-tags note. `CHANGELOG.md` (+ mirror). ## Changelog Entry ### Added - **promote-release refuses to move `:latest` backwards** ([#1626](#1626)) - Devkit's `promote-release.yml` `validate` job now compares the version against the highest published final GitHub Release (the version `:latest` follows) and fails before the irreversible publish when it is lower. No override: abandon the stale train and re-cut the fix as the next patch of the published line - The scaffold copy carries the same guard for the opt-in git floating tags, active only when `DEVKIT_FLOATING_TAGS` is set; release tags are compared after the tag prefix is stripped, and consumers without floating tags keep the freedom to publish a patch for an older line ## Testing - [x] Tests pass locally (`just test`) - [ ] Manual testing performed (describe below) ### Manual Testing Details - `uv run pytest tests/test_promote_release.py tests/test_promote_latest_guard.py tests/test_floating_tag_move.py tests/test_workflow_prepare_extension.py tests/test_workflow_prepare_hotfix.py tests/test_release_tombstone_detection.py tests/test_ci_green_gate.py`: 189 passed. The 16 new cases were RED before the workflow change (commit baf5bdf). - `prek run --all-files`: green. - No live promote was run (the next real promote exercises the happy path: the highest published release is 1.14.1, every regular train is higher). ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have updated the documentation accordingly (edit `docs/templates/`, then run `just docs`) - [x] I have updated `CHANGELOG.md` in the `[Unreleased]` section (and pasted the entry above) - [x] My changes generate no new warnings or errors - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published ## Additional Notes Second of three hotfix-lane follow-ups: #1627 (#1630) → #1626 (this PR) → #1625 (scaffold port). Merge #1630 first. Refs: #1626
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Makes
prepare-release.ymlrefuse to cut a regular train while any otherrelease/*branch exists on the remote — the symmetric counterpart of the single-train policyprepare-hotfix.ymlenforces (#1621, #1623). Without it a regular train can be cut fromdevover an in-flight hotfix: that train predates the fix, so promoting it afterwards silently reintroduces the regression, and promoting it first walks:latestbackwards.The check is branch-name based and lives in the
validatejob directly after the existing "release branch does not exist" step, so the trunk render carries it unchanged. Same message shape as the hotfix lane: list the offenders, then "promote or abandon it first". No override input (a second concurrent train was never a supported state). Plan: the implementation-plan comment on #1627.Type of Change
feat-- New featurefix-- Bug fixdocs-- Documentation onlychore-- Maintenance task (deps, config, etc.)refactor-- Code restructuring (no behavior change)test-- Adding or updating testsci-- CI/CD pipeline changesbuild-- Build system or dependency changesrevert-- Reverts a previous commitstyle-- Code style (formatting, whitespace)Modifiers
!) -- This change breaks backward compatibilityChanges Made
.github/workflows/prepare-release.yml— new validate step Verify no other release train is in flight: enumeratesrefs/remotes/origin/release/(the checkout isfetch-depth: 0, like the existing remote branch check) and fails with the list when any exists.assets/workspace/.github/workflows/prepare-release.yml— same step in the scaffold dialect (git ls-remote --heads origin 'release/*', consistent with its existing branch/tag checks).tests/test_workflow_prepare_extension.py— shape pin for both copies and thecached_tree("trunk")render: the step directly follows the branch-exists check, enumerates remoterelease/*refs, carries the message and remedy, and exits 1.docs/RELEASE_CYCLE.md— Phase 1 prerequisites gain the precondition; theprepare-release.ymlvalidate step list and the hotfix-lane runbook rule are updated (the prepare direction is now enforced in both directions; the:latestpromote guard is [FEATURE] promote-release: refuse to move :latest to a lower version #1626).CHANGELOG.md(+ scaffold mirror) — Unreleased entry.Changelog Entry
Added
(#1627)
validatejob ofprepare-release.yml(devkit and scaffold copies,trunk render included) now fails, listing the offenders, when any other
release/*branch exists on the remote: the symmetric counterpart of thehotfix lane's refusal, so a regular train can no longer be cut over a
hotfix and later reintroduce the regression or walk
:latestbackwards.Promote or abandon the other train first
Testing
just test)Manual Testing Details
uv run pytest tests/test_workflow_prepare_extension.py tests/test_workflow_prepare_hotfix.py tests/test_workflow_model.py tests/test_scaffold_lint.py: 115 passed (the three new cases were RED before the workflow change, commit bde67f3).prek run --all-files: green.release/*branch exists, and none is in flight (1.14.1 promoted and synced today). A dry-run dispatch with a hand-createdrelease/*branch is possible once this file is ondev(just prepare-release X.Y.Z --dry-run), but was not run to avoid leaving a stray branch.Checklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
First of three follow-ups to the hotfix lane, landed in this order: #1627 (this PR), #1626 (promote
:latestguard), #1625 (scaffold port). All ship in the next regular train.Refs: #1627