Skip to content

fix(release): publish notes in the agreed format - #198

Merged
uniqueg merged 8 commits into
devfrom
fix/release-notes-format
Oct 23, 2026
Merged

uniqueg merged 8 commits into
devfrom
fix/release-notes-format

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Release notes now follow the agreed format: intro (with a link to the upgrade steps), the grouped sections (Breaking changes, Features, Security, Fixes, Documentation, Maintenance, empty ones left out, bullets ending with issue and PR numbers), then ## Commits with GitHub's generated notes (without ## What's Changed), and last GitHub's **Full Changelog** line.

  • scripts/release_notes.py (stdlib only):
    • check <notes> checks the curated file's structure: an intro, only the allowed ## sections, in order, each once and not empty, holding bullets only, each ending with (#issue, #PR) (several pairs separated by ;), and no ## Commits or **Full Changelog** of its own.
    • body <notes> <generated> builds the release body from the curated file and the body of GitHub's generate-notes API. Generated notes in an unexpected format are kept as they are, with a warning, so that the publish job can't fail after the image is signed.
  • scripts/release_version.py previous <tag> gives the tag the generated notes start after:
    • for a stable release, the previous stable release, or the previous pre-release if there is no stable one;
    • for a/b/rc versions, the previous release of any kind;
    • nothing for the first release (all changes).
  • Release workflow:
    • The new step "Determine the previous release" sets the start tag.
    • "Create release" calls generate-notes and assembles the body when there are curated notes. Without curated notes, it uses --generate-notes as before, now with --notes-start-tag.
    • The TODO, pin and citation gates are unchanged, and so is the prerelease and latest behaviour.
  • Where the TODO check runs, the format check runs too: the release workflow's "Check release notes" step, the CI job "Check release readiness" (a warning on PRs, an error on pushes), and the pre-tag steps in docs/development.md, which now also describe the format.
  • docs/releases/0.3.0.md is restructured with no content lost:
    • Breaking changes are flat bullets prefixed by area.
    • "New features" becomes "Features"; signing and scanning moved to "Security".
    • New short "Documentation" and "Maintenance" sections.
    • Every bullet ends with its numbers.
    • The upgrade steps moved to the Upgrading page ("From versions before 0.3.0"), linked from the intro, with the references adapted.
    • The compare link of our own is dropped.
    • Both TODO(#179) markers stay.

Verification

  • pytest with coverage (mongomock): 950 passed, 210 skipped (helm-dependent); scripts/ at 100%. After the review fixes, tests/test_release_notes.py and tests/test_release_version.py: 135 passed, 100%.
  • pre-commit run --all-files passed (ruff, ruff format, mypy, semgrep, ast-grep, gitleaks, actionlint; actionlint ran without shellcheck locally).
  • mkdocs build --strict passed. The 0.3.0 page gets its <h1>0.3.0</h1> from Material, since the notes have no title.
  • python scripts/release_notes.py check docs/releases/0.3.0.md passes.
  • Body assembly, tested locally because the release path can't run without a tag. I fetched GitHub's generated notes for v0.3.0 (gh api repos/elixir-cloud-aai/cloud-registry/releases/generate-notes -f tag_name=v0.3.0 -f target_commitish=dev; this creates no release). I then ran the previous-tag pipeline (no tags, so empty) and release_notes.py body on them. The result has the curated sections, ## Commits with the PR list and "New Contributors", and ends with **Full Changelog**: https://github.com/elixir-cloud-aai/cloud-registry/commits/v0.3.0.
  • Reviews: adversarial-reviewer and quality-reviewer, 2 rounds; the confirmed findings are fixed (see the commits).
  • CodeQL flagged the HTML comment regex (py/bad-tag-filter); replaced by a plain string check.
  • Sourcery fixes: the previous release is taken from published releases only; lists and code blocks alone are no intro; Full Changelog lines in code blocks are allowed; the pre-tag check runs only if notes exist.
  • CI on the PR: all checks passed (image push and publish jobs skipped, as on all PRs).

Declined review findings

  • Two numbers per bullet: some changes have a PR but no issue (e.g., feat!: upgrade to FOCA 0.14.0 #92, refactor!: upgrade to FOCA 0.15 #127, feat(helm)!: camelCase keys and NetworkPolicies #128), so a single number is allowed.
  • Folding the TODO grep into release_notes.py check: the task was to keep the existing gates as they are.
  • Stable finding codes for the tests, and dropping Release.number in favour of order[:3]: these are style choices, with no change in behaviour.
  • Pinning the intro link to /en/v0.3.0/: the Read the Docs version of the tag may not be active, and the other links of the notes point to the latest docs (or name the pages).
  • Comments over several lines: not supported (documented in the script).
  • Sourcery: checking the intro for an upgrade link (the format asks for one only if there are upgrade steps, which the check cannot tell), and rejecting (#12; #34) (valid: two PR-only groups).

Open questions

None blocking. Note: CR has no tags yet, so the first release's ## Commits lists every merged PR since the repository started, including the legacy ones from before the last deployed version (19f664f). The generate-notes API can't start at a commit, only at a tag.

Closes #195

🤖 Generated with Claude Code

uniqueg and others added 5 commits October 23, 2026 13:39
Put the notes in the agreed format: an intro linking the upgrade
steps, then the sections Breaking changes, Features, Security,
Documentation and Maintenance, with flat bullets that end with
their issue and pull request numbers. The upgrade steps move to
the Upgrading page; the compare link of our own is dropped, as
the release workflow adds GitHub's generated notes. The
TODO(#179) markers stay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scripts/release_notes.py checks the structure of curated notes
(intro, allowed sections in order, bullets ending with issue and
pull request numbers, no parts the workflow adds) and builds the
release body from them and GitHub's generated notes, without
their What's Changed header. release_version.py gets a previous
command for the tag the generated notes start after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With curated notes, the release body is now the curated notes,
then GitHub's generated notes (generate-notes API, from the
previous release in the history of the release commit; all
changes for the first release), ending with the Full Changelog
line. The release workflow, the Check release readiness job and
the documented pre-tag steps check the notes' format besides the
TODO check. Prerelease flags are unchanged.

Closes #195

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Fences close only on the same marker, at least as long; HTML
  comment lines count as blank; a byte order mark is ignored.
- The checker is split into a state class with one method per kind
  of line.
- Unexpected generated notes are kept with a warning instead of
  failing after the image is published; the What's Changed header
  is also dropped after a configuration comment.
- A stable release without a stable predecessor starts its
  generated notes after the previous pre-release.
- The previous release is a step output of its own (with pipefail).
- Unreadable files give an error annotation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HTML comment lines inside or between bullets no longer count as the
end of the bullet, and a comment pattern no longer spans text
between two comments on one line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

This PR standardizes curated release-note structure, validates it across local and CI/release gates, assembles it with GitHub-generated notes using release-aware history, and updates the 0.3.0 documentation to match the new publishing format.

Sequence diagram for assembling and publishing release notes

sequenceDiagram
    participant Workflow as Release workflow
    participant Version as release_version.py
    participant GitHub as GitHub generate-notes API
    participant Notes as release_notes.py
    participant Release as GitHub release

    Workflow->>Version: previous_tag
    Version-->>Workflow: previous_tag
    alt Curated notes exist
        Workflow->>GitHub: generate-notes(tag_name, previous_tag_name)
        GitHub-->>Workflow: generated body
        Workflow->>Notes: body(curated, generated)
        Notes->>Notes: check(curated)
        Notes-->>Workflow: assembled release body
        Workflow->>Release: create or edit with notes file
    else No curated notes
        Workflow->>Release: create with --generate-notes
        Workflow->>Release: pass --notes-start-tag when available
    end
Loading

Flow diagram for curated release-note validation

flowchart TD
    A[Curated release notes] --> B[release_notes.py check]
    B --> C{Valid intro and ordered sections?}
    C -- No --> D[Report validation errors]
    C -- Yes --> E{Bullets have references and no generated sections?}
    E -- No --> D
    E -- Yes --> F[Allow CI and release workflow to continue]
Loading

File-Level Changes

Change Details Files
Added a standard-library release-notes validator and release-body assembler.
  • Validates intro, allowed section order, nonempty bullet-only sections, reference suffixes, and workflow-owned generated-note markers.
  • Combines curated notes with GitHub-generated commits and changelog content, removing the generated header and warning while preserving unexpected formats.
  • Added comprehensive validator, assembly, CLI, and repository-notes tests.
scripts/release_notes.py
tests/test_release_notes.py
Integrated curated and generated release notes into release automation and readiness checks.
  • Runs format validation alongside existing TODO, pin, and citation gates in CI, release workflow, and documented pre-tag commands.
  • Determines the previous release tag and uses GitHub generate-notes for curated releases, while preserving generated-only behavior otherwise.
  • Keeps prerelease/latest handling and existing-release rerun behavior intact.
.github/workflows/checks.yaml
.github/workflows/release.yaml
docs/development.md
docs/changelog.md
Implemented release-aware previous-tag selection for GitHub generated notes.
  • Orders stable, alpha, beta, and release-candidate tags semantically.
  • Selects the previous stable release for stable releases, with a pre-release fallback, and any previous release for pre-releases.
  • Added CLI and behavioral coverage for first releases, mixed versions, invalid tags, and historical tags.
scripts/release_version.py
tests/test_release_version.py
Restructured the 0.3.0 release documentation to the agreed notes format and moved upgrade guidance to the upgrading page.
  • Grouped changes into the prescribed sections, added issue/PR references, and retained TODO markers.
  • Linked the intro to detailed upgrade instructions and adapted documentation links and references.
  • Removed the title and repository-owned compare link so the release workflow can append generated notes.
docs/releases/0.3.0.md
docs/upgrading.md

Assessment against linked issues

Issue Objective Addressed Explanation
#195 Publish curated release notes together with GitHub-generated notes, preserving the generated change and contributor lists and ending with GitHub’s Full Changelog line; use the appropriate previous-release tag for generated notes. ✅
#195 Validate curated notes against the agreed structure and enforce that check in release/CI readiness workflows and documented pre-tag steps. ✅
#195 Restructure the 0.3.0 notes into the agreed intro and ordered grouped sections, move detailed upgrade steps to the upgrade documentation, and remove the locally authored compare link. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Comment thread scripts/release_notes.py Fixed
@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (52ae3db) to head (2b57652).

Additional details and impacted files
@@            Coverage Diff             @@
##               dev      #198    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           14        15     +1     
  Lines          959      1136   +177     
==========================================
+ Hits           959      1136   +177     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

uniqueg and others added 2 commits October 23, 2026 14:10
CodeQL flags the HTML comment pattern as a bad HTML filter. Lines
are checked one by one, so a plain string check does the same and
says so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg marked this pull request as ready for review October 23, 2026 12:14

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 6 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="scripts/release_version.py" line_range="158-164" />
<code_context>
+    """
+    release = parse_tag(tag)
+    below = []
+    for other in tags:
+        try:
+            other_release = parse_tag(other)
+        except ValueError:
+            continue
+        if other_release.order < release.order:
+            below.append((other_release.stable, other_release.order, other))
+    if not below:
+        return None
</code_context>
<issue_to_address>
**Unpublished tags truncate release notes**

When a lower canonical version tag is in the release commit’s history, but its workflow did not create a GitHub release, `previous_tag` treats that tag as the preceding release and passes it as the start tag for generated notes. Changes merged since the last published release but before this tag are therefore omitted from the next release’s changelog.

Select the previous start tag from published releases, or otherwise ensure an unpublished prior tag cannot be treated as the previous release.
</issue_to_address>

### Comment 2
<location path="scripts/release_notes.py" line_range="224" />
<code_context>
+                    " sections, and no rules",
+                )
+            )
+        elif self.heading_line == 0:
+            self.intro = self.intro or not blank
+        elif blank:
</code_context>
<issue_to_address>
**Non-prose preambles pass**

When the curated notes begin with a list or fenced code block and contain no prose before the first section, `_Checker._line` treats nonblank lines as an intro and `_Checker._code` marks an opening fence as one, so `check` accepts the notes and the release gates allow them through to publication without the required introductory paragraph.

Require a prose paragraph before the first section, and do not count list items or fenced code as the intro.

Also at `scripts/release_notes.py:225`, `scripts/release_notes.py:255-256`.
</issue_to_address>

### Comment 3
<location path="scripts/release_notes.py" line_range="225" />
<code_context>
+                )
+            )
+        elif self.heading_line == 0:
+            self.intro = self.intro or not blank
+        elif blank:
+            if self.item:
</code_context>
<issue_to_address>
**Upgrade links pass unchecked**

When curated notes have upgrade steps but their intro has no link to them, `_Checker._line` marks any nonblank intro text as present, without checking for a link. Release notes with upgrade steps but no link therefore pass the format gate and can be published without the required route to those steps.

Validate the required upgrade link in the intro, or otherwise ensure the format gate checks it when upgrade steps exist.
</issue_to_address>

### Comment 4
<location path="scripts/release_notes.py" line_range="200" />
<code_context>
+            number: Number of the line.
+            line: Text of the line.
+        """
+        if line.lstrip().startswith(FULL_CHANGELOG):
+            self.findings.append(
+                Finding(
</code_context>
<issue_to_address>
**Valid examples are rejected**

When a fenced example contains a line beginning with `**Full Changelog**`, `_Checker._line` records the `Full Changelog` finding before checking whether the line is inside a fenced code block, so the release-note gate rejects otherwise valid notes and blocks the release.

Check whether a line is inside a fenced code block before flagging the `Full Changelog` heading.
</issue_to_address>

### Comment 5
<location path="docs/development.md" line_range="124" />
<code_context>
 python scripts/citation.py check X.Y.Z
 python scripts/check_release_pins.py
 ! grep -n TODO docs/releases/X.Y.Z.md  # curated notes, if any
+python scripts/release_notes.py check docs/releases/X.Y.Z.md  # their format, if any
 readme="$(mktemp -d)/README.md" && cp deployment/README.md "${readme}"
 python scripts/chart_readme.py "${readme}" vX.Y.Z  # links of the chart
</code_context>
<issue_to_address>
**Optional notes block tagging**

When a release has no curated-notes file, the documented pre-tag command runs `release_notes.py check` unconditionally, and it returns an error for the absent file, stopping the checklist before the tag can be created.

Run the format check only when the optional curated-notes file exists.
</issue_to_address>

### Comment 6
<location path="scripts/release_notes.py" line_range="69" />
<code_context>
+ITEM = re.compile(r"(?:[-*+]|[0-9]+[.)])(?:[ \t]|$)")
+# The end of a bullet: its issue and pull request numbers, e.g., `(#12, #34)`
+# (only the pull request's if it closes no issue)
+REFERENCES = re.compile(r".*\(#[0-9]+(?:[,;][ \t]*#[0-9]+)*\)", re.ASCII)
+
+BULLETS_ONLY = "Sections hold bullets only, e.g., - <change> (#12, #34)"
</code_context>
<issue_to_address>
**Malformed reference groups pass**

When a bullet ends with references separated or grouped contrary to the agreed pair format, `REFERENCES` accepts an arbitrary sequence of issue numbers separated by commas or semicolons, so endings such as `(#12; #34)` pass even though semicolons are meant to separate issue-and-PR pairs. The checker can therefore approve bullets that do not follow the agreed reference format.

Validate each ending as an allowed single PR reference or as one or more issue/PR pairs separated by semicolons.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 6 findings to address first, and if the previous-tag selection or notes assembly is wrong, a release could publish an inaccurate notes body. That change is bounded and can be corrected by rerunning the workflow or editing the release; reverting the code alone would not undo notes already published.

Blocking findings: scripts/release_version.py:164, scripts/release_notes.py:224, scripts/release_notes.py:225, scripts/release_notes.py:200, docs/development.md:124, and 1 more


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread scripts/release_version.py Resolved
Comment thread scripts/release_notes.py Resolved
Comment thread scripts/release_notes.py Resolved
Comment thread scripts/release_notes.py Resolved
Comment thread docs/development.md Resolved
Comment thread scripts/release_notes.py Resolved
- The previous release for the generated notes is the previous
  published release, so changes of a tag whose release failed are
  listed in the next release.
- Lists and code blocks alone are no intro paragraph.
- Full Changelog lines in code blocks are not findings.
- The documented pre-tag check runs only if curated notes exist.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit ba5ace9 into dev Oct 23, 2026
17 checks passed
@uniqueg
uniqueg deleted the fix/release-notes-format branch October 23, 2026 12:26
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.

fix(release): publish notes in the agreed format

2 participants