Fix release date extraction for the current changelog header format - #9767
Conversation
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? |
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>
c53aa71 to
b69384e
Compare
|
@hsbt After implementing it, I'd rather go with the fix in this PR. Stamping at cut time needs an extra commit+push after every release, which feels too big for this. What do you think? |
The fixture changelog still used the old `## VERSION (DATE)` header, so the fixed `release_date_for` no longer matched it and the released case of the version spec failed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fixes the Style/RegexpLiteral offense from CI. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Agreed, this PR is fine as the minimal fix. I pushed a small follow-up commit updating the spec fixture to the new header format, since the spec relied on the old one. |
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