fix(release): release notes come from the CHANGELOG, not the tag message

Same-day correction to ee2259f. That commit followed the order literally --
"use the tag's own message" -- and the result was an llm-security v8.0.0
release page reading "llm-security v8.0.0" and nothing else.

The defect is structural, not a typo: --create-tag mints -m "<name>
v<version>", so the tag message is mechanical EXACTLY where this helper made
the tag. The tag message is a good source only for tags written by hand.

The right source was already proven on the instance: llm-security v7.8.3's
release body is byte-for-byte its CHANGELOG `## [7.8.3]` section. So the
CHANGELOG is the org's established source, not a new invention -- and all 10
backfilled repos ship one (measured, 10/10).

- extractChangelogSection / releaseBodyFrom: pure, tested. Priority is
  CHANGELOG section -> tag message -> empty, and the source is REPORTED so a
  run says where the text came from rather than implying it wrote it.
- Three heading dialects are live and all three are covered: `## [6.0.0] -
  date`, `## [0.2.0] -- date` (em-dash), `## v1.0 (date)`, and voyage's
  `## v5.10.1 -- date -- trailing prose`. The version token matches exactly,
  so 0.1.0-pre is not 0.1.0 and 1.1.0 is not 1.10.0. An empty section (the
  standing `## [Unreleased]`) returns null so the caller falls through
  instead of publishing a blank body.
- backfill gains --repair for the backlog the first cut created. It PATCHes
  a PUBLISHED page, so the bar is strictly more informative, never merely
  different: no CHANGELOG section means no update, and a hand-written body at
  least as long as the section is left alone. Measured: that rule is what
  protects portfolio-optimiser v1.1.0 (4750 hand-written chars vs 3704).

Dry-run over the org: 14 release objects would gain real notes, e.g.
llm-security v8.0.0 19 chars -> 10530, config-audit v6.0.0 19 -> 27309.

18 new tests, written red first. Suite 211/211; check-versions 12/12 OK.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-18 02:41:18 +02:00
commit f9a99056fe
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
5 changed files with 384 additions and 29 deletions

View file

@ -96,12 +96,29 @@ their own Forgejo repositories under `https://git.fromaitochitta.com/open/`.
object for their newest tag** — llm-security's releases page said `v7.8.3` while the catalog
pinned `v8.0.0`. That is the same tag-vs-published drift the catalog-`ref` bump exists to
prevent, one surface further out, and it is what a human reads to answer "what version is out?".
- **The release body is the tag's own message, VERBATIM, or empty.** Never generated prose —
an invented release note is a claim about the release that nobody made. Read it with
`%(contents:subject)` + `%(contents:body)`, **never `%(contents)`**: `~/.gitconfig` sets
`tag.gpgsign` with `gpg.format ssh`, so `%(contents)` drags the whole
`-----BEGIN SSH SIGNATURE-----` block into the release notes (verified on `llm-security`
`v8.0.0`).
- **The release body is the plugin's own CHANGELOG section for that version** — falling back
to the tag message, falling back to empty. Never generated prose: an invented release note
is a claim about the release that nobody made.
**CORRECTED 2026-09-18, same day, after the first cut shipped.** The order said "use the
tag's own message", and that was followed literally — which produced a `v8.0.0` release
page reading `llm-security v8.0.0` and nothing else. The defect is structural, not a typo:
`--create-tag` mints `-m "<name> v<version>"`, so **the tag message is mechanical exactly
where this helper made the tag.** The right source was already proven on the instance —
`llm-security` `v7.8.3`'s release body is **byte-for-byte** its CHANGELOG `## [7.8.3]`
section — so the CHANGELOG is the org's established source, not a new invention. All 10
backfilled repos ship one (measured 2026-09-18, **10/10**).
- **Three heading dialects are live and all three are load-bearing:** `## [6.0.0] - date`,
`## [0.2.0] — date` (em-dash), `## v1.0 (date)`, and voyage's
`## v5.10.1 — date — trailing prose`. The version token is matched **exactly**, so
`0.1.0-pre` is not `0.1.0`, `1.1.0` is not `1.10.0`, and an EMPTY section (the standing
`## [Unreleased]`) returns null so the caller falls through instead of publishing a blank.
- The **tag message** remains the fallback, and where it is used it is read with
`%(contents:subject)` + `%(contents:body)`, **never `%(contents)`**: `~/.gitconfig` sets
`tag.gpgsign` with `gpg.format ssh`, so `%(contents)` drags the whole
`-----BEGIN SSH SIGNATURE-----` block into the release notes (verified on `llm-security`
`v8.0.0`).
- The run **reports which source it used** (`changelog` / `tag-message` / `none`). `none`
is the one worth seeing: the page went up with an empty body — honest, but useless.
- **It fires only on a run that PUBLISHES** (`--create-tag --write`, or `--push`). Filing a
release object is itself a publish, so it must not ride along on a local `--write` and slip
past the operator's one-shot push token. A non-publishing `--write` says so and names the
@ -122,7 +139,14 @@ their own Forgejo repositories under `https://git.fromaitochitta.com/open/`.
applies, `--repo <owner>/<name>` narrows). It reuses `release-plugin.mjs`'s own planner and API
shell rather than reimplementing them, so the backlog and the release path cannot drift apart.
It considers **only the newest tag** (that is the FERDIG-criterion the order set), and reports
the denominator. **Documented exception:** `ktg-plugin-marketplace` `pre-polyrepo-archive`
the denominator. **`--repair` is the second mode:** it replaces a release body that should
have been the CHANGELOG section but isn't — the backlog the first cut created. Because it
PATCHes a **published** page, the bar is deliberately *strictly more informative*, never
merely *different*: no CHANGELOG section means no update (a body is never blanked), and a
hand-written body at least as long as the CHANGELOG section is left exactly as it is
(measured 2026-09-18: that rule is what protects `portfolio-optimiser` `v1.1.0`, whose
4750-char hand-written body beats its 3704-char CHANGELOG section).
**Documented exception:** `ktg-plugin-marketplace` `pre-polyrepo-archive`
an archive marker for the monorepo before the polyrepo split, not a release (non-semver, and
no install path consumes it). The exclusion register is keyed by repo **AND tag**, never by
repo alone, so that repo's next real release is still backfilled.