Skip to content

feat: add the hotfix release lane cut from main - #1623

Merged
c-vigo merged 10 commits into
devfrom
feature/1621-hotfix-release-lane
Sep 14, 2026
Merged

c-vigo merged 10 commits into
devfrom
feature/1621-hotfix-release-lane

Conversation

@c-vigo

@c-vigo c-vigo commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Description

Adds the gitflow hotfix lane (Phase 1, devkit-only): a new prepare-hotfix.yml workflow cuts release/X.Y.Z directly from main, so an urgent fix (typically a security-register incident, cf. #1592 / #1614) ships as a patch release without carrying whatever dev has accumulated. The fix lands via a bugfix/N-* PR into the release branch; the existing candidate/final/promote/abandon train and sync-main-to-dev run unchanged.

Decisions on the issue's open questions, as posted in the implementation plan: version policy is machine-enforced (patch+1 of the latest stable tag on main); a hotfix is hard-refused while any other release/* train is in flight; :latest ordering stays a runbook rule; the post-promote sync conflict on CHANGELOG.md is accepted and documented; the scaffold port (copy-excluded under trunk) is a follow-up issue.

Type of Change

  • 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/prepare-hotfix.yml (new) — validate (semver, patch-of-latest-main-tag, no other release/* branch, no colliding branch/tag, empty Unreleased on main), prepare (re-check main unmoved, cut branch at main's SHA via the Git Data API, prepare-changelog seed, commit to the release branch via commit-action, assert the branch head is the seed commit), extension (reuses prepare-release-extension.yml with the seed commit as branch_sha), open-pr (draft PR to main, bare checkout), rollback (always(), deletes the partial branch only). No job reads or writes dev; every checkout sets persist-credentials: false.
  • .github/workflows/release.yml — the validate job's "Verify CHANGELOG has TBD entry" step now runs prepare-changelog validate --version (content required, not just the heading). Note: for a hotfix release.yml runs from main's copy, so this guard reaches hotfix trains only after it ships through a normal train.
  • packages/vig-utils/src/vig_utils/prepare_changelog.py — new seed VERSION [FILE] subcommand (empty [VERSION] - TBD under an empty Unreleased; refuses a non-empty Unreleased or an existing section) and validate --version X.Y.Z (pending section must carry bullets).
  • packages/vig-utils/tests/test_prepare_changelog.py — TestSeedChangelog, TestValidateVersionSection, --version cases in TestCmdValidate, subprocess e2e cases.
  • tests/test_workflow_prepare_hotfix.py (new) — shape pins for the lane (no dev access, branch cut from main, dry-run gating, validate policy markers, seed commit target and branch_sha hand-off, draft PR to main, rollback scope, the release.yml guard, and the scaffold leak guard); tests/test_workflow_prepare_extension.py — the hotfix lane joins CALLER_WORKFLOWS so the branch → extension → PR DAG and rollback/cancellation contracts apply to it.
  • justfile.gh — just prepare-hotfix X.Y.Z [ref] [flags] (default ref dev); scripts/manifest.toml — RemoveBlock transform strips it from the scaffolded justfile.gh until the Phase 2 port; justfile — process comment; README.md / CONTRIBUTING.md — regenerated recipe tables.
  • docs/RELEASE_CYCLE.md — branch hierarchy/table, new "Hotfix lane" section (preconditions, workflow steps, fix-PR contract, sync-conflict recipe, runbook rules, rehearsal, scaffold status), seed / validate --version docs, recipe list, two troubleshooting entries.
  • CHANGELOG.md (+ mirror) — Unreleased entry.

Changelog Entry

Added

  • Hotfix release lane: cut release/X.Y.Z from main without going through
    dev
    (#1621)
    • New prepare-hotfix.yml workflow (just prepare-hotfix X.Y.Z): validates
      that the version is the next patch of the latest stable tag on main and
      that no other release/* train is in flight, forks the release branch at
      main's head, seeds an empty ## [X.Y.Z] - TBD section on the branch
      (never main, never dev), re-syncs the workspace mirror through the
      existing prepare-release-extension.yml hook and opens the draft PR to
      main. Rollback deletes the partial branch and nothing else. The fix
      lands via a bugfix/N-* PR into the release branch; candidate, final,
      promote and abandon run unchanged
    • prepare-changelog seed X.Y.Z inserts the empty section under an empty
      Unreleased and refuses anything else; prepare-changelog validate --version X.Y.Z checks the pending section carries content, and
      release.yml now gates on it so a seeded-but-unfilled section cannot
      ship. That gate reaches hotfix trains only once it has shipped through a
      normal train, since release.yml runs from main's copy for a hotfix
    • Accepted cost: the post-promote sync-main-to-dev PR conflicts on
      CHANGELOG.md whenever dev is ahead; the resolution recipe and the
      runbook rules live in docs/RELEASE_CYCLE.md (Hotfix lane). Devkit-only
      for now: the assets/workspace/ port is a follow-up, and the recipe is
      stripped from the scaffolded justfile.gh until it lands

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

  • prek run --all-files: green.
  • uv run pytest packages/vig-utils/tests: 575 passed (run with PYTHONPATH unset — the Nix devshell's store build of vig-utils shadows the editable source for the console script; CI rebuilds it from source).
  • uv run pytest tests -k "workflow or release or scaffold or abandon or promote or changelog or transforms or manifest": 639 passed; the 8 errors are tests/test_integration.py cases that need the local devcontainer:dev image, which is not built on this host.
  • Layer 1 dry-run dispatches (gh workflow run prepare-hotfix.yml --ref feature/1621-hotfix-release-lane -f dry-run=true) are pending: a dispatch-only workflow on a non-default branch is not registered by GitHub until a PR event evaluates it, so they run once this PR is open. Expected results while release/1.14.1 is in flight: 1.15.0 refused (not a patch), 1.14.2 refused (expected 1.14.1), 1.14.1 refused (branch exists). The positive case (1.14.2 after 1.14.1 promotes) and the Layer 2 candidate-only rehearsal follow after merge, per the plan.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

  • Plan and decisions: [FEATURE] Hotfix release lane: cut release/X.Y.Z from main without going through dev #1621 (comment)
  • Follow-up issues to file after merge: Phase 2 scaffold port (copy-exclude under DEVKIT_WORKFLOW=trunk, release feature group, drop the justfile.gh transform, zizmor baseline entries), a promote-release.yml guard against moving :latest backwards, and a symmetric refusal in prepare-release.yml while a hotfix branch exists.
  • The Layer 2 rehearsal (prepare-hotfix 1.14.2 → trivial fix PR → one publish-candidate → abandon-release) waits for release/1.14.1 to promote and leaves one 1.14.2-rc1 tag here plus one permanent published pre-release on devkit-smoke-test.

Refs: #1621

Cover seed_changelog(): an empty [X.Y.Z] - TBD section under an empty
Unreleased (main's shape), refusal of a non-empty Unreleased, of an
existing version section and of bad input, plus CLI end-to-end.

Refs: #1621
…from main

seed inserts an empty ## [X.Y.Z] - TBD section under an empty
## Unreleased -- the shape of main's changelog (#590) -- so a hotfix
release branch carries the heading the fix PR fills. A non-empty
Unreleased or an existing version section is refused, not folded in.

Refs: #1621
Cover validate_version_section() and the --version mode of the validate
command: a filled [X.Y.Z] - TBD section passes, a seeded-but-empty
section, a missing heading or an already-dated heading fails, and the
Unreleased section is ignored in this mode.

Refs: #1621
…ontent guard

validate --version X.Y.Z checks that the pending ## [X.Y.Z] - TBD
section exists and carries bullets, ignoring Unreleased. release.yml
uses it so a hotfix branch seeded with an empty section cannot ship
before the fix PR fills it.

Refs: #1621
Add tests/test_workflow_prepare_hotfix.py for prepare-hotfix.yml: no
job reads or writes dev, the branch is cut from main, dry-run gates
every mutating job, validate enforces patch-of-latest-main-tag and
refuses a concurrent release/* train, the seed commit lands on the
release branch and its SHA feeds the extension hook, the draft PR
targets main, rollback only deletes the partial branch, release.yml
refuses an empty pending section, and the operator recipe does not
leak into the consumer scaffold. The hotfix lane joins the extension
hook's caller contract in test_workflow_prepare_extension.py.

Refs: #1621
Cut release/X.Y.Z directly from main so an urgent fix ships as a
patch release without carrying whatever dev has accumulated. Validate
enforces MAJOR.MINOR.(PATCH+1) of the latest stable tag on main and
refuses while any other release/* train is in flight; prepare forks
the branch at main's head and seeds an empty [X.Y.Z] - TBD section on
the branch (never main, never dev); the existing
prepare-release-extension.yml hook re-syncs the workspace mirror; the
draft PR targets main; rollback deletes the partial branch and
nothing else. Candidate/final/promote/abandon run unchanged.

Refs: #1621
…lishing

release.yml's validate job only grepped for the ## [X.Y.Z] - TBD
heading. A hotfix branch is seeded with an empty section that the fix
PR must fill, so gate on prepare-changelog validate --version instead.

Refs: #1621
just prepare-hotfix X.Y.Z dispatches prepare-hotfix.yml (default ref
dev, matching prepare-release). justfile.gh is manifest-synced into the
workspace scaffold, so a RemoveBlock transform strips the recipe until
the scaffold port of the lane ships.

Refs: #1621
Add the hotfix lane to RELEASE_CYCLE.md: branch hierarchy and table,
when to use it, the validate preconditions, what prepare-hotfix.yml
does, the fix-PR contract, the sync-main-to-dev CHANGELOG conflict
recipe, the runbook rules, the rehearsal procedure and the consumer
scaffold status; document the seed subcommand and validate --version;
list just prepare-hotfix (recipe tables regenerated).

Refs: #1621
@c-vigo

c-vigo commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Layer 1 correction. The plan (and #1621) assumed a workflow pushed on a non-default branch is dispatchable. It is not: prepare-hotfix.yml is workflow_dispatch-only, and GitHub registers a workflow only when an event creates a run for it. The spike-992-conditional-container.yml precedent was registered by its own pull_request run, which this workflow deliberately does not have. With this PR open, GET /actions/workflows still lists no prepare-hotfix.yml and gh workflow run prepare-hotfix.yml --ref feature/1621-hotfix-release-lane returns HTTP 404: workflow not found on the default branch.

Consequences:

  • No dry-run or real dispatch is possible until the file is on main, i.e. after the next regular train ships this change. Merging to dev is not enough (dev is not the default branch). This also holds for the release.yml guard, as already noted.
  • just prepare-hotfix (default ref dev) works from then on exactly like prepare-release: the registration comes from main, --ref picks which copy runs.
  • Test layers before the first dispatch are therefore: the shape tests in this PR, plus (optionally) executing the validate job's bash locally against fixture refs, the same way tests/workflow_scaffold.py::run_ci_gate executes the CI-green gate. The Layer 2 candidate-only rehearsal runs after that train and after release/1.14.1 promotes, as MAJOR.MINOR.(PATCH+1) of whatever main ships then.

@c-vigo
c-vigo merged commit cccc45f into dev Sep 14, 2026
12 checks passed
@c-vigo
c-vigo deleted the feature/1621-hotfix-release-lane branch September 14, 2026 09:51
c-vigo added a commit that referenced this pull request Sep 14, 2026
…sts (#1630)

## Description

Makes `prepare-release.yml` refuse to cut a regular train while any
other `release/*` branch exists on the remote — the symmetric
counterpart of the single-train policy `prepare-hotfix.yml` enforces
(#1621, #1623). Without it a regular train can be cut from `dev` over an
in-flight hotfix: that train predates the fix, so promoting it
afterwards silently reintroduces the regression, and promoting it first
walks `:latest` backwards.

The check is branch-name based and lives in the `validate` job 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

- [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/prepare-release.yml` — new validate step **Verify
no other release train is in flight**: enumerates
`refs/remotes/origin/release/` (the checkout is `fetch-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 the `cached_tree("trunk")` render: the step directly follows the
branch-exists check, enumerates remote `release/*` refs, carries the
message and remedy, and exits 1.
- `docs/RELEASE_CYCLE.md` — Phase 1 prerequisites gain the precondition;
the `prepare-release.yml` validate step list and the hotfix-lane runbook
rule are updated (the prepare direction is now enforced in both
directions; the `:latest` promote guard is #1626).
- `CHANGELOG.md` (+ scaffold mirror) — Unreleased entry.

## Changelog Entry

### Added

- **prepare-release refuses while another release branch is in flight**
  ([#1627](#1627))
- The `validate` job of `prepare-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
the
hotfix lane's refusal, so a regular train can no longer be cut over a
hotfix and later reintroduce the regression or walk `:latest` backwards.
    Promote or abandon the other train first

## Testing

- [x] Tests pass locally (`just test`)
- [ ] Manual testing performed (describe below)

### 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.
- No live dispatch: the guard only fires when a `release/*` branch
exists, and none is in flight (1.14.1 promoted and synced today). A
dry-run dispatch with a hand-created `release/*` branch is possible once
this file is on `dev` (`just prepare-release X.Y.Z --dry-run`), but was
not run to avoid leaving a stray branch.

## 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

First of three follow-ups to the hotfix lane, landed in this order:
#1627 (this PR), #1626 (promote `:latest` guard), #1625 (scaffold port).
All ship in the next regular train.

Refs: #1627
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
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
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