Repository navigation
Fix the gem plain-entry remedy for uncovered platforms (#2284) - #2300
Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
Conversation
Refs #2284. Empty commit that opens the draft pull request; the fix follows. Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aeScTQvGaMvmNNeLBiM
Four unit tests for #2284 that fail on main. A gem locked as a plain entry beside platform gems is refused with a remedy that names only `bundle lock --remove-platform ruby`. Bundler keeps the plain entry for every locked platform that none of the gem's builds serves, so the tests expect the remedy to name those platforms, to leave out a ruby platform the lock does not hold, and to print no platform that is not a plain gem token. Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aeScTQvGaMvmNNeLBiM
Vendored mode refuses a gem the lock holds as a plain entry beside platform gems, and told the user to run `bundle lock --remove-platform ruby`. Bundler keeps the plain entry for every locked platform that none of the gem's platform builds serves, not only for ruby. On the lock Bundler 4 writes for a default Rails 8 app that command leaves thruster and nokogiri as they were, and running it again fails. The refusal now reads the lock's PLATFORMS and names each platform that keeps the entry, with one command that removes them. It names ruby only when the lock holds it, and no platform when the lock shows none. Which build serves which platform is a port of RubyGems' Gem::Platform#=== for Linux, macOS, Windows and Java, checked against a table that RubyGems 3.5.22 produced. A platform the port cannot read, or one that is not a plain gem token, is never printed. Fixes #2284 Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aeScTQvGaMvmNNeLBiM
Findings of the code review of this branch, each with a test: - A PLATFORMS line the lock repeats was printed twice, and Bundler refuses `--remove-platform ruby ruby`. Each platform is named once. - A locked platform the port cannot read (FreeBSD) may keep the plain entry too. The remedy no longer reads as complete then: it adds that another locked platform may keep the entry. - A PLATFORMS line that starts with a dash is not printed into the command. - One platform other than ruby is worded as one. - Names RubyGems reads as AIX, Cygwin or FreeBSD are not taken for Linux or macOS, and i386 to i686 are found anywhere in the CPU. Refs #2284 Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aeScTQvGaMvmNNeLBiM
|
bugbot run Generated by Claude Code |
PR SummaryLow Risk Overview The error text now parses the lock’s Reviewed by Cursor Bugbot for commit 43dd5a0. Configure here. |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 43dd5a0. Configure here.
|
[agent] PR shepherd: review brief for the approver. What it does. When vendored mode refuses a gem that Risk: low. Only an error message changes, on a path that refuses before anything is written. The new RubyGems platform matcher is used only to build that text, and it is checked against RubyGems 3.5.22's answers for 441 platform pairs. Look here
Verified. Read the whole diff. Changes I made. None. Open questions. One wording nit, not a blocker: the first sentence of the refusal still says Generated by Claude Code |
LLM Description written by Claude Code:claude-fable-5-2
Fixes #2284
Summary
Vendored mode refuses a gem that
Gemfile.lockholds as a plainname (version)entry beside its platform gems (platform_gem_unsupported). The refusal told the user to runbundle lock --remove-platform ruby. On the lock Bundler 4 writes for a default Rails 8 app that command does not clear thruster or nokogiri, and running it a second time fails.The refusal now reads the lock's
PLATFORMSand names each platform that keeps the plain entry, with one command that removes them. Only the message changes: what is refused, the error code and the exit code are the same, and nothing new is written.rubyis the only platform no build serves--remove-platform rubyPLATFORMShasarm-linux-gnu,arm-linux-musl,ruby--remove-platform ruby(entry stays)--remove-platform arm-linux-gnu arm-linux-musl rubyruby(Bundler 4's default)--remove-platform ruby(command fails)--remove-platform arm-linux-gnu arm-linux-muslPLATFORMS, or every locked platform is served--remove-platform ruby--remove-platform <platform>Root cause
platform_lock_refusalincrates/socket-patch-core/src/vendor/gem.rsprinted fixed text keyed on "the lock has a plain entry" and never readPLATFORMS. Bundler keeps the plain entry forrubyand for every other locked platform that none of the gem's platform builds serves. thruster 0.1.28 ships no 32-bit ARM build, soarm-linux-gnuandarm-linux-muslkeep its plain entry whether or notrubyis locked.The change
formats/gem/platform.rs(new): a port of RubyGems'Gem::Platform#===(which locked platform a platform gem serves) for Linux, macOS, Windows and Java names. It is used for wording only. A platform it cannot read is never named.formats/gem/mod.rs:locked_platforms, the lines of the lock'sPLATFORMSsection (LF or CRLF).vendor/gem.rs:plain_entry_remedybuilds the last sentence of the refusal from those two.CLI_CONTRACT.mdanddocs/ecosystems.mddescribe the new wording.The wrappers under
npm/,pypi/andgem/need no change.Safety:
PLATFORMSis a committed file section and the remedy is a command the user copies. Only a platform in the plain gem-token charset that does not start with a dash is printed (the_plain_entry_remedy_prints_no_unsafe_platform).Evidence
Red to green: the first commit after the empty one (ea78701) adds four tests that fail on
main; 11fa872 makes them pass.Tests that cover #2284, all in
vendor::gem::tests::platform_gems:the_plain_entry_remedy_names_every_platform_no_build_serves(LF and CRLF): the issue's lock; thruster's remedy lists the two ARM platforms andruby, nokogiri keeps the one-platform remedy.the_plain_entry_remedy_never_names_a_ruby_platform_the_lock_lacks: the lock after the old remedy was followed.the_plain_entry_remedy_names_no_platform_it_cannot_find,..._names_a_repeated_platform_once,..._words_one_platform_as_one,..._says_when_it_could_not_read_a_platform,..._prints_no_unsafe_platform.The platform match is checked against RubyGems itself:
formats::gem::platform::tests::serves_agrees_with_rubygems_on_every_pairholds the answers RubyGems 3.5.22 gave for all 441 pairs of 21 platform names.Real Bundler 4.0.18 on the issue's project (nokogiri 1.19.7, thruster 0.1.28): both commands the new message prints clear the plain entries.
Not run locally: the Bundler end-to-end suites. No end-to-end test asserts on this text, and the refusal is raised before any file is written or the patch service is asked.
cargo clippy -p socket-patch-core --all-targetsreports 71 errors in test code onmainas well; none is in a line this PR adds. CI's clippy job does not lint test targets.Code review
/code-review highran on the diff. All six findings are fixed in the last commit, each with a test: a repeatedPLATFORMSline, a platform the port cannot read (the remedy now says another platform may keep the entry), a leading dash, the wording for one platform, and two parser differences from RubyGems.Not in this PR
--mode hosted. The same refusal is raised when a hosted gem is taken over into vendored mode, where that advice would be wrong.ci-okis red onhosted-e2euntil CI: hosted-e2e gem leg fails on every PR: production published activestorage 6.0.3 patch 146ef6aa, not in GEM_UUIDS #2270 is fixed onmain(a production patch that is not in the pinned set). That failure is not from this change.https://claude.ai/code/session_011f9aeScTQvGaMvmNNeLBiM
Generated by Claude Code