Skip to content

fix(changelog): point version links at the per-crate tags that exist - #216

Merged
WomB0ComB0 merged 2 commits into
masterfrom
fix/changelog-version-links
Sep 21, 2026
Merged

WomB0ComB0 merged 2 commits into
masterfrom
fix/changelog-version-links

Conversation

@WomB0ComB0

@WomB0ComB0 WomB0ComB0 commented Sep 21, 2026

Copy link
Copy Markdown
Member

The defect

Every version link in every generated changelog 404s.

cliff.toml rendered the heading as /releases/tag/{{ version }}, which emits
https://github.com/resq-software/crates/releases/tag/0.4.2. There is no bare
0.4.2 tag and there never has been — all 191 tags in this repo are
per-crate prefixed (resq-cli-v0.4.2, resq-tui-v0.1.13, …):

$ git tag | grep -cvE '^[a-z0-9-]+-v[0-9].*'
0
$ gh api repos/resq-software/crates/git/refs/tags/0.4.2 -i | head -1
HTTP/2.0 404 Not Found

That scheme is not incidental: release-plz tags multi-package workspaces with
its default git_tag_name template, {{ package }}-v{{ version }}, and
release-plz.toml does not override it.

The fix

-    ## [{{ version | trim_start_matches(pat="v") }}](…/releases/tag/{{ version }}) - …
+    ## [{{ version }}](…/releases/tag/{{ package }}-v{{ version }}) - …

package is not a guess. release-plz injects it into the git-cliff template
context unconditionally, in the one place it ever constructs a changelog
(release_plz_core::changelog::Changelog::get_changelog
add_package_contextadd_context("package", package)), and that value is
package.name — the cargo package name. It is also documented in release-plz's
changelog-context reference ("package": "my_crate"). Both checked against the
release-plz version this repo actually pins (release-plz-action v0.5.138 →
release-plz 0.3.168), not against latest.

The no-op trim_start_matches(pat="v") goes at the same time. release-plz
passes version as a bare semver (next_version.to_string() on a
semver::Version), so the filter never matched; keeping it would have left the
two halves of the line disagreeing about whether version carries a v.

tag_pattern

tag_pattern = "v[0-9].*" did not describe the scheme either. It is also
inert: release-plz builds the Release itself and calls git-cliff's
changelog API directly, and tag_pattern is never read on that path — in
git-cliff-core it appears only as a config struct field, never in
changelog.rs. Only the git-cliff CLI's repo scan
(repo.tags(&config.git.tag_pattern, …)) consumes it.

Corrected rather than removed, with a comment recording that it has no effect
on what this repo ships. Removing it would have been defensible too, but the
old value was only accidentally right — git-cliff matches tag_pattern
unanchored, so v[0-9].* happened to match resq-cli-v0.4.2 via the embedded
v0. An anchored pattern that actually describes <crate>-v<semver> cannot
silently select the wrong subset if that ever starts being read.

Proof

Rendered through release-plz's exact code path — git-cliff-core pinned to
=2.14.1 (the version in release-plz v0.3.168's lockfile), default-features = false as release-plz sets it, Config::load("cliff.toml"), release-plz's
default PR-link commit_preprocessor injected the way release-plz injects it
when the user config leaves commit_preprocessors empty, then
Changelog::new(...) + add_context("package", "resq-cli").

Before — the harness reproduces the committed changelog byte for byte,
confirming it is faithful:

## [0.4.2](https://github.com/resq-software/crates/releases/tag/0.4.2) - 2026-09-07

which is character-identical to the heading in crates/resq-cli/CHANGELOG.md.

After:

## [0.4.2](https://github.com/resq-software/crates/releases/tag/resq-cli-v0.4.2) - 2026-09-07
## [0.1.13](https://github.com/resq-software/crates/releases/tag/resq-tui-v0.1.13) - 2026-09-07

The rendered URL resolves — tag extracted from the generated link, not typed
by hand:

$ gh api repos/resq-software/crates/git/refs/tags/resq-cli-v0.4.2 -i | head -1
HTTP/2.0 200 OK
$ gh api repos/resq-software/crates/releases/tags/resq-cli-v0.4.2 --jq .html_url
https://github.com/resq-software/crates/releases/tag/resq-cli-v0.4.2
$ gh api repos/resq-software/crates/git/refs/tags/resq-tui-v0.1.13 -i | head -1
HTTP/2.0 200 OK

The GitHub Release's own html_url is identical to what the template now
renders.

Scope

Template only. The existing CHANGELOG.md files are deliberately untouched —
release-plz rewrites each heading as it cuts the next release for that crate,
and regenerating 18 crates' history here would bury this one-line fix.

Not fixed here, worth separate issues

  1. Root CHANGELOG.md is a hand-written stub claiming ## [0.2.0] - 2026-03-14
    with a single bullet about CI workflows, while [workspace.package] in
    Cargo.toml is at 0.1.22. Nothing generates or maintains it.
  2. crates/resq-cli/CHANGELOG.md is structurally corrupt — three stacked
    # Changelog headers (lines 1, 21, 126), and [0.4.1] appears twice at two
    different dates (2026-08-31 and 2026-08-24).
  3. The template's PR-link branch is dead. Line 38 tests
    commit.github.pr_number, but release-plz builds git-cliff-core with
    default-features = false, so the github feature is off and commit.github
    is never populated. PR links reach the changelog only through release-plz's
    default commit_preprocessor, which rewrites a trailing (#123) into a
    markdown link — visible in the render above. Harmless (Tera treats the
    missing path as falsy in {% if %}), but misleading to anyone editing the
    template. The equivalent under release-plz is commit.remote.pr_number.

Summary by CodeRabbit

  • Chores
    • Updated changelog links to use full version identifiers.
    • Adjusted release tag formatting to include the package name and semantic version.

Every version heading in every generated CHANGELOG.md linked to
/releases/tag/<bare semver> — e.g. /releases/tag/0.4.2. No such tag
exists, and none ever has: all 191 tags in this repo are per-crate
prefixed (resq-cli-v0.4.2, resq-tui-v0.1.13, ...), because release-plz
tags multi-package workspaces with its default git_tag_name template,
`{{ package }}-v{{ version }}`, and this repo does not override it. So
every link in every per-crate changelog was dead.

release-plz always injects `package` (the cargo package name) into the
git-cliff template context — unconditionally, via add_package_context in
its single changelog construction path — so the heading can reproduce
the real tag as `{{ package }}-v{{ version }}`. Verified against
release-plz's documented changelog context and against the pinned
release-plz 0.3.168 source, not assumed.

Dropped the no-op `trim_start_matches(pat="v")` on the display text at
the same time: release-plz passes `version` as a bare semver, so the
filter never matched anything, and leaving it would have had the two
halves of the line disagree about whether `version` carries a `v`.

`tag_pattern` is inert here — release-plz builds the release itself and
calls git-cliff's changelog API, which never reads it; only the
git-cliff CLI's repo scan does. Corrected rather than removed so it
describes the tag scheme in use, with a comment recording that it has no
effect on what this repo ships.

The existing CHANGELOG.md files are left alone; release-plz rewrites
each heading as it cuts the next release for that crate.
@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 3d29b15f-7382-465f-9942-5b4ce1e4ecd9

📥 Commits

Reviewing files that changed from the base of the PR and between 880038c and 283c0e1.

📒 Files selected for processing (1)
  • cliff.toml

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The changelog configuration now links release headings to full crate-prefixed version tags. Its tag pattern matches lowercase alphanumeric or hyphenated package names followed by -v and a version.

Changes

Changelog tag alignment

Layer / File(s) Summary
Release tag configuration
cliff.toml
Release links now use the <package>-v<version> format. The tag pattern matches crate-prefixed semantic-version tags.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: updating changelog links to use existing per-crate release tags.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size/XS C-Bug Something isn't working labels Sep 21, 2026
@WomB0ComB0
WomB0ComB0 merged commit 361454d into master Sep 21, 2026
26 checks passed
@WomB0ComB0
WomB0ComB0 deleted the fix/changelog-version-links branch September 21, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Bug Something isn't working size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant