Skip to content

ci: separate package and chart release notes - #759

Merged
uniqueg merged 5 commits into
devfrom
ci/758-chart-releases
Nov 9, 2026
Merged

uniqueg merged 5 commits into
devfrom
ci/758-chart-releases

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Summary

foca has two release streams in one repository. The package and images use vX.Y.Z tags (release.yml), and the library chart foca-common uses chart-vX.Y.Z tags (release-chart.yml). Until now, only the package got GitHub releases. Their notes listed every pull request since the previous release, including those that changed only the chart. This PR separates the two.

  • scripts/release_notes.py has a new command, generated <tag> --repo <owner/name>. Both workflows use it.

    • It reads the stream from the tag prefix and lists that stream's tags.
    • It calls GitHub's generate-notes with previous_tag_name set to the previous tag of the same stream (previous_tag). Without that, GitHub compares against the latest release of either stream.
      • A final release compares against the previous final release, so that the list covers everything its curated notes describe.
      • A pre-release compares against the previous release of either kind.
    • It keeps only the pull requests of the stream, in "What's Changed" and in "New Contributors". It reads each pull request's files with gh api pulls/<n>/files, renames included. Sections left empty are dropped, and the **Full Changelog** line stays last.
    • If the files of a pull request can't be listed, the pull request is kept and a warning is printed, because the package or chart is already published at that point.
  • Scope (CHART_PATHS): these files belong to the chart:

    • the chart itself, charts/foca-common/, with its tests, and tests/test_chart*.py
    • docs/helm-chart.md and docs/releases/chart/
    • the example apps' charts, examples/*/chart/
    • release-chart.yml and the former charts.yml
    • the actions test-chart and install-chart, and .github/kind/

    Everything else belongs to the package, including the migration guides, the deployment docs, mkdocs.yml, docs/changelog.md and ci.yml. A pull request that changed both appears in both. That includes a chart's release preparation, which adds its notes to the docs.

  • release.yml (publish): uses generated, and the job gets pull-requests: read.

  • release-chart.yml:

    • test checks the curated notes docs/releases/chart/X.Y.Z.md before anything is published: they must exist, contain no TODO, and follow the agreed format.
    • A new last job, release ("Publish chart release"), runs in the environment release like publish, so it needs its own approval. Only this job has contents: write and pull-requests: read.
      • It creates the release "foca-common X.Y.Z" as a draft with --verify-tag and then publishes it.
      • The release is always --latest=false, and --prerelease before 1.0.0.
      • The body is the curated notes, then ## Commits with the generated notes since the previous chart-v* tag, then GitHub's Full Changelog line.
      • A re-run finishes a draft and leaves a published release as it is.
  • Chart changelog: curated notes for foca-common 0.1.0 to 0.5.0 are in docs/releases/chart/, listed in the docs' changelog and nav. The version-mention guard allows them by path.

  • Docs: "Release notes" in docs/contributing/index.md, "Releases" in docs/helm-chart.md, and docs/changelog.md.

This PR publishes nothing. I used the same script to prepare the retrospective releases of chart-v0.1.0 to chart-v0.5.0, and corrected notes for the package releases that listed chart-only pull requests (v0.17.0, v0.20.0 and v0.21.0); the maintainer gets these separately. Over v0.16.0 to v0.22.0, the filter drops four chart-only pull requests from the package notes: #411, #422, #642 and #672. Most chart pull requests also changed FOCA's migration guides or deployment docs, so they stay in both.

The shared action publish-release of elixir-cloud-aai/.github (.github#65) doesn't exist yet. Once it does, it needs inputs for the previous tag and a path filter before it can replace these steps. That is a follow-up for .github#65.

Closes #758

Verification

  • pytest tests/test_release_notes.py tests/test_version_mentions.py: 245 passed. The script's own coverage is 99%: the only line not run is the __main__ guard, which a subprocess test runs. Coverage counts only foca/.
  • Full pytest: 901 passed, but tests/factories/test_celery_worker_fork.py fails locally because it needs a MongoDB on localhost:12345. This is unrelated, and CI runs it with its service.
  • pre-commit run --all-files: all hooks passed except semgrep. The semgrep hook exits 2 locally in this environment, so I also ran semgrep directly with the hook's arguments on the whole repo: 0 findings on 298 files.
  • ruff check, ruff format, mypy scripts/release_notes.py tests/test_release_notes.py: clean.
  • mkdocs build --strict: passes.
  • actionlint is not configured in this repo, so I didn't run it.
  • End-to-end against the real API: python scripts/release_notes.py generated <tag> --repo elixir-cloud-aai/foca for all five chart tags and v0.16.0 to v0.22.0. The output matched the separately computed filtered notes. Commit ranges: the previous chart tag for chart releases, and the previous v* tag for package releases. chart-v0.1.0 has no previous chart tag, and GitHub picks v0.15.0...chart-v0.1.0.
  • CI: all checks passed (run 42633173431), including Chart install and Release readiness, and again on 436b344 after the Sourcery fixes. 252 tests in tests/test_release_notes.py and tests/test_version_mentions.py pass locally, and the real-API run gives the same notes for all twelve tags.
  • Sourcery: three findings fixed in 436b344.
    • The previous tag skips tags without a published GitHub release, if any candidate has one.
    • A pull request with as many files as the API lists (3000) is kept, with a warning.
    • A chart tag with several releases fails the job with instructions.
  • Sourcery: one finding answered without a change. Past releases aren't repository files; their bodies go to the maintainer.

Lane

Full lane, because this changes release workflows. Two rounds with the adversarial-reviewer and quality-reviewer subagents; all findings were fixed except those below.

Declined review findings

  • Quality, low: in_stream validates the stream although the CLI only passes known streams. I kept it, because it is a public helper.
  • Quality, low: release-chart.yml has its own draft/published state check instead of release.yml's release_assets.py state. Chart releases have no assets, so the simpler check fits; the step's comment points to release.yml.
  • Quality, low (round 2): generated_notes could be split into smaller helpers. It is short and fully tested through a fake gh, so I left it as one function.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Separate package and library chart release notes and automate independent GitHub releases for each stream.

New Features:

  • Add independent GitHub releases and curated changelogs for the foca-common library chart.
  • Generate release notes separately for package and chart release streams, filtering pull requests by the files they change.

Bug Fixes:

  • Prevent package release notes from including pull requests that only change the library chart.
  • Ensure generated notes compare against the appropriate previous tag within the same release stream.

Enhancements:

  • Strengthen chart release validation and publishing workflows, including draft-safe release creation, approvals, and stream-specific permissions.

CI:

  • Validate chart release notes in CI before publishing and add comprehensive coverage for stream selection, tag handling, filtering, and GitHub API failures.

Documentation:

  • Document the separate chart release process and add retrospective foca-common release notes to the documentation navigation and changelog.

uniqueg and others added 3 commits November 9, 2026 14:45
The repository has two release streams, the package (v* tags,
release.yml) and the library chart foca-common (chart-v* tags,
release-chart.yml), but only the package got GitHub releases, and their
notes listed all pull requests since the previous release, including
those that only changed the chart.

- scripts/release_notes.py: new commands `previous` (the previous tag of
  the same stream) and `filter` (GitHub's generated notes with only the
  pull requests of a stream, by the files they changed, read with gh);
  the chart's files are CHART_PATHS, everything else is the package's,
  so pull requests that changed both are in both.
- release.yml: generated notes since the previous v* tag, without
  chart-only pull requests.
- release-chart.yml: the first job checks the curated notes
  docs/releases/chart/X.Y.Z.md; a new last job "Publish chart release"
  (environment release) creates the GitHub release "foca-common X.Y.Z"
  as a draft, then publishes it, as a pre-release before 1.0.0 and never
  as the latest release.
- Curated notes for foca-common 0.1.0 to 0.5.0, in the docs' changelog.
- Docs: release notes in contributing/index.md and the chart's
  "Releases" in helm-chart.md.

Closes #758

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review findings on the first commit:

- One command, `release_notes.py generated <tag> --repo`, lists the
  stream's tags, finds the previous one, calls generate-notes and
  filters it, instead of the same shell steps in both workflows.
- A pull request whose files can't be listed is kept, with a warning,
  as the package or chart is published by then.
- Final releases compare against the previous final release, so that
  the list covers what their curated notes describe.
- The chart's tests in tests/ (test_chart*.py) belong to the chart.
- Docs list the chart's files completely, and say that a chart's
  release preparation is in both streams' notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Round 2 review findings:

- Release tags may have leading zeros, as the workflows accept them, so
  that a tag never fails the notes after publishing.
- A pull request whose files can't be listed is warned about once, also
  if it is in two sections.
- Docs paragraphs re-wrapped; the test fake finds the endpoint by name.

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

sourcery-ai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Define the release-stream tag patterns, chart file scope, and generated-note parsing constants that the selection and filtering logic depends on.

  • scripts/release_notes.py L55, L139-183

API

Add the generated <tag> --repo command and its argument parsing and dispatch so workflows can request stream-specific generated notes.

  • scripts/release_notes.py L23-32, L830-855, L910-921 (+2 small edits)

Uses of the API

Use the shared generated-notes command for package releases and grant the job permission to inspect pull-request files.

  • .github/workflows/release.yml L11-13, L423, L475-485

Validate chart notes before publishing, then create or finish a chart GitHub release using the chart-specific generated notes.

  • .github/workflows/release-chart.yml L99-120, L248-330

Implementation

Select the previous same-stream tag and implement stream detection, pull-request file classification, GitHub note generation, and filtering.

  • scripts/release_notes.py L517-829, L886-887

Configuration

Add the chart release-note pages to the documentation navigation and clarify that both release streams have curated notes.

  • mkdocs.yml L101-103, L150-155

Documentation

Document the separate chart changelog and list the retrospective foca-common releases.

  • docs/changelog.md L24-35

Explain generated-note ranges and stream filtering in the release-note contribution guidance.

  • docs/contributing/index.md L372-384

Document curated chart notes, release checks and approvals, generated chart-release contents, and retry behaviour.

  • docs/helm-chart.md L1188-1195, L1210-1243

Add the curated release notes for foca-common 0.1.0.

  • docs/releases/chart/0.1.0.md L1-20

Add the curated release notes for foca-common 0.2.0.

  • docs/releases/chart/0.2.0.md L1-21

Add the curated release notes for foca-common 0.3.0.

  • docs/releases/chart/0.3.0.md L1-20

Add the curated release notes for foca-common 0.4.0.

  • docs/releases/chart/0.4.0.md L1-15

Add the curated release notes for foca-common 0.5.0.

  • docs/releases/chart/0.5.0.md L1-16

Tests

Test stream tag selection, generated-note filtering, GitHub CLI interactions, and failure handling.

  • tests/test_release_notes.py L4-7, L218, L519-1045

Allow chart release-note paths in the version-mention guard and test the path rules.

  • tests/test_version_mentions.py L44-50, L264-266

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 Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #759   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           74        74           
  Lines         9448      9448           
=========================================
  Hits          9448      9448           
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.

The message of CalledProcessError differs on Python 3.15.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg marked this pull request as ready for review November 9, 2026 15:06

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

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

## Individual Comments

### Comment 1
<location path="scripts/release_notes.py" line_range="622" />
<code_context>
+    """
+    output = _gh(
+        "api",
+        "--paginate",
+        f"repos/{repository}/pulls/{number}/files?per_page=100",
+        "--jq",
</code_context>
<issue_to_address>
**Changed files disappear from release notes**

When a pull request exceeds GitHub's 3,000-file limit and a stream's files fall beyond the returned list, `pull_files` returns only the capped paths, so `in_stream` classifies the incomplete list and omits the pull request from that stream's release notes.

Obtain the complete changed-file list, or detect the cap and avoid classifying the partial list as complete.

Also at `scripts/release_notes.py:623`, `scripts/release_notes.py:627`.
</issue_to_address>

### Comment 2
<location path=".github/workflows/release-chart.yml" line_range="294" />
<code_context>
+              > "${releases}"
+          state="$(jq -r --arg tag "${TAG}" '[.[][] | select(.tag_name == $tag)]
+              | if length == 0 then "none"
+                elif any(.[]; .draft | not) then "published"
+                else "draft" end' "${releases}")"
+          if [[ "${state}" == "published" ]]; then
</code_context>
<issue_to_address>
**Draft releases remain ambiguous**

When a tag has both a published release and one or more drafts, or has multiple drafts, the state check treats any published release as the sole state and exits without handling drafts; when multiple drafts exist, it treats them as one draft and the tag-only edit is ambiguous, leaving duplicate releases or editing the wrong one.

Handle each matching release individually so drafts are resolved and any edit targets a specific release.
</issue_to_address>

### Comment 3
<location path="scripts/release_notes.py" line_range="564-569" />
<code_context>
+    final = match["pre"] is None
+    candidates = [
+        (_tag_key(other), other.string)
+        for other in (TAG.fullmatch(name.strip()) for name in tags)
+        if other
+        and other["prefix"] == match["prefix"]
+        and _tag_key(other) < key
+        and (not final or other["pre"] is None)
+    ]
+    return max(candidates)[1] if candidates else None
+
</code_context>
<issue_to_address>
**Failed tags truncate generated notes**

When a release tag fails before its GitHub release is published and a later version is used to correct it, `previous_tag` selects the failed tag based only on its prefix and version, so `generated_notes` asks GitHub to start the changelog there and omits pull requests merged since the last published release.

Choose the previous published release tag as the range baseline, rather than any lower matching tag.
</issue_to_address>

Linked issues

#758 ci: separate the release notes of package and chart · 6 of 7 met · 1 to check by hand

# Requirement Status Notes
1 Create chart GitHub releases with curated notes, chart-only generated changes since the previous chart tag, and the Full Changelog line. ✅ Met The new release job combines the chart notes with output from the shared generated-notes script.
2 Make chart releases prereleases before 1.0.0 and never latest. ✅ Met The release job sets prerelease from the version and passes --latest=false.
3 Make package releases compare against the previous v* tag and omit chart-only pull requests. ✅ Met release.yml uses the generated-notes command, which selects the same-stream previous tag and filters pull requests by changed files.
4 Use one tested script for both release streams, and shared steps from elixir-cloud-aai/.github where they fit. ✅ Met Both workflows call the tested script; the PR notes that the shared publish-release action is not yet available.
5 Add curated notes for the chart releases from 0.1.0 through 0.5.0. ✅ Met All five chart release notes are added and included in the documentation navigation and changelog.
6 Prepare retrospective chart releases and corrected package release notes for the maintainer. 👀 Check by hand (manual process) Confirm the separately prepared retrospective release material and corrected package notes were handed to the maintainer; those deliverables are not included in this diff.
7 Update the release documentation in docs/contributing/index.md and docs/helm-chart.md. ✅ Met Both documents describe the stream-specific release notes and chart release process.

Sourcery assessment

Needs a human reviewer. 3 findings to address first, and the workflows now use a write-enabled GitHub token to publish chart releases and change generated release notes. If the notes or release metadata are wrong, they remain publicly visible after a revert, but they can be corrected by editing the releases; the change does not alter the chart artifact or package data.

Blocking findings: scripts/release_notes.py:622, .github/workflows/release-chart.yml:294, scripts/release_notes.py:569


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

Comment thread scripts/release_notes.py Resolved
Comment thread .github/workflows/release-chart.yml Resolved
Comment thread scripts/release_notes.py Resolved
Sourcery's review findings:

- The previous tag skips tags without a published GitHub release (e.g.,
  of a failed release), if any candidate has one, so that their changes
  are listed in the next release.
- Pull requests with as many files as the API lists (3000) may be
  incomplete, so they are kept, with a warning, as are those whose files
  can't be listed. Old names of renamed files are on the same line.
- The chart release fails if its tag has several releases (e.g., drafts
  made by hand), as `gh release edit <tag>` can't say which one it edits.

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

@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.

Linked issues

#758 ci: separate the release notes of package and chart · 4 of 5 met

# Requirement Status Notes
1 Add a last job that creates the chart GitHub release with curated and chart-only generated notes, as a pre-release before 1.0.0 and never as latest. ✅ Met The new release job creates and publishes the chart release using the curated notes and generated notes, with the requested pre-release and latest settings.
2 Package releases compare against the previous v* tag and leave out pull requests that only changed the chart. ✅ Met scripts/release_notes.py generated selects the same-stream previous tag and filters pull requests by their changed files; release.yml uses it.
3 Use one tested script for both release streams and shared steps from elixir-cloud-aai/.github where they fit. ✅ Met Both workflows use the tested script. The PR notes that the shared publish-release action does not yet exist.
4 Prepare the GitHub releases of previously released chart tags and corrected package release notes since the chart's first release for the maintainer. 🟡 Partly met The diff adds retrospective curated chart notes, but does not include the retrospective GitHub release bodies or corrected package release notes; the PR says the maintainer gets these separately.
5 Update the release documentation in docs/contributing/index.md and docs/helm-chart.md. ✅ Met Both documents describe the separate release streams and their notes.

Comment thread .github/workflows/release.yml Resolved
@uniqueg
uniqueg merged commit f32c70d into dev Nov 9, 2026
83 checks passed
@uniqueg
uniqueg deleted the ci/758-chart-releases branch November 9, 2026 15:47
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: separate the release notes of package and chart

1 participant