Conversation
There was a problem hiding this comment.
Pull request overview
Updates Bundler’s bundle outdated output to include a “Release Date” column (and corresponding --verbose/manpage examples), plus a small test robustness tweak for Rust newgem generation.
Changes:
- Add “Release Date” to
bundle outdatedtable output and (potentially) to parseable output. - Update
bundle outdatedspecs and manpages to reflect the new column. - Increase
cargo testtimeout innewgemspecs to reduce flakes.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| bundler/lib/bundler/cli/outdated.rb | Adds release date extraction and prints it in outdated output/table. |
| bundler/spec/commands/outdated_spec.rb | Updates expected headers for the new “Release Date” column. |
| bundler/spec/commands/platform_spec.rb | Updates outdated-related expectations to include the new header column. |
| bundler/lib/bundler/man/bundle-outdated.1.ronn | Updates documentation examples to include “Release Date” and sample dates. |
| bundler/lib/bundler/man/bundle-outdated.1 | Updates generated manpage to match the .ronn changes. |
| bundler/spec/commands/newgem_spec.rb | Adds a longer timeout for cargo test in the Rust extension skeleton spec. |
Comments suppressed due to low confidence (2)
bundler/lib/bundler/cli/outdated.rb:216
- This change alters the
--parseable/--porcelainoutput format by potentially appending a “released …” segment. That output is explicitly intended for machine parsing, so any additional fields should be gated behind an explicit option (or a new dedicated format version) to avoid breaking existing tooling.
spec_outdated_info = "#{active_spec.name} (newest #{spec_version}, " \
"installed #{current_version}#{dependency_version}"
release_date = release_date_for(active_spec)
spec_outdated_info += ", released #{release_date}" unless release_date.empty?
spec_outdated_info += ")"
output_message = if options[:parseable]
spec_outdated_info.to_s
elsif options_include_groups || groups.empty?
" * #{spec_outdated_info}"
else
" * #{spec_outdated_info} in #{groups_text("group", groups)}"
end
Bundler.ui.info output_message.rstrip
bundler/spec/commands/outdated_spec.rb:37
- Specs were updated to expect a new “Release Date” column, but there’s no spec asserting that any actual release date value is printed (all rows remain blank). Add at least one example where a gem has a known packaged date and assert it appears in the new column (and, if supported, in
--parseableoutput).
expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip
Gem Current Latest Requested Groups Release Date
activesupport 2.3.5 3.0 = 2.3.5 default
foo 1.0 xxxxxxx 1.0 xxxxxxx >= 0 default
weakling 0.0.3 0.2 ~> 0.0.1 default
zebra 1.0 xxxxxxx 1.0 xxxxxxx >= 0 default
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * Gem Current Latest Requested Groups Release Date | ||
| * faker 1.6.5 1.6.6 ~> 1.4 development, test 2024-02-05 | ||
| * hashie 1.2.0 3.4.6 = 1.2.0 default 2023-11-10 | ||
| * headless 2.2.3 2.3.1 = 2.2.3 test 2022-08-19 |
There was a problem hiding this comment.
The manpage examples now show concrete release dates in the table output. With the current implementation, release dates are frequently unavailable (and the column will be blank) unless the code explicitly fetches/derives the remote gemspec’s packaged date. Either update the implementation to reliably populate these values or adjust the documentation/examples to reflect when the column can be populated.
| end | ||
| end | ||
|
|
||
|
|
There was a problem hiding this comment.
Nit: this adds an extra blank line between example groups, which doesn’t seem intentional and slightly reduces readability in an already-long spec file. Consider removing the redundant empty line.
| def release_date_for(spec) | ||
| return "" unless spec.respond_to?(:date) | ||
|
|
||
| date = spec.date | ||
| return "" unless date | ||
|
|
||
| date = date.utc if date.respond_to?(:utc) | ||
| default_date = Time.at(Gem::DEFAULT_SOURCE_DATE_EPOCH).utc | ||
| default_date = Time.utc(default_date.year, default_date.month, default_date.day) | ||
| return "" if date == default_date | ||
|
|
||
| date.strftime("%Y-%m-%d") | ||
| end |
There was a problem hiding this comment.
release_date_for won't actually surface release dates for the common Rubygems resolution path. When specs come from the dependency API / compact index they are typically Bundler::EndpointSpecification instances; #date on those will be the default SOURCE_DATE_EPOCH-derived value (or nil) and this method returns an empty string, so the new column will usually be blank. To make this feature work, fetch the real remote gemspec date (e.g., via EndpointSpecification's remote spec fetcher) or otherwise obtain the published date from the source, instead of relying on the local #date accessor.
| date = spec.date | ||
| return "" unless date | ||
|
|
||
| date = date.utc if date.respond_to?(:utc) | ||
| default_date = Time.at(Gem::DEFAULT_SOURCE_DATE_EPOCH).utc |
There was a problem hiding this comment.
The default-date suppression compares against Gem::DEFAULT_SOURCE_DATE_EPOCH, but Gem::Specification#date defaults to Gem.source_date_epoch (which may differ when SOURCE_DATE_EPOCH is set). In those environments, gems with no real packaged date can end up showing an arbitrary build-epoch date as the “Release Date”. Consider avoiding calling spec.date when the date wasn’t explicitly set (e.g., check the underlying ivar), or compare against Gem.source_date_epoch using the same normalization RubyGems uses.
| date = spec.date | |
| return "" unless date | |
| date = date.utc if date.respond_to?(:utc) | |
| default_date = Time.at(Gem::DEFAULT_SOURCE_DATE_EPOCH).utc | |
| # Avoid triggering RubyGems' implicit default date based on SOURCE_DATE_EPOCH. | |
| unless spec.instance_variable_defined?(:@date) | |
| return "" | |
| end | |
| date = spec.instance_variable_get(:@date) | |
| return "" unless date | |
| date = date.utc if date.respond_to?(:utc) | |
| # Suppress the default build epoch date used by RubyGems when no date is set. | |
| default_date = Gem.source_date_epoch | |
| default_date = default_date.utc if default_date.respond_to?(:utc) |
a4c2bc7 to
6be11d6
Compare
6be11d6 to
346a891
Compare
346a891 to
300cc0c
Compare
What was the end-user or developer problem that led to this PR?
Fixed #9329
Make sure the following tasks are checked