diff --git a/.github/scripts/integration-governance.cjs b/.github/scripts/integration-governance.cjs index 7344f0a980..f117381e0d 100644 --- a/.github/scripts/integration-governance.cjs +++ b/.github/scripts/integration-governance.cjs @@ -9,7 +9,7 @@ const MAX_COMMITS = 1000; const MAX_AUTHOR_BATCH = 50; // This literal is inside the enrolled .github closure. A caller-supplied // preparedBy.sourceSHA must never choose a new executable verifier tree. -const TRUSTED_SCRIPTS_TREE = '68aa6a3ea98f2ab257c8d492b39b8a661092786d'; +const TRUSTED_SCRIPTS_TREE = 'af7a0249a3df8e6197ff49031d4cb6c4e00581c6'; const SOURCE = 'https://github.com/kubernetes-sigs/kubebuilder-release-tools/tree/012269a88fa4c034a0acf1ba84c26b195c0dbab4'; const sha = value => crypto.createHash('sha256').update(value).digest('hex'); const git = (args, cwd = process.cwd()) => diff --git a/changelog.d/README.md b/changelog.d/README.md index 81f5c42cd4..01e1f28adf 100644 --- a/changelog.d/README.md +++ b/changelog.d/README.md @@ -36,10 +36,17 @@ deleting the fragments in the same release commit. need no fragment only if non-user-visible (routine refactors, dependency churn, or test-adjacent code like `testdata/` or non-`_test.go` test helpers) — put a `no-changelog` label on such PRs. -- The `` escape hatch +- The `` bump escape hatch (`src/docs/releases.md`) may ride in a fragment as its first line; it is compiled into `Unreleased` verbatim and honoured by `derive-release-version.sh` exactly as a hand-placed marker is. + **`` is rejected in fragments** (by + `check-changelog-fragment.sh` at PR time and `compile-changelog.sh` at + release time): a fragment persists until the release that consumes it, and + `none` is what forbids that release, so a single such fragment freezes + every later merge until a human deletes it — [#12928](https://github.com/hivecommons/hive/pull/12928) + stalled releases for three weeks this way. A non-user-visible change wants + no fragment and the `no-changelog` label instead. Example — a complete fragment, `changelog.d/fixed-1234-relay-timeout.md`: diff --git a/changelog.d/changed-12923-off-prompt-fixture.md b/changelog.d/changed-12923-off-prompt-fixture.md deleted file mode 100644 index 5d25addc33..0000000000 --- a/changelog.d/changed-12923-off-prompt-fixture.md +++ /dev/null @@ -1,2 +0,0 @@ - -- Keep the busy-visibility regression cases aligned by reusing the off-prompt pane fixture when checking the recovery threshold (#12923). diff --git a/changelog.d/fixed-release-none-fragment-stall.md b/changelog.d/fixed-release-none-fragment-stall.md new file mode 100644 index 0000000000..a2e8df80c2 --- /dev/null +++ b/changelog.d/fixed-release-none-fragment-stall.md @@ -0,0 +1 @@ +- Tagged releases resume: a `release: none` HTML-comment marker that rode in a `changelog.d/` fragment (#12928, merged 2026-10-19) was compiled into `## Unreleased` on every merge and made the release workflow's decide job skip every commit since v5.186.4 as an "explicit human override" — the fragment could only be consumed by the very release it vetoed. The fragment is removed; `check-changelog-fragment.sh` and `compile-changelog.sh` now reject a `none` marker in a fragment (bump markers stay allowed); and a hand-placed `none` freeze in CHANGELOG.md is surfaced as a workflow warning annotation and fails the decide job once it has outlived `RELEASE_FREEZE_MAX_DAYS` (default 7) instead of silently skipping forever. Also fixed on the way out: with the resulting 1,369-fragment backlog the bump inference's `grep -q` died of SIGPIPE under `pipefail` and would have labelled the catch-up release a patch instead of the minor its `### Added` section calls for. diff --git a/src/docs/releases.md b/src/docs/releases.md index 4b6d559e72..168d909e2e 100644 --- a/src/docs/releases.md +++ b/src/docs/releases.md @@ -134,7 +134,20 @@ decision: ``` suppresses a release for this merge even if `Unreleased` has content (the -entries stay queued for the next release that does fire). Or force a specific +entries stay queued for the next release that does fire). Note the +consequence under the fragment model: nothing but a release empties +`Unreleased`, so a `none` marker placed there (by hand, in `CHANGELOG.md`) +is a **release freeze** that lasts until a human removes it, not a one-merge +skip — the decide job emits a `::warning::` annotation on every run while it +is in force, and fails outright once the newest tag is older than +`RELEASE_FREEZE_MAX_DAYS` (default 7; `0` disables) so a forgotten freeze +turns red instead of looking like a healthy no-op. For the same reason the marker is **rejected in a +`changelog.d/` fragment** by `check-changelog-fragment.sh` and +`compile-changelog.sh`: a fragment lives until the release that consumes it, +so a `none` fragment can never be consumed and vetoes every later merge +(#12928 stalled v5 releases from 2026-10-19 to 2026-11-07 this way). A +change that should not be mentioned wants no fragment and the +`no-changelog` label. Or force a specific bump regardless of which headers are present: ```markdown diff --git a/src/scripts/check-changelog-fragment.sh b/src/scripts/check-changelog-fragment.sh index 42715385c2..f7843a3abd 100755 --- a/src/scripts/check-changelog-fragment.sh +++ b/src/scripts/check-changelog-fragment.sh @@ -71,10 +71,19 @@ while IFS= read -r f; do case "$first_line" in '- '*|'' marker) — it IS the entry; the compiler owns the ### headings" + echo "::error file=$f::a fragment must start with a '- ' entry bullet (or a '' marker) — it IS the entry; the compiler owns the ### headings" bad=1 ;; esac + # A fragment persists until the next release consumes it, and a + # `` marker is exactly what prevents that release — so + # one in a fragment vetoes every later merge, forever (#12928 stalled the + # release train for three weeks this way). Test-only/no-op changes want the + # `no-changelog` label and no fragment, not a none marker. + if grep -qE '' "$f"; then + echo "::error file=$f::'' is not allowed in a fragment: fragments accumulate until a release is cut, so this marker would block every release until a human deletes it. Delete the fragment (and label the PR no-changelog) if the change is not user-visible; only major|minor|patch markers may ride in a fragment." + bad=1 + fi done < "$work_dir"/fragments.txt if [ "$bad" -ne 0 ]; then exit 1 diff --git a/src/scripts/compile-changelog.sh b/src/scripts/compile-changelog.sh index 2efc45f7b5..da089b4a46 100755 --- a/src/scripts/compile-changelog.sh +++ b/src/scripts/compile-changelog.sh @@ -36,8 +36,11 @@ # CHANGELOG.md edits therefore keep working alongside fragments, which is # what the 7-day transition window relies on. # - A fragment's first non-blank line must start with `- ` (an entry bullet) -# or be a `` marker, so the escape hatch -# derive-release-version.sh honours can also ride in a fragment. +# or be a `` marker, so the bump escape +# hatch derive-release-version.sh honours can also ride in a fragment. +# `` is REJECTED in fragments: a fragment persists +# until the release that consumes it, and `none` is what prevents that +# release, so one such fragment silently freezes every later merge. # - Each fragment is deleted after a successful compile, so `git add -A # changelog.d` in the release commit records the consumption. # @@ -117,7 +120,17 @@ for f in "${fragments[@]}"; do echo "::error::${f}: fragment is empty" >&2 bad=1 elif ! [[ "$first_line" == "- "* || "$first_line" == "' marker); it is the entry itself, not a section with its own headings" >&2 + echo "::error::${f}: a fragment must start with a '- ' entry bullet (or a '' marker); it is the entry itself, not a section with its own headings" >&2 + bad=1 + fi + # `none` is self-deadlocking in a fragment: the fragment lives until the + # release that consumes it, and the marker is what forbids that release. + # #12928 landed one on 2026-10-19 and every decide job for the next three + # weeks (~1,600 commits) skipped on "explicit human override" while nobody + # had asked for a freeze. Fail loudly here so the stall shows up as a red + # decide job on the very next merge instead of a quiet skip. + if grep -qE '' "$f"; then + echo "::error::${f}: '' is not allowed in a fragment — it would veto every release until a human deletes it (see changelog.d/README.md). Delete the fragment instead; only major|minor|patch markers may ride in a fragment." >&2 bad=1 fi done diff --git a/src/scripts/derive-release-version.sh b/src/scripts/derive-release-version.sh index 17079e0e58..67d80047b2 100755 --- a/src/scripts/derive-release-version.sh +++ b/src/scripts/derive-release-version.sh @@ -115,7 +115,26 @@ if [[ ${#markers[@]} -eq 1 ]]; then fi if [[ "$override" == "none" ]]; then + # A ::warning:: rather than a plain echo: this skip is a human-placed + # freeze, and a freeze nobody remembers placing looks exactly like a + # healthy no-op run (#12928 held releases for three weeks that way). Once + # the freeze has outlived RELEASE_FREEZE_MAX_DAYS (default 7) since the + # newest tag, fail the decide job outright so the stall turns red. + echo "::warning::CHANGELOG.md Unreleased section carries ; releases are frozen until that marker is removed." echo "Unreleased section carries ; skipping this merge by explicit human override." + max_days="${RELEASE_FREEZE_MAX_DAYS:-7}" + newest_tag="$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' 2>/dev/null | sort -V | tail -1 || true)" + if [[ -n "$newest_tag" && "$max_days" -gt 0 ]]; then + tag_epoch="$(git log -1 --format=%ct "${newest_tag}^{commit}" 2>/dev/null || echo 0)" + if [[ "$tag_epoch" -gt 0 ]]; then + age_days=$(( ( $(date +%s) - tag_epoch ) / 86400 )) + if [[ "$age_days" -gt "$max_days" ]]; then + echo "::error:: has suppressed releases for ${age_days} days (newest tag ${newest_tag}; limit RELEASE_FREEZE_MAX_DAYS=${max_days}). Remove the marker from CHANGELOG.md's Unreleased section, or raise RELEASE_FREEZE_MAX_DAYS if the freeze is deliberate." >&2 + emit release false + exit 1 + fi + fi + fi emit release false exit 0 fi @@ -151,7 +170,12 @@ else # declared with the explicit `` marker. Crossing a # release line stays a human decision, which is what it already is # everywhere else in this repo. - if printf '%s\n' "$unreleased" | grep -qE '^### Added[[:space:]]*$'; then + # No `grep -q` here: under `set -o pipefail` a -q grep exits on the first + # match and the printf feeding it dies of SIGPIPE once the body outgrows + # the pipe buffer (~64 KiB), turning a found `### Added` into pipeline + # failure => a silent patch. Seen live on the 1,369-fragment backlog + # compiled after #12928. Let grep read to EOF instead. + if printf '%s\n' "$unreleased" | grep -E '^### Added[[:space:]]*$' >/dev/null; then bump=minor else bump=patch diff --git a/src/scripts/test-compile-changelog.sh b/src/scripts/test-compile-changelog.sh index c35d2131e0..80ac652ffb 100755 --- a/src/scripts/test-compile-changelog.sh +++ b/src/scripts/test-compile-changelog.sh @@ -187,6 +187,40 @@ else note_ok "a fragment that is not a '- ' entry bullet is rejected" fi +# --------------------------------------------------------------------------- +# Case 5b: `` in a fragment is rejected (#12928). The +# fragment survives until a release consumes it, and the marker forbids that +# release — so one fragment would freeze every later merge. A bump marker +# (`patch`) in a fragment stays legal and still compiles verbatim. +# --------------------------------------------------------------------------- +dir=$(new_case 5b) +printf -- '\n- a test-only tweak that should have been a no-changelog label.\n' > "$dir/changelog.d/changed-11-none.md" +printf -- '- a real fix ([#12](https://example.invalid/12)).\n' > "$dir/changelog.d/fixed-12-real.md" +if ( cd "$dir" && bash "$compile" CHANGELOG.md changelog.d ) > "$tmp/case5b.out" 2>&1; then + note_fail "a fragment carrying '' must be rejected" +else + if grep -q 'release: none' "$tmp/case5b.out" && [[ -f "$dir/changelog.d/fixed-12-real.md" ]]; then + note_ok "a fragment carrying '' is rejected loudly, with every fragment left on disk" + else + note_fail "rejection of a none-marker fragment must name the marker and leave fragments untouched: $(cat "$tmp/case5b.out")" + fi +fi + +dir=$(new_case 5c) +git init -q "$dir" +git -C "$dir" config user.email test@example.com +git -C "$dir" config user.name "Test" +git -C "$dir" -c commit.gpgsign=false commit -q --allow-empty -m init +git -C "$dir" tag v1.0.0 +printf -- '\n- an added thing that must only bump patch.\n' > "$dir/changelog.d/added-13-patch.md" +if ( cd "$dir" && bash "$compile" CHANGELOG.md changelog.d ) > "$tmp/case5c.out" 2>&1 \ + && grep -q '' "$dir/CHANGELOG.md" \ + && [[ "$(cd "$dir" && GITHUB_OUTPUT="" bash "$derive" CHANGELOG.md | grep -E '^(release|bump|version)=' | tr '\n' ' ')" == "release=true version=1.0.1 bump=patch " ]]; then + note_ok "a bump marker in a fragment still compiles and still forces the bump" +else + note_fail "a '' fragment must remain legal: $(cat "$tmp/case5c.out")" +fi + # --------------------------------------------------------------------------- # Case 6: fenced prose that mentions `## Unreleased` must not be treated as # the target section. This pins the #5918/#5939 bug class for both the diff --git a/src/scripts/test-derive-release-version.sh b/src/scripts/test-derive-release-version.sh index 65b6a4a36c..144e755249 100755 --- a/src/scripts/test-derive-release-version.sh +++ b/src/scripts/test-derive-release-version.sh @@ -74,6 +74,22 @@ else note_fail "expected release=true bump=minor version=1.3.0, got: $out" fi +# --------------------------------------------------------------------------- +# Case 3b: a very large Unreleased body (well past the ~64 KiB pipe buffer) +# with `### Added` near the top must still infer minor. A `grep -q` in the +# inference pipeline exits on first match, the feeding printf takes SIGPIPE, +# and pipefail turned that into "no Added => patch" on the 1,369-fragment +# backlog compiled after #12928. +# --------------------------------------------------------------------------- +big_body=$'## Unreleased\n\n### Added\n\n- first feature\n\n### Fixed\n\n' +big_body+="$(yes '- a long fixed entry line that pads the section well past the pipe buffer size so the test is meaningful.' | head -n 4000)"$'\n' +out=$(run "$big_body" v1.2.3) +if [[ "$(get "$out" release)" == "true" && "$(get "$out" version)" == "1.3.0" ]]; then + note_ok "### Added in a >64KiB Unreleased body still infers minor (no SIGPIPE/pipefail regression)" +else + note_fail "expected 1.3.0 from a large Added-carrying section, got: $(printf '%s' "$out" | tail -3)" +fi + # --------------------------------------------------------------------------- # Case 4: ### Security present is release-worthy but does not cut a new # release line by itself, so Added still controls the minor bump. @@ -96,6 +112,35 @@ else note_fail "expected release=false with release:none marker, got: $out" fi +# --------------------------------------------------------------------------- +# Case 5b: a release:none freeze that has outlived RELEASE_FREEZE_MAX_DAYS +# since the newest tag fails the decide job loudly (#12928: three silent +# weeks). Same marker on a fresh tag (case 5) stays a quiet release=false; +# RELEASE_FREEZE_MAX_DAYS=0 disables the age check. +# --------------------------------------------------------------------------- +old_epoch=$(( $(date +%s) - 30 * 86400 )) +GIT_AUTHOR_DATE="@${old_epoch} +0000" GIT_COMMITTER_DATE="@${old_epoch} +0000" \ + git -C "$repo" commit -q --allow-empty -m "old release point" +git -C "$repo" tag -d $(git -C "$repo" tag -l 'v*') >/dev/null 2>&1 || true +git -C "$repo" tag -f v2.0.0 >/dev/null 2>&1 +printf '%s' $'## Unreleased\n\n\n\n### Added\n\n- frozen\n' > "$repo/CHANGELOG.md" +if out=$( cd "$repo" && GITHUB_OUTPUT="" bash "$derive" CHANGELOG.md 2>&1 ); then + note_fail "a 30-day release:none freeze must fail the decide job, got exit 0: $out" +elif printf '%s' "$out" | grep -q '::error::.*release: none.*30 days'; then + note_ok "release:none freeze older than RELEASE_FREEZE_MAX_DAYS fails loudly with its age" +else + note_fail "expected a ::error:: naming the freeze age, got: $out" +fi +if out=$( cd "$repo" && GITHUB_OUTPUT="" RELEASE_FREEZE_MAX_DAYS=0 bash "$derive" CHANGELOG.md 2>&1 ) \ + && [[ "$(get "$out" release)" == "false" ]]; then + note_ok "RELEASE_FREEZE_MAX_DAYS=0 disables the freeze-age check" +else + note_fail "expected a quiet release=false with the age check disabled, got: $out" +fi +# Later cases tag the current commit; leave it dated now again. +git -C "$repo" commit -q --allow-empty -m "back to now" +git -C "$repo" tag -d $(git -C "$repo" tag -l 'v*') >/dev/null 2>&1 || true + # --------------------------------------------------------------------------- # Case 6: escape hatch forces a bump type regardless of headers present. # ---------------------------------------------------------------------------