Skip to content

fix(release): cut the release branch before the changelog freeze - #1483

Merged
c-vigo merged 2 commits into
devfrom
bugfix/1479-trunk-release-branch-topology
Aug 13, 2026
Merged

c-vigo merged 2 commits into
devfrom
bugfix/1479-trunk-release-branch-topology

Conversation

@c-vigo

@c-vigo c-vigo commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes the trunk release train. Under DEVKIT_WORKFLOW=trunk,
render_workflow_model() was a pure literal dev -> main rewrite, so
prepare-release.yml froze the CHANGELOG onto main and then cut
release/X.Y.Z from that same post-freeze SHA, while the draft PR was still
opened --base main --head release/X.Y.Z. Head and base resolved to one commit
and gh pr create failed with "No commits between main and release/X.Y.Z".
The same freeze was also a direct push to the protected trunk.

vig-os/org-config is blocked on exactly this; its v1.0.0/v1.0.1 were
hand-cut, so the train has never executed there and the defect stayed latent.

Type of Change

  • fix -- Bug fix

Changes Made

The shipped (gitflow) asset is restructured into a model-agnostic ordering,
so the trunk render stays a literal substitution with no step reordering in sed:

  1. capture prepare_start_sha = base head (dev; trunk: main)
  2. create release/X.Y.Z at that pre-freeze SHA — moved ahead of the freeze
  3. freeze -> TARGET_BRANCH = refs/heads/dev (trunk: the release branch)
  4. freeze_wait — the [BUG] prepare-release can branch release/X.Y.Z at pre-freeze dev SHA (read-after-write race) #617 read-after-write loop, now watching FREEZE_REF
  5. fast-forward release/X.Y.Z onto the freeze commit (force=false); under
    trunk the SHAs already match and the step short-circuits

open-pr gained an explicit same-SHA guard before gh pr create — the
regression assert the issue asks for, since a local-git simulation cannot express
GitHub's server-side refusal (which is why the #1206 spike could not catch this).

Verified on the actual trunk render: base reads resolve to heads/main, the
freeze TARGET_BRANCH and FREEZE_REF resolve to the release branch, the
rollback's restore target likewise, and there are zero residual bare dev
tokens
. The freeze therefore never touches the trunk, so no Commit App bypass
on main is required
— consistent with how #1227 was resolved.

gitflow is behaviourally unchanged: the freeze still lands on dev and the
release branch still ends at the freeze commit (now by fast-forward instead of by
late creation). test_gitflow_scaffold_matches_default_path and
test_gitflow_render_files_are_byte_identical_to_template still pass.

Incidental improvement: a failure between the freeze and branch creation used
to leave dev_sha empty, silently skipping the rollback's changelog restore;
freeze_sha is now emitted immediately after the freeze.

Changelog Entry

### Fixed

- **Trunk release: cut the release branch before the changelog freeze**
  ([#1479](https://github.com/vig-os/devkit/issues/1479))

(full entry with sub-bullets is in CHANGELOG.md)

Testing

  • uv run pytest tests/test_workflow_model.py -> 12 failed before the fix, 32 passed after
  • uv run pytest tests/test_workflow_model.py tests/test_workflow_prepare_extension.py tests/test_release_core.py tests/test_release_rollback_guard.py tests/test_scaffold_lint.py tests/test_scaffold_drift.py -> 136 passed
  • full suite uv run pytest -m "not integration" -> 1355 passed, 20 skipped
  • just test-bats -> 506 ok, 0 not ok — including a new case running actionlint over the trunk-rendered workflows (previously only gitflow renders were linted)
  • prek run --all-files -> only check-expirations fails; .vulnixignore is byte-identical to dev on this branch. Fixed by fix(security): renew the glibc exception block to 2026-09-02 #1482 — merge that first.

Manual Testing Details

Rendered a trunk scaffold and read the resulting prepare-release.yml directly to
confirm the branch/freeze/PR topology and the absence of dev residue.

No live CI proof exists in this repo — devkit-smoke-test is gitflow, so every
automated leg here exercises only the unchanged gitflow path. Live proof will be
vig-os/org-config's next release train.

Closes #1479

Refs: #1479

c-vigo added 2 commits August 13, 2026 10:03
Assert the shape #1479 requires before implementing it: the release branch
is created BEFORE the changelog freeze, the freeze target is dev under
gitflow and release/X.Y.Z under trunk (never the trunk itself), the
release-branch fast-forward is non-forcing and gated on this run having
created the branch, and open-pr refuses a zero-commit release PR via an
explicit same-SHA guard.

The two existing assertions that encoded the defective topology are
retargeted in the same commit: `refs/heads/main` in a trunk render (nothing
writes to the trunk any more) and the `dev_sha` output name (renamed to the
model-neutral `freeze_sha`).

Refs: #1479
Under DEVKIT_WORKFLOW=trunk the rendered prepare-release.yml froze the
CHANGELOG onto main and then cut release/X.Y.Z from that same post-freeze
SHA, so `gh pr create --base main --head release/X.Y.Z` had head == base
and GitHub refused it ("No commits between main and release/X.Y.Z"). The
freeze was also a direct push to the trunk, which a require-PR ruleset
rejects unless the Commit App is a bypass actor (the #1227 collision class).

Reorder the shipped (gitflow) asset into a model-agnostic shape so the
trunk render stays a literal substitution: capture the base SHA, create
release/X.Y.Z at it, freeze onto the model's freeze target, wait for that
target to advance (#617, retargeted via FREEZE_REF), then fast-forward the
release branch onto the freeze commit. Under gitflow that fast-forward is
real and the leg is behaviour-identical; under trunk the freeze already
landed on the release branch, so it short-circuits and main is never
written to — by the prepare freeze or by the rollback's restore.

The fast-forward is non-force and gated on this run having created the
branch: a pre-existing release/X.Y.Z may carry commits that are not
ancestors of the freeze commit, where the update is not a fast-forward at
all, so it is skipped exactly as branch creation has always tolerated it.
The rollback's freeze-ref read is taken after the branch delete and
tolerates a missing ref, which is what makes the trunk restore a natural
no-op. `open-pr` gains an explicit same-SHA guard: a collapsed topology now
fails with a named cause instead of an opaque GitHub refusal, which is the
regression assert a local-git simulation cannot express (#1206).

The prepare job's `dev_sha` output becomes `freeze_sha` (it is the freeze
commit under either model) and a new bats case runs actionlint over the
trunk-rendered workflows, the render class that now substitutes a ${{ }}
expression into workflow env values.

Refs: #1479
@c-vigo
c-vigo force-pushed the bugfix/1479-trunk-release-branch-topology branch from 879e44f to 116e1a5 Compare August 13, 2026 08:05
@c-vigo
c-vigo merged commit 4c2a693 into dev Aug 13, 2026
12 checks passed
@c-vigo
c-vigo deleted the bugfix/1479-trunk-release-branch-topology branch August 13, 2026 08:15
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