Repository navigation
ci: separate package and chart release notes - #759
Conversation
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]>
Reviewer's GuideData structuresDefine the release-stream tag patterns, chart file scope, and generated-note parsing constants that the selection and filtering logic depends on.
APIAdd the
Uses of the APIUse the shared generated-notes command for package releases and grant the job permission to inspect pull-request files.
Validate chart notes before publishing, then create or finish a chart GitHub release using the chart-specific generated notes.
ImplementationSelect the previous same-stream tag and implement stream detection, pull-request file classification, GitHub note generation, and filtering.
ConfigurationAdd the chart release-note pages to the documentation navigation and clarify that both release streams have curated notes.
DocumentationDocument the separate chart changelog and list the retrospective foca-common releases.
Explain generated-note ranges and stream filtering in the release-note contribution guidance.
Document curated chart notes, release checks and approvals, generated chart-release contents, and retry behaviour.
Add the curated release notes for foca-common 0.1.0.
Add the curated release notes for foca-common 0.2.0.
Add the curated release notes for foca-common 0.3.0.
Add the curated release notes for foca-common 0.4.0.
Add the curated release notes for foca-common 0.5.0.
TestsTest stream tag selection, generated-note filtering, GitHub CLI interactions, and failure handling.
Allow chart release-note paths in the version-mention guard and test the path rules.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #759 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 74 74
Lines 9448 9448
=========================================
Hits 9448 9448
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The message of CalledProcessError differs on Python 3.15. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
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'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]>
There was a problem hiding this comment.
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. |
Summary
foca has two release streams in one repository. The package and images use
vX.Y.Ztags (release.yml), and the library chartfoca-commonuseschart-vX.Y.Ztags (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.pyhas a new command,generated <tag> --repo <owner/name>. Both workflows use it.generate-noteswithprevious_tag_nameset to the previous tag of the same stream (previous_tag). Without that, GitHub compares against the latest release of either stream.gh api pulls/<n>/files, renames included. Sections left empty are dropped, and the**Full Changelog**line stays last.Scope (
CHART_PATHS): these files belong to the chart:charts/foca-common/, with its tests, andtests/test_chart*.pydocs/helm-chart.mdanddocs/releases/chart/examples/*/chart/release-chart.ymland the formercharts.ymltest-chartandinstall-chart, and.github/kind/Everything else belongs to the package, including the migration guides, the deployment docs,
mkdocs.yml,docs/changelog.mdandci.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): usesgenerated, and the job getspull-requests: read.release-chart.yml:testchecks the curated notesdocs/releases/chart/X.Y.Z.mdbefore anything is published: they must exist, contain noTODO, and follow the agreed format.release("Publish chart release"), runs in the environmentreleaselikepublish, so it needs its own approval. Only this job hascontents: writeandpull-requests: read.--verify-tagand then publishes it.--latest=false, and--prereleasebefore 1.0.0.## Commitswith the generated notes since the previouschart-v*tag, then GitHub's Full Changelog line.Chart changelog: curated notes for foca-common 0.1.0 to 0.5.0 are in
docs/releases/chart/, listed in the docs' changelog andnav. The version-mention guard allows them by path.Docs: "Release notes" in
docs/contributing/index.md, "Releases" indocs/helm-chart.md, anddocs/changelog.md.This PR publishes nothing. I used the same script to prepare the retrospective releases of
chart-v0.1.0tochart-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-releaseof 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 onlyfoca/.pytest: 901 passed, buttests/factories/test_celery_worker_fork.pyfails locally because it needs a MongoDB onlocalhost: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.python scripts/release_notes.py generated <tag> --repo elixir-cloud-aai/focafor 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 previousv*tag for package releases.chart-v0.1.0has no previous chart tag, and GitHub picksv0.15.0...chart-v0.1.0.tests/test_release_notes.pyandtests/test_version_mentions.pypass locally, and the real-API run gives the same notes for all twelve tags.Lane
Full lane, because this changes release workflows. Two rounds with the
adversarial-reviewerandquality-reviewersubagents; all findings were fixed except those below.Declined review findings
in_streamvalidates the stream although the CLI only passes known streams. I kept it, because it is a public helper.release-chart.ymlhas its own draft/published state check instead ofrelease.yml'srelease_assets.py state. Chart releases have no assets, so the simpler check fits; the step's comment points torelease.yml.generated_notescould be split into smaller helpers. It is short and fully tested through a fakegh, 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:
Bug Fixes:
Enhancements:
CI:
Documentation: