Skip to content

test(changelog): gate the release headings on the version constant and on real dates (#494) - #539

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/494-changelog-heading-gate
Sep 20, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/494-changelog-heading-gate

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Closes #494.

Cutting v0.16.0 meant hand-checking that the new ## [0.16.0] - 2026-09-18 heading was a real date,
was not in the future, agreed with the version constant in cmd/objectfs/main.go, and sat above
v0.15.1. Nothing in the repository checked any of it. A hand-check is a gate that exists once.

Two tests, extending internal/config/changelog_test.go rather than adding a file, since it already
holds the CHANGELOG-vs-version-constant checks:

  • TestChangelogNewestSectionIsTheDeclaredVersion — the top released heading names what the
    binary reports. Cutting a release is two unconnected edits (promote ## [Unreleased], bump the
    constant); doing one without the other breaks no build. Checked in file order, not by sorting,
    so a new heading added below an old one fails here too.
  • TestChangelogSectionDatesAreRealAndInOrder — every date parses as 2006-01-02, none is in
    the future, dates run non-increasing in file order, versions run strictly decreasing.

Three things the file itself forced

The heading regexp captures the tail as (.*) and parses it afterwards rather than matching
- (\d{4}-\d{2}-\d{2}). A heading with a malformed date is precisely the heading this test exists to
report, and a regexp that requires a well-formed one cannot see it — the heading leaves the set and
every remaining assertion passes on the headings that were already fine.

The date is a fixed-width prefix of the tail, not the whole of it. ## [0.10.0] - 2026-02-23 — WITHDRAWN annotates after the date. Anything following has to be space-separated, or the ten
characters taken are the front of a longer token — which is its own assertion.

Equal dates are allowed. 0.10.1, 0.10.2 and 0.10.3 all shipped on 2026-08-02, so only an older
release dated strictly later than a newer one is a contradiction. Likewise the future check allows
midnight UTC tomorrow: a release cut from a timezone ahead of UTC can carry tomorrow's UTC date
legitimately, while the mistyped year this is for is wrong by far more than a day.

Non-vacuity floor of 15 headings against the 20 present. The count only grows, so it never needs
raising; its job is to fail loudly if the regexp stops matching, which would otherwise leave every
per-heading assertion trivially satisfied.

Verification

Seven mutations, each caught by a named test, none of them a build failure:

Mutation Caught by
constant bumped, heading not promoted …NewestSectionIsTheDeclaredVersion, …UnreleasedComparesFromTheNewestRelease
top heading dated next year …SectionDatesAreRealAndInOrder
top heading date is 2026-9-18 both new tests
top heading loses its date both new tests
0.15.1 dated after 0.16.0 …SectionDatesAreRealAndInOrder
a heading renumbered out of order …SectionDatesAreRealAndInOrder, …SectionsAllHaveLinkReferences
date runs into its annotation with no space both new tests

…d on real dates (#494)

Closes #494.

Cutting v0.16.0 meant hand-checking that the new `## [0.16.0] - 2026-09-18` heading was a real
date, was not in the future, agreed with the `version` constant, and sat above v0.15.1. Nothing in
the repository checked any of that, and a hand-check is a gate that exists once.

Two tests, extending changelog_test.go rather than adding a file, since it already holds the
CHANGELOG-vs-version-constant checks:

- `TestChangelogNewestSectionIsTheDeclaredVersion` — the top released heading names what
  cmd/objectfs/main.go declares. Cutting a release is two unconnected edits (promote the heading,
  bump the constant); doing one without the other breaks no build.
- `TestChangelogSectionDatesAreRealAndInOrder` — every date parses as 2006-01-02, none is in the
  future, dates run non-increasing in file order, versions run strictly decreasing.

Three things the file itself forced, none of them guessable:

The heading regexp captures the tail as `(.*)` and parses it afterwards instead of matching
`- (\d{4}-\d{2}-\d{2})`. A heading with a malformed date is the heading this test exists to report,
and a regexp requiring a well-formed one cannot see it — it leaves the set and the remaining
assertions pass on the headings that were already fine.

The date is a fixed-width prefix of the tail, not the whole of it: `## [0.10.0] - 2026-02-23 —
WITHDRAWN` annotates after the date. Anything following has to be space-separated, or the ten
characters taken are the front of a longer token.

Equal dates are allowed — 0.10.1, 0.10.2 and 0.10.3 all shipped on 2026-08-02 — so only an older
release dated strictly later than a newer one is a contradiction. And the future check allows
midnight UTC tomorrow, because a release cut from a timezone ahead of UTC can carry tomorrow's UTC
date legitimately, while the mistyped year this catches is wrong by far more than a day.

Non-vacuity floor of 15 headings against the 20 present; the count only grows, so it never needs
raising.
@scttfrdmn
scttfrdmn merged commit fbeaa0b into main Sep 20, 2026
42 checks passed
@scttfrdmn
scttfrdmn deleted the feat/494-changelog-heading-gate branch September 20, 2026 04:50
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.

CHANGELOG: nothing couples the top release heading to the version constant, or rejects a future date

1 participant