Repository navigation
Vendor a gem for a Bazel hub as its archive, named by a relative file: URL - #2211
Mikola Lysenko (mikolalysenko) wants to merge 8 commits into
Conversation
Tests only. rules_ruby's `ruby.bundle_fetch` copies `Gemfile` and
`Gemfile.lock` into a repository of Bazel's, has Bazel download
`<remote>gems/<name>-<version>.gem` for every gem of a `GEM` section, and
runs `bundle install --local` there. Vendored mode names its copy by a
path, which that repository does not hold, so beside such a hub the
command declines (ruby::vendored_bundle_fetch, which stays as it is).
ruby::file_source_by_hand shows a vendored form that this hub does
build, written by hand in the fixture of the two other flows (rules_ruby
1.0.0-rc2, a lock with a `CHECKSUMS` section, no `gem_checksums`). It is
the pair hosted mode writes, with a relative `file:` URL of the checkout
in the place of the patch registry's:
gem "sp-victim", "1.0.0", source: "file:.socket/vendor/gem/<uuid>/"
GEM
remote: file:.socket/vendor/gem/<uuid>/
specs:
sp-victim (1.0.0)
DEPENDENCIES
sp-victim (= 1.0.0)!
CHECKSUMS
sp-victim (1.0.0) sha256=<the patched gem>
and the patched gem committed at
`.socket/vendor/gem/<uuid>/gems/sp-victim-1.0.0.gem`, where rules_ruby
asks that source for it. No file of Bazel's is written. Bazel's server
runs in the root of the workspace and opens the URL from there, and
Bundler holds the file to the lock's `CHECKSUMS` line.
The flow builds the unpatched checkout, writes the three files, and
builds them on a second machine: a new output base (on Bazel 9 a new
contents cache too), a downloader config that sends nothing to a patch
host and refuses its URLs, and a repository cache that holds no copy of
the patched gem. `bazel build` and `bazel run //:consumer` print the
patched marker, Bazel changes no file, a `--lockfile_mode=error` build
passes, and the stand-in was asked for no patched gem and for no
further upstream one. On a third machine the last byte of the committed
gem is another one. That byte is padding of the tar, so RubyGems still
reads the file, and the build fails in the `bundle install` action with
"Bundler found mismatched checksums", which names the sha256 of the
lock and the one of the file.
rules_ruby installs the Bundler that the lock's `BUNDLED WITH` names in
the hub and runs it there. The fixture's lock names 4.0.15, and most
locks today name a Bundler of the 2 line, so a fourth and a fifth
machine do both again with 2.6.9 in the lock: the hub holds
`@bundle//:bundler-2.6.9`, the build prints the patched marker, and the
changed byte fails it with the same message. Bazel downloads that
Bundler from rubygems.org with the sha256 of rules_ruby's own table, as
it does the 4.0.15 of the other flows.
The flow passes on Bazel 9.3.2 with the product code as it is, and on
8.8.2 and 7.7.2 with the change that follows, which it does not use
(macOS arm64).
The downloader rules of a flow are now a function (`routes`), so that a
machine without a patch host keeps the two rules for the gems of
rubygems.org. Bundler's message is compared without white space in one
place for both flows.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…: URL
Vendored mode declined every gem whose `Gemfile` or lock a
`ruby.bundle_fetch` call of the Bazel workspace reads
(`vendor_gem_bazel_hub`): the copy it commits is named by a path, and
rules_ruby runs `bundle install` in a repository of Bazel's that does not
hold it. It now vendors such a gem in a form that the hub builds, where
the files of the checkout show that it builds, and declines everywhere
else as before.
The form. The patched gem is committed as the archive the patch service
serves, at `.socket/vendor/gem/<uuid>/gems/<name>-<version>.gem`, and the
two files name it as hosted mode names a patch registry, with the
relative URL `file:.socket/vendor/gem/<uuid>/` in the registry's place:
a `source:` option on the gem's declaration (or the line hosted mode
adds for a gem the Gemfile does not declare), a `GEM` section of the
gem's own with that remote, a source-pinned `DEPENDENCIES` entry, and
the sha256 of the patched gem in `CHECKSUMS`. These are the three files
of ruby::file_source_by_hand, byte for byte. rules_ruby asks Bazel for
`<remote>gems/<name>-<version>.gem`; Bazel's server runs in the root of
the workspace and opens the URL from there; Bundler holds the file to
the `CHECKSUMS` line. No file of Bazel's is written. Beside the gem the
directory of the patch holds the marker and a `.gitignore` (`!*`) and
`.gitattributes` of its own, because stock ignore templates name
`*.gem`, and the ledger records the archive with its sha256 and size.
The pair is not written by new code: it is the hosted planner's own
edit (`plan_gem_source` hands `plan_gem_redirect` the URL and the sum),
so it is what hosted mode writes for the same project, in the lock's own
line endings.
Where it is written (`vendor::gem::bazel::gate`). Only for a gem whose
`Gemfile` or lock a call of the hub names, and only where each of these
holds. All of them are read from the files of the checkout, through the
readers of `bazel/`; no Bazel is run:
- The checkout names a Bazel release of 7, 8 or 9 other than 9.1.0
(`bazel::rc::declared_release`: `.bazelversion`, or
`USE_BAZEL_VERSION` in `.bazeliskrc`). Bazel's history says that
`repository_ctx.download` fails on such a URL in 9.1.0 ("Migrate from
URL to URI") and that 9.1.1 and 9.2.0 fixed it ("downloader: fix
opaque file URI names"); that is read, not run. A checkout that names
no release, or one that is not three numbers, is declined: 9.1.0 may
build it, or a release to come.
- The project is the root of the Bazel workspace: Bazel opens the URL
from the root, and the gem lies under the project.
- The module files are read with certainty, no `WORKSPACE` file defines
a repository, every call of the hub writes out the files it reads, and
a call that reads the `Gemfile` or the lock of the project reads both.
- Something holds the gem to its bytes in the hub of every call that
reads the two files: the lock has a `CHECKSUMS` section, or the
`gem_checksums` of each such call (a dict of strings that is written
out) have an entry for the gem. With neither, any bytes at that path
would build in that hub. Two calls may read the same pair, each for a
hub of its own, and the detail names the call without an entry.
- The lock names a Bundler that a hub was built with (`BUNDLED WITH`):
2.6 or later of the 2 line, or one of the 4 line. rules_ruby installs
the lock's Bundler in the hub and runs it; ruby::file_source_by_hand
builds the form with 2.6.9 and 4.0.15, and both fail the build on a
changed byte. An older Bundler, and a lock that names none, is
declined; every lock that passes has one `GEM` section per source.
- The lock holds the gem as its ruby-platform entry.
One more condition is known only once the patched gem is downloaded:
every `gem_checksums` entry for the gem, in any call that reads the two
files, has to hold it to the patched gem, because rules_ruby hands that
sha256 to Bazel. An entry for other bytes declines the gem after the
download and before any write, with the same code, and the detail names
the call, the entry and the sha256 to write there. socket-patch does
not edit the call. A dry run downloads nothing and does not show this
one.
Before any of that the gem meets what vendored mode refuses for every
gem, in the same order as outside Bazel: the refusals of the lock, of
the declaration and of the stub gemspec (a native extension, a
declaration in a `group` block, and the rest).
What declines says so. The refusal keeps its code, its exit code and
its place (before a download, a takeover or an eject), and the detail
names the condition in the place of the sentence about the path:
`ruby.bundle_fetch` (MODULE.bazel:15) of the Bazel workspace at
/repo names Gemfile.lock; vendored mode commits the patched gem for
such a call and names it by a relative `file:` URL, which is not
known to build here: the checkout names no Bazel release as three
numbers (`.bazelversion`, or `USE_BAZEL_VERSION` in `.bazeliskrc`),
and not every release opens such a URL; use `--mode hosted`, ...
A doubt of the reader declines as it did, in the words it had.
What a run that works says. One warning per gem,
`vendor_gem_bazel_file_source`, with what the form costs: Bundler by
itself does not install from such a source (`bundle install` on a
machine without the gem and `bundle lock --update` fail; on a machine
that installed the gem before the patch, `bundle install` passes and
the program runs that unpatched copy; measured with Bundler 4.0.15), so
the checkout builds its gems through Bazel only, and hosted mode serves
both; and Bazel does not watch the gem, so an output base that fetched
the hub before keeps what it fetched. A person who ran the command is
told to build with Bazel as the next step, where a run that vendored
anything else is told to reinstall.
Every entry point. The refusal layer (`vendor::bazel_hub::refusals`)
asks the gate where it declined, so `scan`, `get` and `vendor`, their
dry runs, the takeover of a hosted pin and the eject of one all go on
where it holds. The backend (`vendor_gem`) asks it again and takes the
gem in `vendor::gem::bazel::vendor`; the download plan asks for the
archive and its stub gemspec and stages no tree.
The undo. `vendor --revert`, `rollback` and `remove` take the source
off the `Gemfile` (the option, or the added line, with the helpers the
hosted unwind uses), move the lock's entry back into the section it
came from, where Bundler sorts it, and put its `DEPENDENCIES` entry and
its `CHECKSUMS` line back as the ledger recorded them, then delete the
directory. Both files go back or neither, byte for byte where the
lock's entries are in Bundler's own order: a pair whose `source:` or
`GEM` section is no longer what the run wrote is left alone with the gem
(`vendor_lock_entry_drifted`), and so is a ledger record that would put
back a line that is not this gem's. A pair that names the source nowhere
has been put back by hand, and only the directory goes.
The undo does not edit the call either. Where a `gem_checksums` entry
still holds the gem to the sha256 of the patched gem, which is the
value the run asked for, Bazel fails the download of the upstream gem
that the lock names again (`Checksum was ... but wanted ...`). The undo
says so in a warning, `vendor_gem_bazel_checksum_left`, that names the
call and the entry; the decline that asks for the value says that no
undo puts the old one back.
The other commands. A later run is in sync, with or without the switch.
`vendor --check` holds the committed gem to the patch (the patched
files in it) and to the sha256 of the ledger; `repair` downloads it
again, and so does a run that finds the pair in place and the gem gone.
A newer patch of the gem takes the source over in place. `list` shows
the gem as vendored. Lock discovery reads a `GEM` section whose one
remote is the patch's directory, spelled exactly as written, as a
vendored reference to that archive where the manifest gives the gem the
same source, so `vex` attests the gem as it attests every vendored one:
`not_affected`, which ruby::vendored_bundle_fetch now holds to the
patched build. `vex` holds the committed gem to its patched files, as it
holds every vendored archive; `vendor --check` holds it to its bytes as
well. What `vex` says of a gem vendored by its path is unchanged
(nothing: its build is not judged).
A ledger artifact counts as one committed file by its place,
`<dir>/gems/<file>.gem`, and not by the suffix alone: a copy vendored by
its path is a directory named for its gem and version, and a version
may end in `.gem`.
The switch. `--allow-vendored-in-bazel` means what it meant: with it
vendored mode writes the copy of every other project, named by its
path, also where the archive would be written without it.
Where nothing changes. Outside a Bazel workspace, and in a workspace
whose hubs read none of the project's files, the gem backend takes the
path it took: for 40 scenarios in four such places (scan, check,
rescan, revert, dry runs, `get`, `vendor`, the eject and the takeover,
as JSON and as a person reads them) a binary of this commit prints what
a binary of its parent prints, exits as it does and leaves the same
files, byte for byte.
Tests:
- ruby::vendored_bundle_fetch (real Bazel): the checkout names no
release, the command declines and the build stays the upstream one;
with the release in `.bazelversion` it writes the files of the flow
written by hand, the next build prints the patched marker on a
machine whose Bazel reaches no patch host, with no request for a
patched or an upstream gem, `vendor --check` passes, one changed byte
fails `vendor --check` and the build of a second machine,
`vendor --revert` restores every file and the upstream build, and
hosted mode still patches it. The documents of `--vex`, `vex` and
`vex --no-verify` are held to that build.
- Without a Bazel, through the binary: the run, the dry run, the
in-sync runs, `vendor --check`, `repair`, the three undos, the switch,
a hosted scan over the vendored gem and the takeover of a hosted pin;
the next step a person is given; a lock that names Bundler 2.6.9; and
each condition that declines, with nothing written and no gem
fetched: an older Bundler, a second call without an entry, the entry
for other bytes in the first call and in a second one. With the entry
for the patched gem the gem is vendored with and without a
`CHECKSUMS` section, and each of the three undos puts every file back
and names the entry it leaves.
- Unit tests of the gate, one case per condition; of the undo over the
planner's own pairs (a declared gem with its requirement, options and
comment, an undeclared one, CRLF, a lock with no `CHECKSUMS`), of a
patch that follows another, of a pair that drifted and of a ledger
record that names another gem's line; of the archive check; of the
backend against a stand-in for the patch service; and of discovery.
The three `ruby::` flows pass on Bazel 9.3.2, 8.8.2 and 7.7.2 at this
commit (macOS arm64), and ruby::vendored_bundle_fetch fails on 9.3.2
against a binary of the parent; the legs of bazel-ruby.yml run them on
the three releases.
The test of the refusal in bazel_hub.rs asserted the sentence about the
path for a gem below the Bazel root; it now asserts the condition that
declines that gem.
Docs: docs/ecosystems.md has "Bazel workspaces: RubyGems vendored mode",
the vendored cell of the RubyGems row ("Supported with the Bazel release
named in `.bazelversion`"), four entries among the known problems (the
two costs, the entry an undo leaves in the call, and a hub that Bazel
does not fetch again), and what "Bazel workspaces: VEX" says of a
vendored gem; CLI_CONTRACT.md has the rows of the code, of the two
warnings, of the switch and of the vendored table. bazel-ruby.yml starts
its legs for vendor/gem/. The `bazel` group of scripts/loc-budget.json
follows the 11 lines added to built.rs.
Not covered: `rb_bundle_fetch` in a `WORKSPACE` file, a project below
the Bazel root, a gem locked as platform gems and a lock of a Bundler
older than 2.6 are declined. Not run: Windows, releases of rules_ruby
other than 1.0.0-rc2, and a Bundler other than 4.0.15 and 2.6.9 inside
the hub. A gem that the Gemfile does not declare was built by hand on
Bazel 9.3.2; no test here builds one. A release that the environment of
a machine names in place of the checkout's is not seen. Measured by
hand on Bazel 9.3.2 and stated in the docs, with no test here: an
output base that fetched a damaged gem keeps failing after `repair`
until it fetches the hub again, and a hub that Bazel does not fetch
again (pinned in a vendor directory, or built with `--nofetch`) keeps
the gems it has.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The pull request this one is stacked on gained a commit (a requirements file a hub names counts for the files its `-r` includes reach; a doubt has the hub's other file read too). Two conflicts, both additions side by side: `bazel/built.rs` keeps this branch's `hub_calls` and that commit's `includes_one`, and the `bazel` line budget is the count of the merged tree, 2622. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- The gate did not look at the rc files of the checkout. A `.bazelrc`, or a file it imports, that names `--experimental_remote_downloader` (a remote downloader is handed the URL in the place of Bazel's own), `--repository_disable_download` or `--vendor_dir` (a hub pinned in a vendor directory keeps the gems it has) now declines the gem, and so does an rc file that cannot be read. None of the three was built. - A directory that git ignores was refused only after the download and after a dry run had returned, so a dry run showed a gem the run then refused. The check now comes first, dry run or not. - An undo treated a pair of which one file had been put back by hand (a `git checkout` of the lock, a merge that took the other side) as drifted for good: every `vendor --revert`, `rollback` and `remove` warned and left the other file and the gem. A file that names the source nowhere has been put back already, and the other now goes back by itself. A file that still names it and no longer holds what the run wrote leaves both alone, as before. - A refusal of the planner was passed on with the way on it names for a hosted run. The decline now says whose way on that is. - The closing `Next steps:` named the Bazel build only when every package of the run was such a gem, and compared a copy of the advisory's code. A run that vendored other packages too now adds a line for the Bazel build, and the code is the core's constant. - The two wiring kinds of this form were not among the kinds whose file the ledger checks. The real-Bazel flow builds the unpacked copy under `--allow-vendored-in-bazel` again: the failing `bundle install` there is what the decline is for, and the rewrite of the flow had dropped it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
PR SummaryMedium Risk Overview Refusal logic in CLI / ledger: new events Tests & CI: Reviewed by Cursor Bugbot for commit dd2651e. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit dd2651e. Configure here.
|
[agent] PR shepherd: review brief for the approver What it does. Where a rules_ruby Risk: high. It adds about 785 lines of new code that writes users' Look here
Verified. I read the new module's non-test code: the uuid directory goes through Changes I made. None. Open questions
Generated by Claude Code |
Wenxin Jiang (Wenxin-Jiang)
left a comment
There was a problem hiding this comment.
[agent] Reviewed the stacked diff against #2208, including the loaded Gemfile pair, checksum gate, archive verification and undo. This approval covers the gem archive change. The finding on the parent PR still applies to the stack.
…ndored/gem-file-source This brings main in, through the two merges of the declines' branch. Four files conflicted. The RubyGems tests of e2e_bazel_build keep every test of this branch, of that branch and of main, with one `Served`, one `run`, one `squeezed` and the two checkouts of that merge. patch/redirect/mod.rs keeps `plan_gem_source` beside main's `gem_pair`. docs/ecosystems.md keeps the entries of both sides: main's cell and sentences on hosted mode beside a `gem_checksums`, this branch's on vendored mode. The `bazel` cap of scripts/loc-budget.json is the count of the merged tree, 3869. Outside the conflicts, the two `DepOverride` values that vendor/gem/bazel.rs builds name the `npm_registry_url` main added to that type. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…gnore line `cargo::vendored_from_cargo_with_config` comments out the line the scan wrote in `.bazelignore` and expects `bazel cquery //...` and `bazel query 'deps(//...)'` to fail on a repository that the main repository does not see. It looked for the hub's repository (`@crates__...`) alone. The build file that cargo-bazel writes into the committed copy names `@platforms` as well, and Bazel reports the first one it meets: on a Linux runner with Bazel 9.3.2 the query named `@platforms` and the flow failed on its own check. The flow now takes either name for that failure. Test only: nothing the command does changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The check of the commands that fail once the ignore line is commented out now reads the name out of Bazel's message and takes it only when the message is about the main repository's view: `platforms`, or a repository of the crate hub. The same words about another repository's view, or about another name, are a different failure and no longer pass for the expected one. A test without Bazel holds the check to the two messages that were seen and to three it must not take. The module docs, the comment at the call and the section on the build file in a vendored crate said the commands end on the dependency's repository alone. They now name `platforms` as well, which is what a user who comments the line out can see. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
[agent] PR shepherd: updated review brief (new commits since the brief for What it does
Those two commits are line for line the change in #2227, which is reviewed there. Risk Look here
Verified
Open questions Generated by Claude Code |
…ndored/gem-file-source This brings main in, through the merge of the declines' branch. Two files conflicted. The docs of vendor/refusals.rs keep this branch's words on a gem that is committed for the hub and main's item on a Maven jar that only a rules_jvm_external hub builds; the one dispatch of `bazel_workspace_refusals` is the merged one of that branch. The `bazel` cap of scripts/loc-budget.json is the count of the merged tree, 4053. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Wenxin Jiang (Wenxin-Jiang)
left a comment
There was a problem hiding this comment.
[agent] Re-reviewed the commits since the last approval; no major findings.

Vendored mode now patches a RubyGems dependency that a rules_ruby
ruby.bundle_fetchhub builds, by committing the patched gem and naming it inGemfileandGemfile.lockwith a relativefile:URL, wherever the checkout shows that Bazel builds that form; everywhere else it declines as before.Stacked on the pull request that makes vendored mode decline beside a hub ("Decline PyPI and RubyGems vendored mode where a Bazel hub reads the lock").
Decisions for the maintainer
file:source inGemfileandGemfile.lock, with the patched gem committed under.socket/vendor, was decided by the maintainer on 2026-11-20. Its price is that Bundler by itself does not install from that source in the same checkout (see Limits); the run says so in a warning, and hosted mode is the mode that serves both builds. The other forms that built were labels written into theruby.bundle_fetchcall, and a committed Bazel extension; neither is built here.file:URL. Bazel 9.1.0 fails on one (Bazel's own history: "Migrate from URL to URI" in 9.1.0, "downloader: fix opaque file URI names" in 9.1.1 and 9.2.0; read, not run). Without three numbers in.bazelversion, or inUSE_BAZEL_VERSIONof.bazeliskrc, nothing says that the build is not on 9.1.0, so the gem is declined and the message says what is missing.latestand a release candidate count as no release. The alternative is to go on with a warning, which can leave a broken build behind a command that exited 0.BUNDLED WITHnames in the hub and runs it there. The form is built with 4.0.15 and with 2.6.9, on the three Bazel releases, and both fail the build on a changed byte. A lock is taken when it names 2.6 or later of the 2 line, or a Bundler 4. A lock of Bundler 2.2 to 2.5 is declined, although rules_ruby itself builds from one: no build here ran the form with such a Bundler. To widen the rule, add an older Bundler toruby::file_source_by_hand.bundler-2.6.9.gemthere, with the sha256 of rules_ruby's own table, as the three flows already fetchbundler-4.0.15.gem. No gem under test comes from a public registry.ruby.bundle_fetchcall. Wheregem_checksumshas an entry for the gem, the run declines until you write the sha256 of the patched gem there, and an undo leaves that value in place: the build then fails until you put the upstream one back or delete the entry. The undo says so in a warning. The alternative is to write a Bazel file.--allow-vendored-in-bazelstill writes the unpacked copy named by its path, also where the new form would be written without it.scan --mode vendoredorvendor, where the conditions hold. On the base both were declined and the hosted pin stayed.Today
Where a
ruby.bundle_fetchcall of the workspace reads the project'sGemfileorGemfile.lock, vendored mode declines the gem withvendor_gem_bazel_huband writes nothing: the copy it commits is named by a path, rules_ruby runsbundle installin a repository of Bazel's that does not hold that path, and the build fails.What changes
For such a gem vendored mode commits the archive the patch service serves and writes the pair that hosted mode writes, with a relative URL of the checkout in the place of the patch registry's:
rules_ruby asks Bazel for
<remote>gems/<name>-<version>.gem, Bazel opens the URL from the root of the workspace, and Bundler holds the file to theCHECKSUMSline. No file of Bazel's is written. The directory of the patch also gets the marker and a.gitignore/.gitattributesof its own (stock ignore templates name*.gem).It is written only where all of these hold, each read from files of the checkout:
WORKSPACEfile defines a repository, everyruby.bundle_fetchcall writes out the files it reads, and a call that reads one of the two files reads both;CHECKSUMSsection, or each such call has agem_checksumsentry for the gem;gem_checksumsentry for the gem, in any of those calls, is the sha256 of the patched gem (known after the download; the message names the call and the value to write);BUNDLED WITHnames Bundler 2.6 or later of the 2 line, or a Bundler 4;Where one does not hold the gem is declined with the same code and exit code as before, nothing is written, and the message names the condition. What vendored mode refuses for every gem (a native extension, a declaration it cannot edit) is refused first, as outside Bazel.
Nothing changes for a project outside a Bazel workspace, for a project in a workspace whose hubs read none of its files, or for any other ecosystem.
The other commands follow. A later run is in sync.
vendor --checkholds the committed gem to the patch and to the ledger.repairdownloads it again.vendor --revert,rollbackandremovetake the source off theGemfile, put the lock's entry back where Bundler sorts it with itsDEPENDENCIESandCHECKSUMSlines as they were (byte for byte for a lock in Bundler's own order), and delete the directory; a pair whosesource:orGEMsection is no longer what the run wrote is left alone.listandvexshow the gem as vendored. A person who runs the command is told to build with Bazel as the next step, not to reinstall.Limits
The run says the first two in a warning (
vendor_gem_bazel_file_source):bundle installon a machine that has not installed the gem fails, and so does everybundle lock --update. On a machine that installed the gem before the patch,bundle installpasses and the program runs that unpatched copy, with no error. The checkout then builds its gems through Bazel only. Hosted mode serves both builds.repairuntil it fetches the hub again. A change ofGemfile.lockor a new output base fetches again.gem_checksumsentry you wrote. Aftervendor --revert,rollbackorremovethe build fails on it (Checksum was ... but wanted ...) until it holds the upstream sha256 again or is deleted. The undo warns (vendor_gem_bazel_checksum_left).CHECKSUMSline or bygem_checksums, and by nothing else; with neither the gem is declined.vexholds the committed gem to its patched files;vendor --checkand a fresh build hold it to its bytes.gem_checksumsentry that holds other bytes.--nofetch) keeps the gems it has, in every mode.Contents
vendor/gem/bazel.rs(new: the conditions, the write, the undo and its warning, the archive check) 664; lock discovery 32; the gem backend's hooks 28; the refusal layer 21; the hosted planner's entry point 15; the workspace reader 11;repairandvendor --check9; the next-step line of the CLI 5e2e_bazel_build/ruby.rs)docs/ecosystems.md,CLI_CONTRACT.md)Two commits. The first is tests only: a flow that writes the three files by hand and builds them, which passes on the code as it was. The second is the change, with the flow of vendored mode rewritten to hold the command to those files.
What it proves, and where
Bundler found mismatched checksums); the same again on two machines whose lock names Bundler 2.6.9, where the hub holds that Bundler. Written by the command: the same three files byte for byte, the next build prints the patched marker with no request for a patched or an upstream gem,vendor --checkpasses and catches one changed byte, a second machine's build fails on it,vendor --revertrestores every file and the upstream build, and the VEX documents are held to the patched build. In a checkout that names no release the command declines and the build stays as it was. The legs ofbazel-ruby.ymlrun the three releases.vendor --check,repair, the three undos with the warning for an entry left in the call, the next step a person is given, a lock of Bundler 2.6.9, the switch, a hosted scan over the vendored gem, the takeover of a hosted pin, and every condition that declines, a second call that reads the same two files among them.CHECKSUMS; the warning of the undo; a newer patch that follows an older one; a pair that drifted; a ledger record that names another gem's line; the backend against a stand-in for the patch service; lock discovery.Not covered
rb_bundle_fetchin aWORKSPACEfile, a project below the Bazel root, a gem locked as platform gems and a lock of a Bundler older than 2.6: declined.Gemfiledoes not declare builds patched by hand on Bazel 9.3.2; no test here builds one. A newer patch that follows an older one is tested without Bazel only.ruby.bundle_fetchcalls over the same pair: the conditions are tested without Bazel. No test here builds two hubs.gem_checksumsentry (9.3.2), plain Bundler on the vendored checkout (4.0.15), a hub pinned in a vendor directory and--nofetch(9.3.2).vexstill says nothing of a gem vendored by its path with--allow-vendored-in-bazel, whose build fails, as before.Code review
Nine findings, each checked against the code. Six are fixed in one commit on top ("Close six gaps of a gem vendored for a Bazel hub that a review found"), each with a test except the second:
.bazelrc, or a file it imports, that names--experimental_remote_downloader,--repository_disable_downloador--vendor_dirnow declines the gem, as does an rc file that cannot be read. Under the first a remote downloader is handed the URL in the place of Bazel's own (read in Bazel's source: 9.3.2 keeps afile:URL to itself, 7.7.2 does not); none of the three was built.GemfileandGemfile.lockput back by hand, every undo warned and left the other file and the gem. The other file now goes back by itself.The real-Bazel flow also builds the unpacked copy under
--allow-vendored-in-bazelagain, and asserts the failingbundle install: the rewrite of the flow had dropped the one build that shows what the decline is for.Not changed:
bundle_fetch(0.5.0 to 1.0.0-rc2) downloads<remote>gems/<name>-<version>.gemwith Bazel's downloader (read in the ruleset's source); hosted mode rests on the same line and has no such gate. Built with 1.0.0-rc2 only.groupblock, a gem with a native extension, a patch without a stub specification). They are false declines, not broken builds; narrowing them is a change of its own.state.json, which is a committed file, and the record's lines for the gem are checked.Generated by Claude Code