Fix release date extraction for the current changelog header format - #9767
Fix release date extraction for the current changelog header format#9767meganemura wants to merge 1 commit into
Conversation
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>
fd21bb5 to
c53aa71
Compare
|
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? |
What was the end-user or developer problem that led to this PR?
bundle versionshould 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 expectedthe header format
## VERSION (DATE). But the changelog has used## VERSION / DATEsince 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