Skip to content

Fix release date extraction for the current changelog header format - #9767

Open
meganemura wants to merge 1 commit into
ruby:masterfrom
meganemura:fix-bundler-build-metadata-release-date
Open

Fix release date extraction for the current changelog header format#9767
meganemura wants to merge 1 commit into
ruby:masterfrom
meganemura:fix-bundler-build-metadata-release-date

Conversation

@meganemura

Copy link
Copy Markdown

What was the end-user or developer problem that led to this PR?

bundle version should show the date when that Bundler version was released.
But it always shows today's date instead. This happens for every Bundler
version released after 4.0.9.

What is your fix for the problem, implemented in this PR?

The release date comes from CHANGELOG-bundler.md. The old code expected
the header format ## VERSION (DATE). But the changelog has used
## VERSION / DATE since version 4.0.9. So the old regex never matched,
and the release date was always empty. As a fallback, Bundler used today's
date instead.

This PR fixes the regex to match the current header format. It also adds
a test for this case.

Make sure the following tasks are checked

  • Describe the problem / feature
  • Write tests for features and bug fixes
  • Write code to solve the problem
  • Make sure you follow the current code style and write meaningful commit messages without tags

release_date_for in spec/support/build_metadata.rb matched the
changelog's old `## VERSION (DATE)` header, but .changelog.yml has
generated `## VERSION / DATE` headers since Bundler 4.0.9. The regex
silently failed to match, so built_at was baked as nil into every
release since, and Bundler::BuildMetadata.timestamp fell back to
Time.now.utc on every invocation — `bundle version` always showed
today's date instead of the real release date.

spec/support/build_metadata.rb is release tooling for the
bundler:build_metadata rake task, not part of the RSpec bundler suite;
spec_helper.rb never requires it. The sibling release script
tool/changelog.rb already has its test in test/test_changelog_generator.rb,
so the regression test for this lives in test/test_build_metadata_generator.rb
to match.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@meganemura
meganemura force-pushed the fix-bundler-build-metadata-release-date branch from fd21bb5 to c53aa71 Compare August 5, 2026 12:51
@hsbt

hsbt commented Aug 6, 2026

Copy link
Copy Markdown
Member

Thanks for catching this. Rather than matching the date back out of the changelog, I think the release time should be stamped into both the changelog and the build metadata when the release is cut.

@meganemura

Copy link
Copy Markdown
Author

Thanks for catching this. Rather than matching the date back out of the changelog, I think the release time should be stamped into both the changelog and the build metadata when the release is cut.

@hsbt I implemented this: meganemura@0a86b33 (branch: bundler-release-date-stamp on my fork)

Stamping built_at when the release is cut (at prepare_release time) means it's committed as part of the release PR. I made it reset back to nil and commit+push after release.

That means every release now needs an extra commit+push. Does that seem OK, or is it too much for what this is fixing?

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