Skip to content

Commit ee63046

Browse files
committed
bundler: run 2026-11-16 (backlog: mixed states, supersede, declaration shapes; #2096)
1 parent 90b6fc6 commit ee63046

3 files changed

Lines changed: 43 additions & 5 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[agent] 2026-11-16: Bundler (RubyGems) bug-hunt run
2+
3+
**Tested:** main `63f791d` (5.1.0; same SHA as the last runs, so the run went to the backlog). Linux. Ruby 3.3.6 with Bundler 4.0.18 and 2.5.22; Ruby 3.1.6 with 2.6.9.
4+
5+
**Harness:** the standalone Python mock, rebuilt from the state file's notes, with `rack 2.2.8`, `concurrent-ruby 1.2.2` (transitive) and `rake 13.0.6` (group block) repacked. Three patches for rack with different uuids to test a superseding patch.
6+
7+
**Re-triage:** main has not moved, so nothing to re-check. #1109 is `agent:needs-human`.
8+
9+
**Cells**
10+
11+
| Cell | Result |
12+
| --- | --- |
13+
| Hosted, 23 Gemfile declaration shapes (several requirements, hash rockets, multi-line, `\` continuation, `if` modifiers, `;`, `platforms` / `install_if` / `group` blocks, tab indent, CRLF, no final newline, `=begin` block, `__END__`, comments that look like declarations): scan, frozen install, lock stable, app, rollback | pass on 4.0.18, pair byte-exact every time; a braced options hash is refused as documented |
14+
| Hosted, after patching: `bundle lock --add-platform` / `--remove-platform`, `lock --update <gem>`, `update --conservative`, `lock --normalize-platforms`, `lock --add-checksums`, `check`, `doctor`, `list`, frozen install | pass on 4.0.18 (pins and checksums kept) |
15+
| Hosted, a newer patch supersedes the wired one: re-scan, frozen install, rollback | pass on 4.0.18 (source, lock remote, CHECKSUMS and installed copy all move) |
16+
| Vendored, a newer patch supersedes: re-scan, frozen install, rollback | pass on 4.0.18 |
17+
| Agent, a newer patch supersedes | **fail #2096** on 4.0.18, 2.6.9, 2.5.22 when the old patch changed a file the new one does not; pass when both change the same file |
18+
| Hosted, then `get <purl> --mode vendored` for one of three gems: frozen install, app, `list` | pass on 4.0.18 |
19+
| Vendored, then `scan --mode agent` for the gem vendored mode refused: install, app, `vex`, `apply --check`, rollback | pass on 4.0.18, pair byte-exact |
20+
| `repair` on a vendored project with a deleted artifact file | pass (redownloads it; `vendor --check` names the remedy) |
21+
22+
**Filed**
23+
- https://github.com/SocketDev/socket-patch/issues/2096: an agent re-scan that replaces a gem's patch with a newer one overwrites the manifest record and leaves the files only the old patch changed patched. `apply --check` and `vex` pass on the mixed tree; `rollback` / `remove` exit 0 and the app still loads the old patch's code, which no command lists. Suspect `agent_download.rs:1737`; probably not gem-specific.
24+
25+
**Commented / closed:** nothing.
26+
27+
**Ruled out**
28+
- `repair` printing "No manifest; no patch artifacts to download." on a vendored project: it goes on to repair the vendored artifacts.
29+
- `vendor --check` exit 1 for an agent-manifest patch beside vendored gems: not gem-specific, not filed.
30+
- A vendored takeover drops the declaration's comment and range: already listed.
31+
- A first vendored supersede failure ("sha512 integrity mismatch") was the harness serving one file for two uuids.

‎known-non-bugs/bundler.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,8 @@ Documented limitations and verified false positives. One bullet each. Search thi
172172
- Bundler 4.1 `cooldown` does not reject a hosted pin whose registry entry is newer than the window: a version the lock already pins is exempt (`locked_by_lockfile?`). Only `bundle update <that gem>` is subject to it, which #2070 covers (2026-11-16).
173173
- `bundle install --redownload` on Bundler 4.0.18 fails with "Could not find rack-2.2.8.gem for installation" after the gem home's `cache/` dir was deleted by hand. That is Bundler, with or without socket-patch; 4.1.0 with `prune` recreates the dir (2026-11-16).
174174
- Bundler 4.1 `global_gem_cache` keys downloads and compiled extensions by source, so a hosted gem and the upstream gem of the same version never share an entry (2026-11-16).
175+
- `repair` on a vendored-only project prints "No manifest; no patch artifacts to download." first and then does redownload a damaged vendored artifact. The first line is about the agent manifest only (2026-11-16).
176+
- `vendor --check` exits 1 with "patch has no vendored ledger entry" for an agent-manifest patch on a project that mixes vendored and agent gems. Not gem-specific, so not filed here (2026-11-16).
177+
- A hosted scan refuses `gem "rack", "~> 2.2.3", { require: false }` (a braced options hash) and a transitive line when the Gemfile has an `__END__` marker. Both write nothing for that gem and the pair still installs (2026-11-16).
178+
- A superseding patch that changes the same file as the old agent patch is handled: the file ends on the new content and `rollback` restores the original. Only files that dropped out of the patch are left behind (#2096).
179+
- A `.orig/` copy of `Gemfile` + `Gemfile.lock` inside a test project counts as a project directory for a bare hosted / vendored scan and for `rollback`. Keep backups outside the project.

‎state/bundler.md‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Last run: 2026-11-16, main `63f791d`, release 5.1.0, newest Bundler 4.1.0 stable
44

55
The ledger was reset on 2026-11-13. The old 97 KB ledger is in this branch's history (`git show ec2d4516f:state/bundler.md`); search it with `git grep`, don't copy it back.
66

7-
Harness notes: the sandbox reaches rubygems.org but not the Socket patch API. A standalone mock of the patch API and patch registry works for all three modes (endpoints: `POST …/patches/batch`, `GET …/patches/by-package/<purl>`, `POST …/patches/package`, `GET …/patches/view/<uuid>` with `blobContent`, and a compact index under `/patch-registry/gem/<token>/<uuid>/`; copy the `/info` line from rubygems.org and swap the checksum). Build the patched gem by repacking the upstream `.gem` with its `metadata.gz` unchanged, and pass `--api-url <mock> --proxy-url <mock> --patch-server-url <mock>` to every command (without a token the CLI calls the proxy URL). For vendored mode the grant's `tarball` artifact needs `integrity.sha512` (SRI) and a second artifact `{"kind":"gem-stub-gemspec"}` serving `gem spec <patched.gem> --ruby`. Give test repos a `**/vendor/bundle/` ignore line. `--api-token fake --org test` works in place of the proxy route. For a gem with precompiled builds, `nokogiri 1.16.0` compiles from source in under a minute here. rbenv Rubies are in `/opt/ruby-3.1.6` (Bundler 2.3.27, 2.6.9), `/opt/ruby-3.2.6` (2.4.19, 4.0.18), `/opt/ruby-3.3.6` (2.5.22, 4.0.18); `gem install bundler -v 4.1.0` / `4.0.24` works there (2.6.9 on 3.3.6 too), and `gem update --system 4.1.0` gives RubyGems 4.1 (the container is new each run). Select a Bundler with `BUNDLER_VERSION`. The sandbox refuses `rm -rf` on a path built from `$HOME`; use a new directory instead. A patched gem can also be made without Ruby: copy the upstream `.gem`, change one file in `data.tar.gz` and recompute `checksums.yaml.gz`. A realistic project: `gem install rails -v 7.1.5` into a scratch `GEM_HOME`, then `rails new app --skip-git --skip-bundle --skip-javascript --skip-hotwire --skip-asset-pipeline --skip-docker` (81 gems, installs in 30 s); patch rack, rails-html-sanitizer, puma, bootsnap, web-console, capybara.
7+
Harness notes: the sandbox reaches rubygems.org but not the Socket patch API. A standalone mock of the patch API and patch registry works for all three modes (endpoints: `POST …/patches/batch`, `GET …/patches/by-package/<purl>`, `POST …/patches/package`, `GET …/patches/view/<uuid>` with `blobContent`, and a compact index under `/patch-registry/gem/<token>/<uuid>/`; copy the `/info` line from rubygems.org and swap the checksum). Build the patched gem by repacking the upstream `.gem` with its `metadata.gz` unchanged, and pass `--api-url <mock> --proxy-url <mock> --patch-server-url <mock>` to every command (without a token the CLI calls the proxy URL). For vendored mode the grant's `tarball` artifact needs `integrity.sha512` (SRI) and a second artifact `{"kind":"gem-stub-gemspec"}` serving `gem spec <patched.gem> --ruby`. Give test repos a `**/vendor/bundle/` ignore line. `--api-token fake --org test` works in place of the proxy route. For a gem with precompiled builds, `nokogiri 1.16.0` compiles from source in under a minute here. rbenv Rubies are in `/opt/ruby-3.1.6` (Bundler 2.3.27, 2.6.9), `/opt/ruby-3.2.6` (2.4.19, 4.0.18), `/opt/ruby-3.3.6` (2.5.22, 4.0.18); `gem install bundler -v 4.1.0` / `4.0.24` works there (2.6.9 on 3.3.6 too), and `gem update --system 4.1.0` gives RubyGems 4.1 (the container is new each run). Select a Bundler with `BUNDLER_VERSION`. The sandbox refuses `rm -rf` on a path built from `$HOME`; use a new directory instead. A patched gem can also be made without Ruby: copy the upstream `.gem`, change one file in `data.tar.gz` and recompute `checksums.yaml.gz`. A realistic project: `gem install rails -v 7.1.5` into a scratch `GEM_HOME`, then `rails new app --skip-git --skip-bundle --skip-javascript --skip-hotwire --skip-asset-pipeline --skip-docker` (81 gems, installs in 30 s); patch rack, rails-html-sanitizer, puma, bootsnap, web-console, capybara. To test a superseding patch, serve patch A for a purl, then swap the mock to patch B (new uuid, same purl); keep each uuid's patched `.gem` in its own path.
88

99
## Coverage matrix
1010

@@ -20,21 +20,23 @@ Linux only. A cell is `pass` with the Bundler versions and the date, `fail #N`,
2020
| Gem with a native extension (rebuild after patching, rollback restores the build) | pass 2.5.22, 2.6.9, 4.0.18, build failure restored too (11-15); `scan --no-gem-native-rebuild` fail #2069 | refused as documented, exit 1, other gems vendored, 4.0.24 (11-14) | pass 4.0.18, 4.0.24 (11-14) |
2121
| Patched gem that is only a transitive dependency | pass 2.6.9, 4.0.18 (11-14) | installs and reverts 4.0.18; `Bundler.require` loads it fail #2084 | pass 2.5.23 to 4.0.24 (11-14) |
2222
| Git and path sources next to a patched gem | pass 4.0.18 (11-14) | pass 4.0.24, 4.1.0.beta3 (11-14) | pass 4.0.18, 4.0.24, incl. a gem transitive through a path gem (11-14) |
23-
| `bundle update` / `bundle add` / `bundle remove` / `bundle outdated` after patching | pass 4.0.18: add, remove, clean, outdated, `--redownload` then `apply` (11-14) | pass 4.0.18: add, remove, update, outdated, `lock --add-platform`, `cache` (11-14) | add / remove pass 2.6.9 (11-13); `lock --add-platform`, `update <other gem>`, `clean`, `doctor`, `binstubs` pass 4.0.18 (11-14); outdated / update fail #2070 |
23+
| `bundle update` / `bundle add` / `bundle remove` / `bundle outdated` after patching | pass 4.0.18: add, remove, clean, outdated, `--redownload` then `apply` (11-14) | pass 4.0.18: add, remove, update, outdated, `lock --add-platform`, `cache` (11-14) | add / remove pass 2.6.9 (11-13); `lock --add-platform`, `update <other gem>`, `clean`, `doctor`, `binstubs` pass 4.0.18 (11-14); `lock --update`, `update --conservative`, `lock --add-checksums`, `--normalize-platforms`, `check`, `list` pass 4.0.18 (11-16); outdated / update fail #2070 |
2424
| Rollback and remove restore `Gemfile` and `Gemfile.lock` byte for byte | pass (pair never touched) (11-14) | rollback, `remove`, `vendor --revert` pass 4.0.18 (11-14) | pair restored on all, CRLF and `vendor/cache` archives too (11-16); installed copy left patched when the gem home has no `cache/` dir, fail #2092 |
2525
| `vex` reports only what is really applied | pass 2.6.9, 4.0.18, after `bundle pristine` too (11-13) | attests correctly 4.0.18; false `vendored_tree_out_of_sync` fail #2076 | pass 2.6.9, 4.0.18, stale shared-home copy omitted (11-15); orphan platform dir fail #2087 |
2626
| `gems.rb` / `gems.locked` spelling | pass 2.5.22 (11-15) | refused as documented (`gemfile_not_loaded`), not re-run | pass 4.0.18 (11-14) |
2727
| Lock with a CHECKSUMS section (Bundler 2.6+) | n/a | pass 4.0.18; without the section 2.5.22, 2.6.9 (11-15) | pass 4.0.18 (11-13) |
2828
| Monorepo: several Gemfiles, nested projects, scan from the repo root | untested (agent scans one project by design) | pass 4.1.0: 3 Gemfiles, scan, frozen installs, `list`, rollback from the root (11-16) | pass 4.0.18: scan, `list`, rollback from the root (11-14) |
2929
| `setup` and the Bundler plugin it installs | n/a: `setup` and the plugin were removed in v5 (CLI_CONTRACT "…no longer published"); only `gem_bundler_plugin_stale` detection is left, untested | n/a | n/a |
30+
| A newer patch (new uuid, same gem version) supersedes the recorded one on a re-scan | same file changed: pass 4.0.18; a file only the old patch changed stays patched and unrecorded, fail #2096 (2.5.22, 2.6.9, 4.0.18) | pass 4.0.18: artifact dir replaced, frozen install, rollback (11-16) | pass 4.0.18: Gemfile source, lock remote, CHECKSUMS and the installed copy all move, rollback byte-exact (11-16) |
31+
| Gemfile declaration shapes (23: several requirements, hash rockets, parentheses, multi-line, `\` continuation, modifiers, `;`, `platforms` / `install_if` / `group` blocks, tabs, CRLF, no final newline, `=begin` blocks, `__END__`, comments that look like declarations) | untested (agent does not edit the Gemfile) | refused shapes are documented, not re-run | pass 4.0.18: scan, frozen install, lock stable, app, rollback byte-exact for each (11-16) |
3032
| Re-runs (idempotency) and `--json` output | pass 4.0.18 (11-14) | re-scan pass 2.6.9, 4.0.18 (apart from #2075) | pass 4.0.18 (11-14) |
31-
| Switching modes on one project | hosted to agent pass 4.0.18 (11-15); agent to hosted leaves the upstream archive, `pristine` / `--redownload` fail #2089; agent to vendored and back leaves the in-place patch with no record, fail #2093 | hosted to vendored: pair and mixed state pass 4.0.24; rollback afterwards leaves patched installs, fail #2083 | hosted beside vendored gems (mixed) installs and attests 4.0.18, 4.1.0, `repair` and `scan --prune` leave it alone (11-16); any revert of the vendored gem then corrupts the lock, fail #2090 |
33+
| Switching modes on one project | hosted to agent pass 4.0.18 (11-15); agent to hosted leaves the upstream archive, `pristine` / `--redownload` fail #2089; agent to vendored and back leaves the in-place patch with no record, fail #2093; vendored then agent for the gem vendored mode refused (mixed): install, `vex`, `repair`, rollback pass 4.0.18 (11-16) | hosted to vendored: pair and mixed state pass 4.0.24; rollback afterwards leaves patched installs, fail #2083; `get <purl> --mode vendored` over one of three hosted gems pass 4.0.18 (11-16) | hosted beside vendored gems (mixed) installs and attests 4.0.18, 4.1.0, `repair` and `scan --prune` leave it alone (11-16); any revert of the vendored gem then corrupts the lock, fail #2090 |
3234
| Bundler 4.1 specifics (4.1.0 stable) | pass with an `OVERRIDES` lock, and on RubyGems 4.1 with a native rebuild (11-16) | pass with an `OVERRIDES` lock and the new default lock that lists the `ruby` variant beside platform builds (11-16) | pass with `OVERRIDES`, `global_gem_cache`, `cooldown` (patched gem newer than the window), RubyGems 4.1 native refresh (11-16); `prune` fail #2092; `CONTENT ADDRESSES` untested |
3335
| Bundler 1.x refused where the docs say so | untested | untested | untested |
3436

3537
## Backlog
3638

37-
1. Mixed and switched states, the rest (#2089, #2090 and #2093 came from here): agent to hosted with a native gem or a shared gem home; vendored to agent; hosted first and then `vendor <one purl>`; a re-scan when a newer patch supersedes one of a mixed pair; `repair` on a vendored project prints "No manifest; no patch artifacts to download." (check it against the contract).
39+
1. Mixed and switched states, the rest (#2089, #2090, #2093 and #2096 came from here): agent to hosted with a native gem or a shared gem home; a superseding patch on one gem of a hosted + vendored pair; `get` (not `scan`) onto a newer agent patch; a superseding agent patch for a gem with a native extension (does the rebuild record follow?).
3840
2. Friction pass, the rest. Still open candidates: `redirect_gem_no_checksums_section` says "bundler < 2.6 does not write one" on a 2.6.9 lock (its remedy works); `scan --mode vendored` exits 1 whenever one patched gem is refused, with next steps that read like success (noted in #2091); `remove <gem>` from a monorepo root doesn't name the sub-projects that pin it; `apply --check` says "Run `socket-patch apply` to regenerate them" for a gem `apply` refuses; the hosted next step says "a plain `bundle install` keeps the gems it already has" when the stale copy is a platform build the lock no longer names; `docs/usage.md` never mentions Ruby.
3941
3. The Rails app, the rest: a Rails 8 Gemfile (kamal, thruster, solid_*), the default dev setup with a shared rbenv gem home, `bin/setup`, a Dockerfile-style `BUNDLE_PATH=/usr/local/bundle` install, `bundle update` / `bundle update rails` with hosted pins (beyond #2070), Dependabot-style `bundle lock --update <gem>`.
4042
4. Vendored mode, the rest: `remove` / `vendor --revert` after a hosted to vendored takeover (#2083 covers `rollback` only), `scan --prune`.
@@ -43,7 +45,7 @@ Linux only. A cell is `pass` with the Bundler versions and the date, `fail #N`,
4345
7. Bundler 4.1, the rest: content-addressable gems (the `CONTENT ADDRESSES` lock section needs a registry that serves them; see `lockfile_generator.rb`), `override "x", with:, in:`, `bundle update` / `outdated` under `cooldown`, the OS credential store, `bundler/inline`. Ruby 3.4 is not in the sandbox.
4446
8. Deployment mode and `.bundle/config` shapes around the stale-install guard. #1109 is open and waiting on a maintainer decision; don't re-file it.
4547
9. Bundler 1.x refused where the docs say so (needs a Ruby that still runs Bundler 1.17; none in the sandbox).
46-
10. Re-check #2069, #2070, #2075, #2076, #2083, #2084, #2086, #2087, #2089, #2090, #2091, #2092 and #2093 once fixed.
48+
10. Re-check #2069, #2070, #2075, #2076, #2083, #2084, #2086, #2087, #2089, #2090, #2091, #2092, #2093 and #2096 once fixed.
4749

4850
## Known non-bugs
4951

0 commit comments

Comments
 (0)