Skip to content

Detect locally-sourced gems in bundle_report outdated#188

Closed
JuanVqz wants to merge 2 commits into
mainfrom
feature/local-gem-source-detection
Closed

Detect locally-sourced gems in bundle_report outdated#188
JuanVqz wants to merge 2 commits into
mainfrom
feature/local-gem-source-detection

Conversation

@JuanVqz

@JuanVqz JuanVqz commented Jun 9, 2026

Copy link
Copy Markdown
Member

Description

bundle_report outdated looked up each installed gem's latest version on rubygems by name only. A gem pulled in via path: (for example a private engine) that happens to share its name with an unrelated public gem was matched against the public one and reported as out-of-date with a bogus upgrade suggestion.

This adds NextRails::GemInfo#sourced_locally?, which reads the Bundler source type from the lockfile. A gem is considered local when its source is a Bundler::Source::Path that is not a Bundler::Source::Git (git sources subclass the path source and are already reported separately via sourced_from_git?).

BundleReport.outdated now:

  • excludes locally-sourced gems from the out-of-date check, and
  • reports them in a separate count, mirroring how git-sourced gems are handled (new sourced_locally_count in the JSON output and a new "N gems are sourced from a local path" line in the human-readable footer).

Motivation and Context

Closes #29.

A local private gem named app_store collides with the abandoned public app_store gem. bundle_report would suggest "upgrading" the private engine to the unrelated public version.

As discussed in the issue, this does not try to decide whether two same-named gems are the same gem (gemspec metadata is unreliable). It trusts the lockfile source instead: a path: gem is local, so it is not compared against rubygems at all.

How Has This Been Tested?

  • Added specs for GemInfo#sourced_locally? covering path, git, and rubygems sources.
  • Added a BundleReport.outdated spec asserting a locally-sourced gem is excluded from the out-of-date list and counted separately, plus updated the existing JSON/stdout expectations.
  • Full suite green (99 examples, 0 failures).
  • Verified end-to-end with a sandbox app that declares a local app_store gem via path::
    • released next_rails (buggy): app_store listed: true
    • this branch: app_store listed: false, footer shows it under "sourced from a local path".

Screenshots:

N/A

I will abide by the code of conduct

@JuanVqz JuanVqz self-assigned this Jun 9, 2026
@JuanVqz JuanVqz force-pushed the feature/local-gem-source-detection branch 2 times, most recently from 141e690 to 9b98328 Compare June 9, 2026 18:30
JuanVqz added 2 commits June 9, 2026 12:33
A gem pulled in via `path:` (e.g. a private engine) could share its name
with an unrelated public gem on rubygems. `bundle_report outdated` looked
up the latest version by name, matched the public gem, and reported a
bogus upgrade.

Add `GemInfo#sourced_locally?`, which reads the Bundler source type from
the lockfile (path source, excluding git which is already reported
separately). `outdated` now excludes locally-sourced gems from the
out-of-date check and reports them in a separate count, mirroring how
git-sourced gems are handled.

Closes #29
@JuanVqz JuanVqz force-pushed the feature/local-gem-source-detection branch from 7f219e2 to 56bfbd9 Compare June 9, 2026 18:33
@JuanVqz

JuanVqz commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

I used this issue-29-sandbox.zip to QA it, there is a README if you need instructions.

@JuanVqz JuanVqz closed this Jun 9, 2026
@JuanVqz JuanVqz deleted the feature/local-gem-source-detection branch June 9, 2026 18:34
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.

bundle_report may confuse local private gem with remote public gem

1 participant