Skip to content

Fix the build label of a hosted gem rollback (#2152) - #2172

Merged
Mikola Lysenko (mikolalysenko) merged 4 commits into
mainfrom
agent/fix-gem-refresh-build-label
Nov 20, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 4 commits into
mainfrom
agent/fix-gem-refresh-build-label

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-fable-5-2

Fixes #2152

Summary

When hosted mode puts the upstream build of a native gem back into the
project's gem home (rollback, remove, any unwind), the progress line
said the patch was being rebuilt:

Rebuilding the native extension of puma-6.4.3 from its patched gem; this can take several minutes.

It now names the gem that is built: "from its upstream gem" on an unwind,
"from its patched gem" on scan, as before. Only the text changes; the
run already installed the right gem.

Root cause

The refresh compiles a native gem's archive in a stage home
(install_staged in crates/socket-patch-core/src/patch/gem_ext.rs). That
function passed the fixed label "its patched gem" to the progress line,
but the refresh calls it in both directions. The refresh already carries
which gem it installs (Wanted::kind, patched or upstream) for its
other messages, so the fix hands that to install_staged. Its one caller
is updated. The diff is 7 lines of code plus the test.

CLI_CONTRACT.md describes the line as "from <what>", so it needs no
change. The npm/, pypi/ and gem/ wrappers don't hold this text.

Evidence

  • patch::gem_refresh::tests::a_native_build_names_the_gem_it_builds
    (new, covers Hosted gem rollback / remove says it rebuilds a native gem "from its patched gem" while it installs the upstream build #2152) drives the refresh of an installed native gem through
    a stand-in Ruby in both directions and reads the progress lines. The
    first commit adds it alone, and it fails there:
    assertion `left == right` failed: upstream
      left: "Rebuilding the native extension of rack-2.2.3 from its patched gem; this can take several minutes."
     right: "Rebuilding the native extension of rack-2.2.3 from its upstream gem; this can take several minutes."
    
    It passes with the fix.
  • cargo test -p socket-patch-core --lib gem_: 224 passed.
  • cargo test -p socket-patch-cli --test e2e_redirect_gem_stale_install:
    58 passed.
  • cargo clippy -p socket-patch-core --all-targets --all-features -- -D warnings
    reports nothing in the two files this PR touches. In this sandbox it
    reports errors in other files that this PR doesn't change; CI's clippy
    check is the one to trust.
  • /code-review high found no bugs and two nits, both fixed in the third
    commit (the test's second pass could not fail on the swap, and the doc
    comments listed only rollback and remove).

Not covered: no test runs a real native gem through a hosted rollback.
The unit test uses a stand-in Ruby, which is enough for a label.

https://claude.ai/code/session_011f9aeNXZ8oGYWanAWxsCiy


Generated by Claude Code

The hosted refresh of an installed native gem says it builds
"from its patched gem" in both directions, also when rollback or
remove installs the upstream gem (#2152).

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_011f9aeNXZ8oGYWanAWxsCiy
A native gem's staged build through a stand-in Ruby, in both
directions. It fails for the upstream gem, which rollback and remove
install: the progress line says "from its patched gem" (#2152).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011f9aeNXZ8oGYWanAWxsCiy
Assisted-by: Claude Code:claude-fable-5-2
The staged install of a native gem labelled every build "from its
patched gem". rollback and remove run it for the upstream gem, so
their progress line said the patch was being rebuilt while the
upstream gem was installed.

The refresh already knows which gem it installs (patched or
upstream) for its other messages, and now hands that to the staged
install for the progress line.

Fixes #2152

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011f9aeNXZ8oGYWanAWxsCiy
Assisted-by: Claude Code:claude-fable-5-2
Review follow-ups: the installed file is reset before each pass,
so the second pass also proves the staged install replaced it, and
the doc comments name every unwind, not only rollback and remove.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011f9aeNXZ8oGYWanAWxsCiy
Assisted-by: Claude Code:claude-fable-5-2
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review November 19, 2026 21:55
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

bugbot run


Generated by Claude Code

@cursor

cursor Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
User-facing progress string only; install/build logic is unchanged and covered by a new unit test.

Overview
Fixes misleading native-extension rebuild progress text during hosted gem unwind (rollback/remove): the line always said from its patched gem even when the staged install was building the upstream archive.

install_staged now takes a kind label (patched or upstream) from the refresh path, and passes its {kind} gem into the existing run_build progress hook—behavior is unchanged aside from the message. A unix unit test drives refresh in both directions and asserts the start/finish progress lines name the correct gem (#2152).

Reviewed by Cursor Bugbot for commit e116787. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 e116787. Configure here.

@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

[agent] PR shepherd: review brief for the approver

What it does. Fixes #2152. When a hosted rollback/remove reinstalls the upstream build of a native gem, the progress line said "Rebuilding … from its patched gem". The refresh now passes which gem it is building (patched or upstream) to the staged install, so the line says "from its upstream gem" on an unwind. Only the message text changes; which gem gets installed is unchanged.

Risk: low. It changes one progress string and adds a &str parameter to a pub(crate) function that has one caller. kind can only be "patched" or "upstream". Nothing else in the repo (docs, wrappers, e2e expectations) matches the old text.

Look here

Verified. I read the whole diff and checked every value Wanted::kind can take. I grepped the repo for the old text. The branch has no conflict and doesn't touch CHANGELOG.md. CI on e116787: ci-ok and clippy are green. The test-first commit (6c92ec5) shows the new test failing without the fix.

Changes I made. None.

Open questions. None. One nit, not blocking: the test retries forever on ETXTBSY. Other tests in the crate use the same pattern.


Generated by Claude Code

@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Nov 20, 2026
Merged via the queue into main with commit 394065a Nov 20, 2026
127 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the agent/fix-gem-refresh-build-label branch November 20, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hosted gem rollback / remove says it rebuilds a native gem "from its patched gem" while it installs the upstream build

3 participants