Skip to content

ci: prepend custom notes to generated notes - #543

Merged
uniqueg merged 6 commits into
devfrom
feat/release-notes
Oct 27, 2026
Merged

uniqueg merged 6 commits into
devfrom
feat/release-notes

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Summary

The release workflow now publishes the curated release notes followed by GitHub's generated notes, as cloud-registry's does, so a release needs no editing on GitHub afterwards.

  • scripts/release_notes.py, ported from cloud-registry, with its tests in tests/test_release_notes.py:

    • check checks curated notes (docs/releases/<version>.md) against the agreed format.
    • body builds the release body: the curated notes, then ## Commits with the generated notes (without ## What's Changed), then the **Full Changelog** line last.
    • require fails if a release has no notes while other releases do.
    • CR's first command is left out, because FOCA already has published releases. The previous tag stays GitHub's choice, as with --generate-notes before.
    • Links to the root of the docs (https://foca.readthedocs.io/, /en/) are flagged as links to a version that moves. This is an addition on top of CR, from review.
  • release.yml:

    • build: a new step, "Check release notes", runs before anything is built or published. It fails if the notes are missing although required, contain TODO, or are not in the format.
    • publish: the order is unchanged: create a draft, upload, publish last. The notes come from the generate-notes API plus body, and are passed with --notes-file to create and to the final edit.
    • Re-runs on a draft replace its notes rather than adding to them.
    • A published release still exits early and keeps its notes. This deliberately differs from CR, which overwrites a published release's notes with the curated ones: without an explicit previous tag, re-generated notes for an already-published release might start at the release itself, and a release published by hand already has the notes someone chose.
  • ci.yml: a new job, "Release readiness", copied from CR without its pin check. It runs the same checks for the version in CITATION.cff while that version is untagged, or on the tagged commit itself:

    • on pull requests, findings are warnings;
    • on pushes to dev, they are errors.

    The job is in the CI passed gate's needs, so the ruleset doesn't change.

  • Docs:

    • docs/contributing.md has a new "Release notes" section: the format, where the notes go (docs/releases/X.Y.Z.md, the nav of mkdocs.yml, the changelog), that they belong in the PR that sets the citation metadata, and the checks.
    • The changelog lists the release notes.
    • The version guard allows docs/releases/*.md to name their release.
  • docs/releases/0.18.0.md is backfilled from the published v0.18.0 body. Two changes were needed to pass the check: the periods after the reference numbers are removed, and the /en/latest/ link is now /en/v0.18.0/. With this file in place, notes are required from the next release on, as in CR.

Verification

  • ruff check, ruff format --check, mypy (134 files) and ast-grep scan: clean.
  • pytest -m "not mongodb": 2921 passed. The MongoDB tests did not run locally because no server is on :12345; CI runs them.
  • tests/test_release_notes.py: covers scripts/release_notes.py fully, apart from the __main__ guard, which test_script exercises in a subprocess.
  • mkdocs build --strict: passes. A notes file that is missing from the nav fails the build (checked by hand).
  • actionlint: one finding, SC2102 at ci.yml:56, which is in the lint job and was already on dev.
  • zizmor --offline: the same 19 findings as on dev, 12 of them suppressed.
  • Dry run with a fake gh, 28/28 checks passed. The script is dryrun.sh in the foca-539-dryrun folder of the work folder. It runs the run: scripts of the changed steps from the workflow files under bash -e, with a gh stub that logs its calls and returns canned JSON.
    • Create release, no release yet: creates a draft with --notes-file and no --generate-notes, uploads, then publishes with the same notes. The body is exactly: curated notes, ## Commits, the generated list including New Contributors, and the Full Changelog line last.
    • Draft from an earlier attempt: no new release is created; the notes are replaced and appear once.
    • Published release: only the release list is read; nothing is uploaded or edited.
    • No notes in the repository: the generated notes are published as they are.
    • Check release notes: missing notes, TODO, a bad format and a /en/latest/ link each fail; valid notes pass.
    • Release readiness: on a PR, missing or bad notes give warnings and the job passes. On a push, missing notes fail it. The tagged commit itself is checked, and commits after the tag are skipped.
  • CI: all checks pass, including "Release readiness" and CI passed. "Chart install" failed once, when the Helm test pod in kind timed out (the PR changes no charts). It passed on the re-run of the failed jobs.

Review

The adversarial and quality reviewers found nothing high or medium. Fixed lows:

  • links to the docs root were not flagged;
  • ::error:: annotations of the readiness job were not turned into warnings on PRs;
  • a comment that didn't name its file;
  • over-long lines in the contributing guide.

Sourcery raised two points, both fixed in 4b5f407, and both threads are resolved:

  • check now rejects relative links.
  • The readiness job now also detects lightweight tags.

The dry run now has 30/30 checks, the extra two covering lightweight tags. CI passed again on 4b5f407.

Declined review findings

  • The changelog list of release notes is not checked automatically. Only the nav entry is enforced, by the strict docs build. This matches CR; adding a check is out of scope.
  • Published releases keep their notes, unlike in CR. This is deliberate; the reasons are in the summary above.
  • The docs host is not anchored on its left (round 2, low). As a result, notfoca.readthedocs.io/en/latest/ is flagged too. It is a false positive on a contrived input, and CR has the same pattern, so I left it as it is for parity.

Closes #539

🤖 Generated with Claude Code

Summary by Sourcery

Automate validated, curated release notes alongside GitHub-generated changes throughout the release workflow.

New Features:

  • Add curated release notes for versioned releases and combine them with GitHub-generated notes in published release bodies.

Bug Fixes:

  • Prevent incomplete, malformed, missing, or unstable-link release notes from being published.

Enhancements:

  • Add release-note validation for the agreed structure, references, links, and required-release policy.
  • Preserve and replace notes correctly across draft reruns while leaving already-published release notes unchanged.
  • Add release-readiness checks to CI and integrate release notes into contributor guidance, documentation navigation, changelog, and version validation.

CI:

  • Add a Release readiness job that reports warnings on pull requests and enforces release-note checks on pushes to dev.

Documentation:

  • Document the release-note format, authoring requirements, validation checks, and publication behavior.
  • Backfill and publish the 0.18.0 curated release notes.

Tests:

  • Add comprehensive tests for release-note validation, body generation, required-note detection, link checks, and command-line behavior.

uniqueg and others added 4 commits October 27, 2026 03:37
Port cloud-registry's scripts/release_notes.py: `check` checks curated
notes (docs/releases/<version>.md) against the agreed format, `body`
prepends them to GitHub's generated notes under "## Commits", without
the "## What's Changed" header and with the "**Full Changelog**" line
last, and `require` fails if a release lacks notes once another release
has them. The `first` command is left out, as FOCA has published
releases. The version guard allows curated notes to name their release.

Refs #539

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The release workflow checks the curated notes of the release in the
build job, before anything is published (missing although required,
TODO, format), and the publish job creates the draft and publishes it
with the curated notes followed by GitHub's generated ones, as
cloud-registry does. A re-run on a draft replaces its notes rather than
adding to them; a published release keeps its notes. The CI job
"Release readiness" runs the same checks for the version in
CITATION.cff while it is not tagged (warnings on pull requests).

Refs #539

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Describe the format, where the notes go (docs/releases/X.Y.Z.md, the
mkdocs nav and the changelog), that they are part of the pull request
that sets the citation metadata, and the checks. Add the notes of 0.18.0
from its published release (without the periods after the numbers and
with a versioned link, as the check requires), so that notes are
required from the next release on.

Closes #539

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Flag links to the root of the docs, which redirect to a version that
moves; turn all error annotations of the readiness job into warnings on
pull requests; rewrap the contributing guide.

Refs #539

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

sourcery-ai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

This PR introduces validated, versioned curated release notes and integrates them into release publication by composing them ahead of GitHub-generated notes, while adding CI readiness checks, workflow safeguards, documentation, and backfilled 0.18.0 notes.

Sequence diagram for release notes publication

sequenceDiagram
    participant ReleaseWorkflow
    participant GitHubAPI
    participant ReleaseNotes
    participant GitHubRelease

    ReleaseWorkflow->>ReleaseNotes: require VERSION
    ReleaseWorkflow->>ReleaseNotes: check curated notes
    ReleaseWorkflow->>GitHubAPI: generate-notes TAG
    GitHubAPI-->>ReleaseWorkflow: generated notes
    ReleaseWorkflow->>ReleaseNotes: body curated generated
    ReleaseNotes-->>ReleaseWorkflow: composed notes
    ReleaseWorkflow->>GitHubRelease: create --notes-file
    ReleaseWorkflow->>GitHubRelease: upload assets
    ReleaseWorkflow->>GitHubRelease: edit --notes-file --draft=false
Loading

Flow diagram for release readiness checks

flowchart TD
    A[CITATION.cff version] --> B{Version tagged elsewhere?}
    B -->|Yes, different commit| C[Skip readiness checks]
    B -->|No, or tagged commit| D[require curated notes]
    D --> E[Check for TODO]
    E --> F[check notes format and moving links]
    F --> G{Pull request?}
    G -->|Yes| H[Emit warnings]
    G -->|No, push to dev| I[Fail on findings]
    I --> J[CI passed gate]
    H --> J
Loading

File-Level Changes

Change Details Files
Add a standard-library release-notes utility that validates curated Markdown, enforces when notes are required, detects moving links, and composes curated notes with GitHub-generated content.
  • Validate intro, ordered sections, bullet references, prohibited generated sections, and stable documentation/repository links.
  • Build release bodies with curated notes, generated commits, and the full changelog in the required order while warning on unexpected generated-note formats.
  • Add commands and comprehensive unit/subprocess coverage for checking, composing, and required-note detection.
scripts/release_notes.py
tests/test_release_notes.py
Integrate curated release-note validation and body generation into the release workflow without changing its draft/upload/publish sequencing.
  • Fail the build before publishing when required notes are missing, unfinished, or malformed.
  • Generate notes through GitHub's API, prepend curated notes, and pass the resulting notes file when creating and publishing releases.
  • Replace notes on draft reruns while preserving notes and exiting early for already-published releases.
.github/workflows/release.yml
Add release-readiness checks to CI and include them in the existing required gate.
  • Check the version from CITATION.cff while it is untagged or on the tagged commit.
  • Report findings as warnings on pull requests and errors on pushes to dev.
  • Add the readiness job to the CI passed job's dependencies.
.github/workflows/ci.yml
Document the curated release-note workflow and backfill the existing release documentation.
  • Define the required note format, stable-link rules, file/nav/changelog locations, and validation behavior.
  • Add the 0.18.0 notes to the docs navigation and changelog, and backfill its curated release file.
  • Allow release-note paths in version-mention validation.
docs/contributing.md
docs/changelog.md
docs/releases/0.18.0.md
mkdocs.yml
tests/test_version_mentions.py

Assessment against linked issues

Issue Objective Addressed Explanation
#539 Prepend curated release notes for the release tag to GitHub-generated notes, retaining the generated commits and Full Changelog content in the agreed order and format. ✅
#539 Validate that required notes exist and are complete before publication, and handle reruns without duplicating notes while preserving the draft, upload, publish order and existing release-assets behavior. ✅
#539 Document the notes location, format, and release process in the contributing guide. ✅

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

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (feaa834) to head (f1ea39e).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #543   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           55        55           
  Lines         6667      6667           
=========================================
  Hits          6667      6667           
Flag Coverage Δ
test_unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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
uniqueg marked this pull request as ready for review October 27, 2026 10:25

@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 2 issues

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

## Individual Comments

### Comment 1
<location path=".github/workflows/ci.yml" line_range="371" />
<code_context>
+          # The commit of the (annotated) tag, if any: later commits are
+          # skipped, but not the tagged commit itself (e.g., if it was
+          # tagged before this job ran)
+          tagged="$(git ls-remote origin "refs/tags/v${version}^{}" | cut -f1)"
+          if [[ -n "${tagged}" && "${tagged}" != "${SHA}" ]]; then
+              echo "v${version} is tagged: no release in preparation"
</code_context>
<issue_to_address>
**Lightweight tags stay undetected**

When the release tag is lightweight and later pushes to `dev` occur while `CITATION.cff` still names that version, `git ls-remote` finds only the peeled ref, which lightweight tags do not have, so readiness treats the already-released version as untagged and continues checking its notes on later pushes; changed or removed notes can then fail the CI gate.

Check both the direct tag ref and its peeled ref when detecting whether the version is tagged.
</issue_to_address>

### Comment 2
<location path="scripts/release_notes.py" line_range="373" />
<code_context>
+    findings = _Checker().run(lines) + [
+        Finding(number, MOVING_LINK)
+        for number, line in enumerate(lines, start=1)
+        if UNVERSIONED.search(line)
+    ]
+    return sorted(findings, key=lambda finding: finding.line)
</code_context>
<issue_to_address>
**Relative links break in releases**

When curated notes contain a relative link to a docs page or file, `check` only searches for `UNVERSIONED` links, so it accepts relative links and publishes them unchanged. GitHub resolves them from the release page rather than the documentation site, leaving readers with broken or incorrect links.

Reject relative Markdown links in curated notes.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 2 findings to address first, and a malformed or misleading curated note can be published publicly as part of a release, alongside GitHub’s generated notes. Reverting the workflow prevents future use but does not retract notes already published with a release.

Blocking findings: .github/workflows/ci.yml:371, scripts/release_notes.py:373


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

Comment thread .github/workflows/ci.yml Resolved
Comment thread scripts/release_notes.py Resolved
uniqueg and others added 2 commits October 27, 2026 16:09
Reject relative links in curated release notes, which do not resolve in
GitHub releases, and detect lightweight release tags in the readiness
job too.

Refs #539

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit 5de21a6 into dev Oct 27, 2026
31 checks passed
@uniqueg
uniqueg deleted the feat/release-notes branch October 27, 2026 15:30
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.

ci: prepend custom notes to generated notes

1 participant