Skip to content

chore: fix the 3.16.0 changelog and harden the release version bump - #20356

Merged
aknuds1 merged 5 commits into
prometheus:owilliams/release-3.16-fixesfrom
aknuds1:pr-20346-fixes
Nov 6, 2026
Merged

aknuds1 merged 5 commits into
prometheus:owilliams/release-3.16-fixesfrom
aknuds1:pr-20346-fixes

Conversation

@aknuds1

@aknuds1 aknuds1 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Fixes for #20346, proposed against its head branch owilliams/release-3.16-fixes, on top of its current head (f6beddd49).

Changelog

All three entries still sitting in ## main / unreleased are already released, so they would be listed again in the next release's notes:

Also rewords the two subquery-statistics entries in the 3.16.0 block so they no longer contradict each other: subqueries contribute their underlying sample consumption to TotalSamples (#19165), while #19873 stopped counting their materialized results a second time — the previous wording said both "included" and "not counted".

Release version bump

scripts/bump_changelog_version.sh (added in this release cycle) replaced the first non-main / unreleased heading no matter which release it belonged to, so a run before the release notes were pasted silently relabelled the previous release's section. Now:

  • only a heading for the version in VERSION, or for a pre-release of the same version, is rewritten, which covers the renames a release performs (rc.N → rc.N+1, rc.N → final); any other heading is refused;
  • a VERSION that is not a release version is refused, so a trailing space or CR cannot end up in the heading;
  • generate_release_notes.sh puts the requested version in the heading instead of the release branch name, so pasted notes are accepted;
  • make bump-versions runs the changelog step before ui-bump-version, so a refusal leaves the tree untouched.

Drift check

The drift this tooling exists to prevent (v3.16.0-rc.3 was tagged while the heading still said rc.2; the rc.0 section sat with a YYYY-MM-DD placeholder date for five days) is decidable from two files, so --check verifies it without writing: the newest heading must name the version in VERSION and have a YYYY-MM-DD date. The "Check release notes" workflow runs it on PRs to the release branches, so drift fails the release PR instead of being tagged.

Tests

scripts/bump_changelog_version_test.sh has nine cases: the heading transitions a release performs, the refusals, and the --check outcomes, using headings recorded from the 3.16 release where possible. It runs via make test-scripts, which make test and the required "Check generated parser" CI job call.

RELEASE.md documents the flow. The last commit trims the first version of this after review (calendar validation of dates, an already-tagged guard, CRLF/whitespace normalisation and a --date flag are gone), so the combined diff reads more easily than the individual commits.

NONE

The three entries in the "main / unreleased" section are all released
already, so they would be listed again in the next release notes:

- the exporter-toolkit HTTP/2 fix is in 3.16.0 as prometheus#19848 (the entry cited
  prometheus#19807, which is the issue, not the PR),
- the promtool --allow-incompatible-block-duration entry is in 3.16.0 as
  prometheus#19363,
- the sigv4 v0.5.0 upgrade is in 3.15.0 as prometheus#19569.

Also reword the two subquery statistics entries in the 3.16.0 section so
they no longer contradict each other: subqueries contribute their
underlying sample consumption to TotalSamples, while prometheus#19873 stopped
counting their materialized results a second time.

Signed-off-by: Arve Knudsen <[email protected]>
@aknuds1
aknuds1 requested review from a team, SuperQ and simonpasquier as code owners November 6, 2026 10:55
@aknuds1
aknuds1 requested review from ywwg and a balanced review from Copilot November 6, 2026 11:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The changelog matcher rejects the documented release-notes generator output, breaking the generator-to-bump flow; the generator needs a version-rendering fix and an end-to-end regression test.

1 open issue
What changed in this PR

This PR cleans up the 3.16.0 changelog and strengthens release tooling to prevent unsafe heading rewrites and catch version drift before release.

Changes:

  • Removes already-released entries from the unreleased section and clarifies subquery sample statistics.
  • Adds guarded version bumps, calendar-date validation, deterministic dates, and a read-only consistency check.
  • Adds regression coverage, integrates checks into CI, and documents the release flow.
File Description
scripts/​bump_changelog_version.sh Adds rewrite safeguards, date validation, and --check mode.
scripts/​bump_changelog_version_test.sh Adds regression cases for release transitions, refusals, and Makefile integration.
RELEASE.md Documents guarded bumps, date overrides, and CI checks.
Makefile Runs changelog updates before UI updates and adds script tests.
CHANGELOG.md Removes duplicate release entries and clarifies subquery statistics.
.github/​workflows/​ci.yml Runs release-script tests in the existing required job.
.github/​workflows/​check_release_notes.yml Checks changelog heading consistency with VERSION.

Review effort: Balanced

Comment thread scripts/bump_changelog_version.sh Resolved
The script replaced the first non-"main / unreleased" heading in
CHANGELOG.md no matter which release it belonged to. If the generated
release notes had not been pasted in yet, or a stale tree was used, the
previous release's heading was silently relabelled instead of the script
failing. The "no release heading found" guard never fired either, since a
real CHANGELOG.md always has a heading.

The heading is now only rewritten when it belongs to the version in the
VERSION file, including the pre-release heading that a final release
promotes in place: bumping 3.16.0-rc.4 to 3.16.0 renames
"## 3.16.0-rc.4" rather than adding a section, which makes the script
reproduce the hand-made 3.16.0 release commit byte for byte. A heading
for an already tagged version is refused too, since re-dating a released
section is the same kind of corruption; only local tags are visible to
that check, and it is skipped outside a git repository. Every refusal
exits non-zero with a single message and leaves CHANGELOG.md untouched.

The recorded date no longer depends on when the script happens to run:
--date sets it, the date is validated against the calendar in bash rather
than by relying on whether the local date(1) understands -d or -f, and an
empty or missing value is rejected. Whitespace and a CR left in VERSION
are stripped before the optional "v" prefix, and the rewritten heading
keeps the line ending of the file, so a CRLF checkout does not end up
with mixed endings.

Run the changelog step before ui-bump-version in the bump-versions target
so a refusal leaves the working tree untouched instead of half-applied,
and pass the release date through it with make bump-versions
RELEASE_DATE=..., which RELEASE.md now documents next to the date bullet
it supersedes.

Signed-off-by: Arve Knudsen <[email protected]>
The script has no coverage, and the release flow is only exercised a
handful of times per year, so a wrong heading is likely to be noticed
after the notes are published.

Each case builds a throwaway tree with a VERSION file and a CHANGELOG.md,
runs the script in it, and asserts the exit status, the resulting newest
release heading, that a refusal leaves CHANGELOG.md untouched, that a
successful run rewrites the heading and nothing else, and that no
temporary file is left behind. A CRLF changelog must also stay CRLF end
to end.

The cases cover every heading transition the 3.16 release performed, that
is rc.N to rc.N+1 and rc.N to the final version, one of them replayed
from the recorded history (815458a's "## 3.16.0-rc.2" heading with
VERSION 3.16.0-rc.4 must produce e7d153c's "## 3.16.0-rc.4" heading),
plus the previous-release relabelling that motivated the hardening,
already tagged versions, a tag for a different version, whitespace and a
"v" prefix in VERSION, calendar-invalid dates, the default release date,
a changelog without a "main / unreleased" heading as main looked after
the 3.14 merge, and the argument errors.

The cases run below a GIT_CEILING_DIRECTORIES boundary, since git would
otherwise report the tags of an enclosing repository and trip the
already-tagged guard. The two tag cases are skipped when git is not on
PATH, and the bump-versions case is skipped when make is not available,
so make test still works from a source tarball or a minimal image.

The bump-versions case reads `make -n bump-versions` to check that the
changelog step runs before ui-bump-version, so a refusal leaves the tree
untouched, and that RELEASE_DATE reaches the script when given and is
omitted otherwise.

Run them with make test-scripts, which make test and the required "Check
generated parser" CI job now call, so a regression fails CI instead of
being found at release time.

Signed-off-by: Arve Knudsen <[email protected]>
Release branches drift when VERSION is bumped without bumping the newest
CHANGELOG heading: 3.16.0-rc.3 was tagged while its released notes still
said 3.16.0-rc.2, which is what the rest of this tooling exists to avoid.
That invariant is decidable from two files without writing anything, so
check it directly instead of relying on whoever runs the bump to get it
right.

--check verifies that the newest release heading matches the version in
VERSION, writes nothing, and exits non-zero on a mismatch. The "Check
release notes" workflow now runs it for pull requests to main and the
release branches, so the drift fails the PR rather than being published:
it is the only change that would have caught the rc.3 tag by itself.

Rename the usage output accordingly and cover the new mode in the script
tests, including the recorded rc.2/rc.3 mismatch from the 3.16 release.

Signed-off-by: Arve Knudsen <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the changelog and release-tooling changes.

1 open issue

Review effort: Balanced

@ywwg ywwg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imho the changelog bumping script changes are a little overkill... if the script did something bad I assume someone would notice in the diff and then fix it by hand, rather than blindly trusting the script output. but I suppose the maintenance burden is not high for LLM code.

Comment thread scripts/bump_changelog_version.sh Resolved
Following review, drop the safeguards that only defend against mistakes
a release shepherd would see in the release PR's diff: the calendar
validation of the date, the already-tagged guard, CRLF and whitespace
handling, the --date flag with RELEASE_DATE, and the branch-protection
note in RELEASE.md. Also drop checks that a later check already covers,
and run the one test file directly instead of globbing for test files.

Keep the refusal to relabel another release's heading and the --check
mode run in CI, since v3.16.0-rc.3 was tagged with an rc.2 heading
without anyone noticing. Both modes now parse the newest heading once;
the bump decides in bash whether the heading is ours and then rewrites
it with the original awk one-liner. --check validates the date with a
YYYY-MM-DD pattern, which is enough to catch the placeholder that
generate_release_notes.sh emits. The VERSION format check stays: without
whitespace stripping, it is what refuses a VERSION with a trailing space
or CR, which --check would otherwise accept.

Run --check only on pull requests to the release branches, which is
where releases are tagged from; on main, drift would fail every
unrelated pull request until someone fixed it.

The test suite shrinks to nine cases: the heading transitions a release
performs, the refusals, and the --check outcomes.

Signed-off-by: Arve Knudsen <[email protected]>
@aknuds1
aknuds1 requested a review from ywwg November 6, 2026 16:38
@aknuds1

aknuds1 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

@ywwg I've trimmed down the changes. Can you take another look? I tried to make the script sufficiently robust, which I think should be helpful to people carrying out releases. The tests should prevent regressions.

@ywwg ywwg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, thanks for the fixes.

@aknuds1
aknuds1 merged commit 55c0080 into prometheus:owilliams/release-3.16-fixes Nov 6, 2026
34 checks passed
@aknuds1
aknuds1 deleted the pr-20346-fixes branch November 6, 2026 17:19
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.

3 participants