Skip to content

feat(ci): refuse to cut a release while dev is behind main - #1681

Merged
c-vigo merged 6 commits into
devfrom
feature/1680-prepare-release-sync-guard
Sep 25, 2026
Merged

c-vigo merged 6 commits into
devfrom
feature/1680-prepare-release-sync-guard

Conversation

@c-vigo

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

Copy link
Copy Markdown
Contributor

Description

prepare-hotfix.yml refused to start whenever main's ## Unreleased had content, resting on #590's invariant that it never does. #1676's revised plan supersedes that invariant — main may now carry changes that have landed but are not yet shipped — and this refusal was its only mechanical blocker. Left alone, the lane that exists for urgent security incidents would refuse every time the release-neutral lane had been used.

A hotfix cuts from main's head, so it ships whatever main carries; those entries belong in the hotfix's own version section. The refusal becomes a branch on content.

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

Behaviour changes only in the case that is currently a hard error.

Changes Made

  • validate classifies instead of refusing. The step is now Classify main's Unreleased section: it probes with prepare-changelog validate, sets MODE=prepare when the section carries entries and MODE=seed when it does not, dry-probes that exact call locally, and publishes the verdict as a new changelog_mode job output.
  • prepare branches on that verdict. prepare-changelog prepare X.Y.Z freezes main's carried entries into ## [X.Y.Z] - TBD (plus a fresh empty Unreleased); prepare-changelog seed X.Y.Z writes an empty section exactly as before. The classification is load-bearing: prepare run on an empty Unreleased scoops the previous release's section instead (verified locally), which is why the mode is decided before anything is written.
  • The write still lands on the release branch only — never main, never dev — so rollback remains "delete the branch". main's ## Unreleased self-clears when the release branch merges back.
  • PR body, run summary and the seed commit message now state which of the two happened, so a non-empty section is visible rather than silently tolerated.
  • Header comments, docs/RELEASE_CYCLE.md (hotfix preconditions, CHANGELOG-state block, prepare/seed CLI reference) and docs/DOWNSTREAM_RELEASE.md record the superseded invariant.

Not changed, deliberately: release.yml's publish-time gate (prepare-changelog validate --version). No empty sections at release time; an empty section is acceptable at prepare-hotfix time. This does mean carried entries satisfy that gate without the hotfix's own fix being described — accepted on the issue, no compensating check added. Both the PR body the lane writes and the docs say so explicitly.

Commit split. Devkit's own .github/workflows/ copy and the assets/workspace/ scaffold copy land as separate commits: the first is release-neutral and can reach main through the #1676 lane, the second is a published asset and needs a release. The scaffold copy did carry the equivalent refusal (its own dialect: mode-aware toolchain, no uv run) and received the same branch.

Changelog Entry

### Fixed

- **The hotfix lane freezes `main`'s unshipped entries instead of refusing to
  start** ([#1679](https://github.com/vig-os/devkit/issues/1679))
  - `prepare-hotfix` refused to run whenever `main`'s `## Unreleased` had
    content, resting on #590's invariant that it never does. #1676 supersedes
    that invariant — `main` may now carry changes that have landed but are not
    yet shipped — and this refusal was its only mechanical blocker: the lane
    that exists for urgent security incidents would have refused every time the
    release-neutral lane had been used.
  - `validate` now classifies the section instead of refusing it and publishes
    the verdict as a `changelog_mode` job output. `prepare` freezes `main`'s
    carried entries into `## [X.Y.Z] - TBD` (`prepare-changelog prepare`) when
    there are any, and seeds an empty section (`prepare-changelog seed`) exactly
    as before when there are not. A hotfix cuts from `main`'s head, so it ships
    those changes and their entries belong in its own version section.
  - The write still lands on the **release branch only**, never on `main`, so
    rollback remains "delete the branch"; `main`'s `## Unreleased` self-clears
    when the release branch merges back, re-establishing the empty shape after
    every hotfix.
  - `release.yml`'s publish-time gate is deliberately unchanged: no empty
    sections at release time, an empty section is acceptable at
    `prepare-hotfix` time. Carried entries can therefore satisfy that gate
    without the hotfix's own fix being described — accepted, with no
    compensating check.
  - Both copies of the lane are updated: devkit's own workflow and the consumer
    scaffold's.

Testing

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

Manual Testing Details

  • TDD: tests/test_workflow_prepare_hotfix.py gained test_validate_classifies_mains_unreleased_instead_of_refusing and test_prepare_freezes_carried_entries_or_seeds_an_empty_section, both parametrized over the devkit and scaffold copies. Committed RED (4 failures), then GREEN per copy.
  • uv run pytest tests/test_workflow_prepare_hotfix.py -q -> 33 passed.
  • Full suite: uv run pytest tests/ -q --ignore=tests/test_image.py --ignore=tests/test_integration.py (those two fail locally from a stale :dev image) -> green.
  • just precommit (prek run --all-files) -> exit 0, including actionlint, shellcheck, yamllint and the sync-manifest drift gate.
  • Verified the prepare/seed semantics directly against prepare-changelog on fixture changelogs, including the failure mode that motivates classifying first: prepare on an empty ## Unreleased moves the previous release's section into the new one.

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

docs/RELEASE_CYCLE.md and docs/DOWNSTREAM_RELEASE.md are hand-maintained, not generated from docs/templates/.

Additional Notes

  • Depends on the model change in #1676's "Revised plan (2026-09-24)". This is its Phase 1; Phase 2 (prepare-release sync-ordering guard) is not in scope here.
  • Base is dev, per the repo's gitflow model.

Refs: #1679

@c-vigo
c-vigo enabled auto-merge September 25, 2026 06:24
@c-vigo
c-vigo merged commit ed0980d into dev Sep 25, 2026
12 checks passed
@c-vigo
c-vigo deleted the feature/1680-prepare-release-sync-guard branch September 25, 2026 07:00
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