Repository navigation
feat: refuse a promote that would move :latest backwards - #1631
Merged
Merged
Conversation
11 of 22 tasks
Base automatically changed from
feature/1627-prepare-release-single-train
to
dev
September 14, 2026 14:26
## 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
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
Adds a semver guard to
promote-release.ymlso a promote can never move the floating refs backwards. Devkit moves GHCR:latestunconditionally; with the hotfix lane (#1621, #1623) a patch cut frommainand a train cut fromdevcould, if both existed, promote in the wrong order and walk:latestback to an older version. The guard is the last line of defence behind the single-train refusals (#1627): thevalidatejob 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.versionlabel exists (the image is built by Nix;flake.nixsets only title/source/licenses) and reading GHCR metadata needs apackagesscope 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-trainbecause both PRs rewrite the same hotfix runbook paragraph. Once #1630 merges, this branch gets rebased ontodevso the diff shrinks to the commits listed below.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/promote-release.yml— new validate step Verify version does not move :latest backwards, after the draft-release check: pagesrepos/{repo}/releases, keepsdraft == false && prerelease == falsebare-semver tags, takes the highest withsort -V, and fails whenVERSIONsorts 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 onneeds.resolve-toolchain.outputs.floating-tags != ''; release tags are filtered to theTAG_PREFIXline 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 withghstubbed 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
:latestbackwards(#1626)
promote-release.ymlvalidatejob now compares the versionagainst the highest published final GitHub Release (the version
:latestfollows) 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
tags, active only when
DEVKIT_FLOATING_TAGSis set; release tags arecompared after the tag prefix is stripped, and consumers without
floating tags keep the freedom to publish a patch for an older line
Testing
just test)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.Checklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
Second of three hotfix-lane follow-ups: #1627 (#1630) → #1626 (this PR) → #1625 (scaffold port). Merge #1630 first.
Refs: #1626