Skip to content

Collect scriv changelog fragments at release and backfill CHANGELOG.md - #81

Open
blarghmatey wants to merge 5 commits into
mainfrom
scriv-changelog
Open

blarghmatey wants to merge 5 commits into
mainfrom
scriv-changelog

Conversation

@blarghmatey

@blarghmatey blarghmatey commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

What are the relevant tickets?

N/A

Description (What does it do?)

This repo has no changelog, and the release job's commit is only a version bump. This adds scriv fragments that are collected into CHANGELOG.md when a release is cut.

  • uv run scriv create writes a fragment under changelog.d/ (Keep a Changelog categories). The README has a short section on it.
  • The release image job runs bump-my-version bump --no-commit in the ol-concourse-dsl image (uv since Add a digest-pinned uv to the ol-concourse-dsl image ol-concourse#111, no scriv), then the release resource commits with git add -u. A bump-my-version pre_commit_hooks entry runs bin/collect-changelog through uv run --frozen --only-group release. bump-my-version runs pre-commit hooks under --no-commit too, after pyproject.toml has the new version, which is where scriv reads it from.
  • bin/collect-changelog wraps scriv collect so an empty changelog.d/ is a no-op. scriv collect exits 2 with no fragments, which would fail a Renovate-only release.
  • scriv is in its own release dependency group (included in dev) so the release task installs only scriv from the lockfile.
  • CHANGELOG.md is backfilled for 2026.7.22.1 through 2026.9.30.1 from the commits and PRs between tags. It has to be tracked before the first release because git add -u doesn't stage new files.

How can this be tested?

I reproduced the release task in the mitodl/ol-concourse-dsl:latest image the job uses, as published after ol-concourse#111 (bump-my-version 1.5.1, uv 0.12.15, no scriv): committed the tree, ran bump-my-version bump --new-version 2026.10.1.1 --no-commit --allow-dirty, then git add -u.

  • With the fragment in this PR, the staged changes were CHANGELOG.md (new 2026.10.1.1 entry), the deleted fragment, pyproject.toml, and uv.lock.
  • With changelog.d/ empty, the bump succeeded and only pyproject.toml and uv.lock changed.

It hasn't run in Concourse. The next release cut is the real test.

Additional Context

  • Hotfixes will get the wrong changelog entry. bump_version_task runs on main HEAD, and _create_hotfix stashes that tree and pops it onto production plus the cherry-picked commit. So the hotfix entry lists every unreleased fragment on main, and because the fragment deletions don't apply on the hotfix branch, those fragments stay on main and are listed again in the next normal release. Hotfixes are rare enough that I'd rather hand-edit the entry than fix this in the release resource now.
  • A fragment merged between the job's get of main and the cut is attributed to the next release. The version bump already has this race.
  • Nothing enforces a fragment per PR yet. If we want that, a CI check with a skip label for Renovate would be the follow-up.
  • Please sanity-check the categorization in the backfill; it's my read of each PR.

blarghmatey added a commit to mitodl/ol-concourse that referenced this pull request Sep 30, 2026
The bump-my-version pre_commit_hooks added in
mitodl/ol-analytics-api#81 run in this image
during bump_version_task and call `uv run --frozen --only-group release`.
The image has no uv, so the hook first runs `python3 -m pip install uv`,
which pulls an unpinned uv at release time, outside the lockfile hashes
and the repo's exclude-newer window. Copying a digest-pinned uv into the
image lets that hook step be dropped, and Renovate's dockerfile manager
keeps the tag and digest current.

Claude-Session: https://claude.ai/code/session_01VaJ4VtbQFPV63VWtQV6JEg
Releases are cut by the ol-concourse release job, which runs
`bump-my-version bump --no-commit` and then commits with `git add -u`.
This adds a bump-my-version pre-commit hook that installs uv and runs
bin/collect-changelog, which folds changelog.d/ fragments into
CHANGELOG.md under the new version. A release with no fragments is a
no-op rather than an error, because `scriv collect` exits 2 in that case
and would otherwise fail Renovate-only releases.

Claude-Session: https://claude.ai/code/session_01VaJ4VtbQFPV63VWtQV6JEg
Reconstructed from the commits and PRs between each CalVer tag,
2026.7.22.1 through 2026.9.30.1. The file has to be tracked before the
first scriv release because the release resource stages with `git add -u`.

Claude-Session: https://claude.ai/code/session_01VaJ4VtbQFPV63VWtQV6JEg
mitodl/ol-concourse-dsl ships uv since
mitodl/ol-concourse#111, so the hook no longer
needs to install an unpinned uv from PyPI at release time.

Claude-Session: https://claude.ai/code/session_01VaJ4VtbQFPV63VWtQV6JEg

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

The release-critical collection branches need automated coverage, alongside the smaller configuration and wording corrections.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds Scriv-based changelog fragments and release-time collection, with historical releases backfilled.

Changes:

  • Configures Scriv and release dependencies.
  • Adds a release hook that safely handles empty fragment directories.
  • Documents the workflow and backfills release history.
File Description
README.md Documents changelog fragments.
CHANGELOG.md Backfills historical releases.
bin/​collect-changelog Collects fragments during releases.
changelog.d/​.gitkeep Preserves the fragment directory.
changelog.d/​20260930_101301_blarghmatey_scriv_changelog.md Describes this feature.
pyproject.toml Configures Scriv and the release hook.
uv.lock Locks Scriv and dependencies.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pyproject.toml Outdated
Comment thread changelog.d/20260930_101301_blarghmatey_scriv_changelog.md Outdated
`output_file` is a deprecated alias for `changelog` in scriv 1.8.0. The
fragment claimed every PR adds one, which nothing enforces.

Claude-Session: https://claude.ai/code/session_01VaJ4VtbQFPV63VWtQV6JEg
The release hook fails the release if this script fails, so run it
against the repo's real scriv config with and without fragments.

Claude-Session: https://claude.ai/code/session_01VaJ4VtbQFPV63VWtQV6JEg
@blarghmatey

Copy link
Copy Markdown
Member Author

Added tests/test_collect_changelog.py in 3254426 for the review's coverage note. It runs bin/collect-changelog against the repo's real scriv config with and without fragments.

This branch has not been deployed

No deployments
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.

2 participants