Repository navigation
Patch gems locked as platform gems: patched builds where they exist, upstream's gem elsewhere - #2273
Draft
Mikola Lysenko (mikolalysenko) wants to merge 25 commits into
Draft
Mikola Lysenko (mikolalysenko) wants to merge 25 commits into
Mikola Lysenko (mikolalysenko) wants to merge 25 commits into
Conversation
A gem patch's reference now lists every platform gem of the gem's version (`registryOverride.identifiers.gemBuilds`): for each platform the sha256 the patch registry serves and, where there is a patched build, the patch it comes from. A platform with none is served as upstream's own gem, which the registry lists and hands on unchanged. The registry URL carries the snapshot the list was made at (`…/<uuid>/s/<n>`); a later reference names a newer one. This replaces the list of patched platforms only (`gemPlatforms`), under which a lock moved only when every locked platform had a patched build, and one platform without one kept the whole gem unpatched. The gem rewriter: - moves every locked build to the registry together as soon as one of them is patched, each pinned to the sha256 the registry serves for it (a platform still on upstream's gem keeps the sha256 it had); - leaves the gem where it is, with no warning, while no locked build is patched: moving it would gain nothing (`gem_unpatched`); - still skips with `redirect_gem_platform_unsupported` when the registry does not list a locked platform, or the reference carries no list at all (a patch of the ruby gem alone, as before); - reports per locked build which patch is in place and whether this run put it there (`gem_builds`). A registry URL is recognised with any snapshot or none, under any grant token, by the manifest wiring, the lock rewrite and lockfile discovery, so a pair an earlier run wired is refreshed in place when the snapshot changes. A snapshot URL is written closed by a slash, as Bundler writes every remote. The pin of a gem stays one per package. `engine::pin_reports` turns the confirmed pins into what a run reports: a gem locked as platform builds once per locked build, each patched build under its own patch, each build on upstream's gem with none. `engine::gem_unpatched_skips` gives the quiet skip of a gem that was left alone. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A gem patch's registry lists every platform gem of the gem's version: a patched build for some platforms, upstream's own gem for the rest. A lock that names platform builds moves to it as one pin, so a run that reported that pin once said the gem was patched where one locked platform still installs upstream's gem, and it named the gem's patch where each patched build has a patch of its own. Both hosted engines report such a gem per locked build, from the one expansion of the confirmed pins they share (`engine::pin_reports`): - `scan --mode hosted` and `get --mode hosted` record one `applied` (`verified` on a dry run) event per patched build, under that build's own patch, with `details.gemFix` (the gem's patch), `details.platform` and, when the run put the build in place, `details.newlyPatched`. A build the registry serves as upstream's gem is one `skipped` event with no `uuid` (`errorCode: gem_upstream_build_kept`), which `summary` does not count. A person gets one plain line per gem on stdout, such as `nokogiri 1.19.3: patched for x86_64-linux-gnu; upstream gem kept for arm64-darwin (no patched build yet)`. On a terminal it breaks after a clause, not in the middle of a word. - The in-memory engine's `redirect.patches[]` holds the same rows (`pinned` per patched build, `upstream_kept` for the others), its `redirected[]` lists the patched builds with `gemFix`, `platform` and `newlyPatched`, and the new `upstreamBuilds[]` lists the rest. A gem left on its upstream registry because no locked build is patched yet is skipped under `redirect_gem_no_patched_build` in both engines, before the unpinned patches are worked out. It is no warning and never `redirect_unconfirmed`, and a person reads one plain line of it instead of the "No patches could be switched" block. Everything else keeps working on the pins, one per package: the package counts of the human summary, the rollout budget and the severity floor, the takeover, the stale-install probes, VEX and telemetry. The gem mock of the stale-install suite serves `gemBuilds`, with a patch per patched build, under a snapshot URL. The parity suite covers a build on upstream's gem and a gem with no patched build, from the new `platform-pass-through` fixture. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A hosted gem locked as platform builds keeps upstream's own gem for a platform with no patched build: its lock entry pins upstream's sha256, and a machine of that platform holds the right copy. The guard judged that copy like any other. Its cached archive passed only because the sha256 of upstream's gem was counted among the patched artifacts. With the archive pruned, the patch's file hashes called upstream's files stale, and the run downloaded upstream's gem from the registry to replace the install with the bytes it already held, and reported a refresh. Such a build is not judged at all, installed or committed to the cache dir: nothing is reported, nothing is refreshed, no gem is downloaded and no patch record is fetched for it. The patched artifacts are those of the patched builds alone. A platform with a patched build is handled as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Four refinements of how a gem patch's registry is read. The list is asked for. The patch service answers a reference request as it always has unless the request carries `gemBuilds: true`, so that a release that knows no list keeps getting the ruby gem's registry alone. Every package reference request now carries it: the hosted lookup, the vendored one, and the public-proxy route. The list names the ruby gem too (`platform: "ruby"`, the patch itself). The entry was refused as a malformed platform, which cost the gem its grant. It is accepted, and the ruby gem's checksum is read from it where it is there, so every locked build is pinned from the one list. A platform can be missing from the list for a while: the service leaves it out while its patched build is being made. A lock that names such a platform was skipped with a warning, as if the registry were wrong. The gem is now left as it is with no warning (`gem_unlisted`, skip reason `redirect_gem_build_pending`) and moves on a later run. The warning `redirect_gem_platform_unsupported` remains for a patch with no list at all and for the merged lock of Bundler < 2.2. The snapshot level of a registry URL is an opaque key of lowercase hex digits, not a number. It is recognised and never read for a meaning. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A gem the Bundler lock names as precompiled platform gems is vendored as one unpacked patched platform gem per locked platform. Those gems are no artifacts of the gem's patch: each patched platform gem has a patch of its own, and the gem patch's package reference lists every platform gem of the version (`registryOverride.identifiers.gemBuilds`), with the sha256 its registry serves and, where there is a patched build, the patch it comes from. The per-platform artifact kinds `gem-platform` and `gem-platform-stub-gemspec`, and the `platform` field of an artifact, are not served, so they are no longer read. Vendoring such a gem: - asks for the gem patch's reference once, to learn the patch of each locked platform's build, and for the references of those patches in ONE request (`ApiClient::fetch_vendor_references`); - downloads each platform's gem (its patch's `tarball`) and stub gemspec (`gem-stub-gemspec`), a few at a time, and verifies each against the digest its own reference states and the gem also against the sha256 the gem patch's registry lists for that platform. A mismatch refuses with `vendor_prebuilt_integrity_mismatch`, names the platform, and leaves an existing copy as it was; - keeps verifying the trees against the gem patch's record for the patched files they ship. No record of a platform's patch is fetched; - records per tree which patch it came from and the digests its downloads passed (`VendorEntry::gem_builds`, `gemBuilds` in the ledger). A restore fetches each tree again by its recorded patch, in one reference request, and checks the downloads against the recorded digests. While a locked platform has no patched build (the registry serves upstream's own gem for it, does not list it, or the reference carries no list) the gem is not vendored: nothing is downloaded or written, and the skip (`vendor_prebuilt_platform_pending`, as before) is one line that names the platforms. A gem already vendored stays in force as it is when the lock gains such a platform; a copy that is damaged and cannot be rebuilt is still the `vendor_prebuilt_required` failure. An entry that names only the platforms of its copy (`gemPlatforms`, written by builds before this one) still reads, verifies and reverts. It is no longer written: the next vendor run rebuilds the copy from each platform's patch and records them. A restore of such an entry says to vendor again, since nothing names a patch to fetch its trees by. `gems_locked_as_platform_gems` tells a caller which gems the lock resolves that way. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Each patched platform gem has a patch of its own (`pkg:gem/<name>@<version>?platform=<platform>`), which a package search returns beside the patch of the gem itself. Agent mode takes it for the installed copy of that platform. Vendored mode patches a gem through the patch of the gem itself, whose reference names the patched build of every locked platform, so there the platform gem's patch is no fix of its own: selected as one, it reached the gem backend and failed as `platform_gem_unsupported`, or made the gem's records ambiguous. `scan --mode vendored` now drops those patches from the batch offers and from the selection (`ScanPolicy::leave_out_platform_gem_patches`), and `get --mode vendored` from its search results, before anything is reported, downloaded or handed to the vendor engine. A platform gem's patch named by its UUID in `get` is the caller's exact intent and still reaches the backend's own refusal. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A gem vendored as platform gems is one committed copy, verified as one against the record of the gem's patch. What an install loads from it is one platform gem's tree, and each tree was built by a patch of its own, which the vendor ledger records. A VEX document that named the gem under the gem's patch said nothing a scanner could match to the platform gem it found, nor which patch built it. So the document names each platform gem (`pkg:gem/<name>@<version>?platform=<platform>`) under the patch of its tree, with the vulnerabilities of the gem patch's record: the fix is the same in every one of them. The copy is still verified once, before the view is widened, and nothing is fetched: the ledger entry says which patch built which tree. An entry that names no patch for its trees is attested as the gem itself, as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Hosted mode reports a gem locked as platform gems once per locked build, each under that build's own patch. Vendored mode reported it as one event under the gem's patch, so the two modes disagreed about which patches a run put in place, and telemetry never named the platform patches. The vendor engine now turns the outcome of such a gem into one counted event per platform gem (`pkg:gem/<name>@<version>?platform=<platform>`, `uuid` the platform's patch, `details.gemFix` the gem's patch, `details.platform`): `applied` when this run vendored or rebuilt it, `skipped` / `already_vendored` on an in-sync re-run, `verified` for a dry run of a recorded copy, and `verified` or `failed` per platform gem under `vendor --check`. The builds come from the entry the backend hands back, else from the ledger. The gem is still one package: the human summary, the in-sync line and the vendored count of telemetry take the events of one gem once. A retracted run drops the gem's advisories with its per-platform events. A gem with a locked platform that has no patched build prints the backend's one line as it is, without the `Skipping <purl>:` lead, and passes through whatever the ledger holds: the line already says which vendored copy stays in force. For a gem the lockfile pins hosted (a takeover, an eject) it says the pin stays instead of naming hosted mode as what to run; an eject is refused whole on it, as for any pin it cannot vendor. Two things kept such a gem from being vendored at all: - the installed-variant probe hashed a patched file in the installed copy, which is one platform's gem at most and often ships none of the patched files, and skipped the gem silently on a miss. A gem the lock resolves as platform gems is not probed; - a damaged copy of an entry that names no patch for its trees was sent to the restore, which has nothing to fetch them by. It goes to the backend, which rebuilds it from each platform's patch. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The patch service has a patch record per patched platform gem (`pkg:gem/<name>@<version>?platform=<platform>`), which a search returns beside the gem's own. Agent mode takes it for the installed copy of that platform. A hosted run patches a gem through the patch of the gem itself, whose reference lists the patched build of every platform, so there the platform gem's record is no fix of its own. Selected as one it was asked about in the reference request, skipped with "the hosted patch server has no artifact for this patch" (or left "not hosted"), and every later scan offered it as a newer patch of the gem. A hosted `scan` and `get` now leave those records out as a vendored run does, before anything is reported, looked up or written, and so does the in-memory engine's selection. The predicate lives in core (`engine::is_platform_gem_patch`) so that the engines share it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A gem is not moved to the patch registry while no locked build is patched. The same rule kept a lock that is ALREADY on the registry where it was when the build it pins was withdrawn and no other locked build is patched: the snapshot the lock names refuses that build from then on, so `bundle install` fails on that platform until someone unwinds by hand. A lock on the registry now follows the reference whatever it lists: the URL moves to the current snapshot and the withdrawn build's checksum goes back to the upstream gem's, which that registry hands on. A lock that was never moved still stays upstream. Also brings the vendored arm of the "left to patch" test to the line vendored mode prints for a platform without a patched build. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…nstalls A gem patch's registry serves a patched build for some platforms and upstream's own gem for the others, and a lock that names platform builds takes all of them from it under one `GEM` section. The lock's wiring therefore says that the gem is on the registry, not which locked build is patched. A reader that has only the committed files and the patch service to go by (a VEX document made after the run that moved the lock) had nothing to decide that with. `vex::gem_builds` decides it per build, by the one thing a patched gem and upstream's gem never share: the sha256 of the archive. - `locked_gem_pins` reads the builds a lock names of a gem version, each with the sha256 its `CHECKSUMS` pins. - `gem_build_states` holds each against the list a gem patch's reference carries (`gemBuilds`). A platform build is the patched build of its platform's patch only on the sha256 the list gives beside that patch, and upstream's gem only on the one it gives beside none. For a build the lock's `CHECKSUMS` does not pin, the archive is the one the lock's own registry serves, read from that registry's compact-index document (`gem_index_url`). - Anything else is `Unknown`, with why: nothing names the archive the lock installs, the list leaves the platform out, or the lock installs another archive than the list names. The last is a list of a later registry than the one the lock names: a build that is patched there is not shown patched for a lock that does not pin it. The ruby-platform gem a patch's registry serves is the patch itself, so that entry is the gem's patch by the lock's wiring, as for a gem locked as its ruby-platform gem alone. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…pers A hosted scan breaks the line about a gem's builds after a clause when it prints on a terminal, so that no platform name is cut in two. `vex` is about to print a line of the same shape, and a command module may not import another one's helpers. `wrap_line`, `wrap_words` and `wrap_tokens` move from the hosted scan to `ui::text`, with their tests, unchanged. The hosted scan takes them from there. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A gem that a Bundler lock takes from its patch registry as platform builds is one hosted pin, and a VEX document attested it as one: the gem, under the gem's patch. The registry serves a patched build for some platforms and upstream's own gem for the others, so that statement said `not_affected` of a platform that installs the unpatched gem, and it named the gem's patch where each patched build has a patch of its own. A scanner that finds the platform gem of such a platform was told to drop a finding that is real. The gem is still judged as the one pin it is. The document then names each locked build (`pkg:gem/<name>@<version>?platform=<platform>`, and the gem's own purl for a ruby-platform entry beside them): - a patched build is `not_affected` under its own patch, with the vulnerabilities of the gem patch's record, since the fix is the same in every build; - a build the lock installs as upstream's own gem is `affected`, with what changes that as its action statement. This is the document's rule for a package the build is known to take without its patch, the one a Bazel hub already falls under; - a build of which neither is shown is left out, and a warning names the gem, the reason and what to run (`vex_gem_build_unknown`). The records of all of them stay in the view the document is built from, so no statement names a form of the gem (the purl without a platform) that also stands for a build the document does not call patched. Where the builds come from: - `scan --mode hosted --vex` and `get --mode hosted --vex` hand over what the run reports per locked build (`engine::pin_reports`), so the run's own document costs no request beyond the run's. - A later `vex` (and the `--vex` of `apply` and `vendor`) reads the lock and asks the patch service once for the references of the gems' patches (one request for all of them). A build is attested by its patch only when the sha256 the lock's `CHECKSUMS` pins for it is the one the reference lists beside that patch. For a lock with no `CHECKSUMS`, the index of the registry the lock names is read too, once per gem: that is what such a lock installs. The reference can be of a later registry than the lock's; a build it lists as patched while the lock pins another archive is not attested. - `--offline`, a failed request, a reference with no list: nothing is known of the platform builds, and none is attested. A ruby-platform entry beside them is the gem's patch by the lock's wiring, as before. - A gem locked as its ruby-platform gem alone, and every other ecosystem, are as they were, with no request of their own. An installed copy is evidence about its own build alone. A machine of a platform on upstream's gem holds upstream's gem, as its lock entry names it; judged as the gem's copy it withheld the builds the lock does install patched. The copy of a build the lock does not install patched is not judged, and the copy of one it does still is. What a run says: - `vex --json` reports a build on upstream's gem as the hosted scan does: an uncounted `skipped` event under `gem_upstream_build_kept`, which does not make the run a partial failure. The events of every build named in place of a gem carry `details.gemFix` (the gem's patch) and `details.platform`, a gem vendored as platform gems included. - For a person, `vex` prints one line per gem under its summary, in the words of the scan's own line (`nokogiri 1.19.3: patched for x86_64-linux-gnu; upstream gem kept for arm64-darwin (no patched build yet)`), with `not attested for <platform>` for a build left out. On a terminal it breaks after a clause. - The line that folds several omissions of one reason names a platform gem with its platform, since the builds of one gem share its name. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The hosted scan leaves the installed copy of a platform on upstream's gem alone: it is the gem that platform's lock entry names. The VEX of such a machine has to agree with that, in the run's own document and in a later `vex`: the copy must not be attested as patched, and it must not withhold the build of the other platform, which the lock does install patched. The stale-install suite already builds that machine, with a real gem home, with and without the gem's cached archive. It now also checks both documents there: the other platform's build under its own patch, this machine's build as affected. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ites Two things the full suites check that the tests of the platform builds did not meet. The golden fixture of a lock that names a platform the list leaves out still expected `redirect_gem_platform_unsupported`. That platform is one whose patched build is being made, which is no warning: the fixture expects none, and is named for what it holds (`platform-build-pending`). The hosted and vendored end-to-end files read the `--json` envelope with helpers of their own under names the shared readers have (`warning_codes`, `events`). They use `common::envelope` for it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The stand-in patch service of the nokogiri end-to-end script still answered the way the patch service did before a gem's fix became one patch: it named the patched platform gems as artifacts of the gem's patch (`gem-platform`, `gem-platform-stub-gemspec`) and as `gemPlatforms`, under the plain registry URL. The CLI reads none of that any more, so the hosted and vendored legs of the nokogiri workflow had nothing to install from. The stand-in now answers as the service does: - each patched platform gem has a patch of its own, which the search routes return beside the gem's and whose reference serves that gem (`tarball`) and its stub gemspec; one reference request answers for every uuid it names; - a reference request that carries `gemBuilds: true` gets the registry under a snapshot URL, whose key is derived from what the registry lists, and the list of the version's gems (the ruby gem, each patched platform gem with its patch, each platform still on upstream's gem with none); a request without it gets the plain URL and no list; - the registry under a snapshot lists every gem of that list, and answers the file of a platform with no patched build with a 302 to a stand-in of the upstream registry's file host on a second port, which serves the real gem. Nothing leaves the machine for it; - `publish` makes a platform's patched build appear under a newer snapshot, and the earlier snapshot keeps answering as it did. The script's hosted scenario checks what a run reports per locked build and that every reference request asks for the list. With `--pass-through` (and `--add-platform`, to lock a platform nothing here installs) one locked platform has no patched build at first: the lock keeps upstream's checksum for it, a frozen install on that platform gets upstream's nokogiri through the redirect, and the scan after `publish` moves the lock to the newer snapshot and the install to the patched gem. With no locked build patched, nothing moves. The vendored scenario checks that the platform patches are asked for in one request, that no record of theirs is fetched, and that a gem with a platform that has no patched build is not vendored until it has one. The workflow gains two hosted legs (the runner's own platform passed through, and another one) and one vendored leg. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ndler The real-Bundler hosted capstones for a gem locked as precompiled platform gems mounted a patch API that named the patched platform gems as `gemPlatforms` and `gem-platform` artifacts of the gem's patch, under the plain registry URL. The CLI reads the list of the version's gems (`gemBuilds`) under a registry snapshot instead, so all five failed at the scan, and nothing proved the new behaviours against a bundler. The platform cases now share one fixture, `PlatformProject`: the gems, a project the real bundler locked and installed, and a stand-in for the patch service that answers as the wire contract has it. Each patched platform gem has a patch of its own, which the search routes return beside the gem's; a reference request gets the snapshot URL and the list only when it asks (`gemBuilds: true`), and every helper that reads the reference requests asserts that each one asked; the registry under a snapshot lists every gem of that list and answers the file of a platform with no patched build with a 302 to a second wiremock, the stand-in of the upstream registry's file host, so nothing leaves the machine; a later listing is a newer snapshot beside the earlier ones. The five capstones are converted (every locked build patched: with and without `CHECKSUMS`, with the ruby entry beside the builds, and taken over by a vendored run, which now asks for the platform patches in one request) and assert the per-build events. New cases, all on a `CHECKSUMS` lock: - one platform patched and one on upstream's gem, with this machine in either role: the scan moves both, `bundle lock` agrees byte for byte, and a fresh checkout installs frozen, in deployment mode and unfrozen. The machine of the patched platform gets the patched gem; the other gets upstream's gem through the redirect, and the scan downloads nothing for it. `rollback` restores the pair; - no locked build patched, then one platform missing from the list: nothing moves, quietly, until the list has it; - a newer snapshot: the URL and the one changed checksum are rewritten, the build is reported as newly patched, `bundle install` installs it, and the earlier snapshot still installs what it did; - `bundle lock --add-platform` over a hosted lock resolves the new platforms from the registry, patched or not, and a re-scan reports them and writes nothing; - the refresh's download of `gems/<file>` follows a redirect the registry answers with. A machine of platform X is this machine: bundler installs the platform gem of its host, so the cases that turn on which platform is patched run twice with the roles swapped. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…tone The vendored platform-gem capstone served the patched platform gems as `gem-platform` / `gem-platform-stub-gemspec` artifacts of the gem's patch and expected the wording of that model (backticked platforms, "kept the vendored patch"), so it failed at its second step. Vendored mode takes each platform's gem from that platform's own patch, which the gem patch's reference names in `gemBuilds`. Its stand-in service now answers that way (one request answers for every uuid it names, the list only on request, a platform with no patched build listed as upstream's own gem), and the capstone checks, against the real bundler: - one locked platform with no patched build: exit 0, the one line, a counted skip, the gem patch's reference alone asked for, nothing downloaded or written; - every platform patched: the gem patch's reference and then ONE request for the platform patches, each tree that platform's own gem (the fixture gems carry a file that names their build), the ledger's `gemBuilds`, one event per platform gem, and one package for a person; - `vex` and the manifest-less `vex` attest each platform gem under the patch of its tree, `vendor --check` gives one verdict per platform gem; - a newer patch that lacks a platform leaves the vendored one in force, in the line the engine prints for it; - a ledger entry that names platforms only (`gemPlatforms`) still checks and reverts, and the next run records each tree's patch. The frozen and unfrozen installs from the committed tree, the tampered foreign tree, the in-sync re-run and the byte-for-byte revert stay. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ri script A hosted lock names the registry snapshot it was moved to, and installs from it until the next scan: the patch service keeps a snapshot answering as it did after a later one exists. The stand-in does that too, but nothing in the script looked. The hosted scenario now reads what the earlier snapshot lists before and after the missing builds are published, and requires the two to be the same and the newer snapshot to be another URL. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A locked platform can lack a patched build in two ways: the patch registry lists upstream's own gem for it, or its build is still being made and no list names it yet. Vendored mode treats both the same (the gem is not vendored, one line, exit 0, nothing written), and the capstone only served the first. Its not-vendored step now runs against both. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The five converted capstones run on every bundler from 2.2 on, of which only 4.0.15 is on the machine they were converted on. Holding a run's warnings to an exact list there would turn a caveat another bundler line adds into a failure of a case that is about something else. They assert what they asserted before: the codes that must not appear, the one a lock with no `CHECKSUMS` section brings, and the refresh note. The cases added for `CHECKSUMS` locks keep the exact lists. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Seen on a terminal with real nokogiri at 80 and 100 columns. A clause wider than the terminal wraps at a word, and the clause after it was then put on a row of its own although the row had room: the "left on its upstream registry" line ended in a row holding one platform name and another holding the last three words. A clause now goes on from where the wrapped one left the row. The one line vendored mode prints for a gem with a platform that has no patched build was not wrapped at all (211 columns for three platforms), where the hosted line of the same gem breaks after a clause. It is wrapped the same way when a person is at the terminal, and stays one line in a pipe. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The real-Bundler capstones of a gem locked as platform builds ended in the VEX matrix written for a gem locked as its ruby gem: one statement under the gem's own patch. `vex` attests such a lock per build, each patched build under that build's patch, so all five capstones failed on a correct document. Their VEX step is a matrix of its own. Over the fresh checkout the real bundler installed, `vex` and `apply --vex` must name each locked build under its own patch, and the ruby-platform entry under the gem's, from exactly the requests the lock's shape calls for: the gem patch's record and one package reference, plus the index of the lock's registry where the lock has no CHECKSUMS to say what it installs. `--offline` attests nothing (`record_unavailable`, no document) and asks nothing, and the pair reverted to its registry version names the patch nowhere. The scan's own `--vex` document is held to the same statements. The file's own `warning_codes` goes, for the one in `common::envelope`: the lint of the `cli` suite allows no private envelope reader. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
No real-Bundler case read the document of a lock the hosted scan moved with one patched build and one the registry passes through to upstream. That is the lock a wrong document over-claims on: the gem is one pin under one patch, and the build that installs upstream's gem must never be attested by it. The case takes the lock the real bundler wrote through the scan, a checkout with nothing installed and a frozen install, with this machine's platform as the patched build and as the one on upstream's gem. Each time the patched build is `not_affected` under its own patch and the other `affected`, with exit 0: the copy on the machine changes what is said of neither. A third run has a lock without CHECKSUMS, where the index of the lock's registry is what says which build is which. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Describe hosted and vendored mode for a gem a Bundler lock names as precompiled platform builds as they are: the list of a version's gems on the gem patch's reference, the registry URL with its snapshot key, the one line and the per-build events, the two quiet cases, per-build VEX, all-or-nothing vendoring from each platform's own patch, and the codes that go with them. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This was referenced Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hosted and vendored mode now patch a gem that
Gemfile.lockpins as precompiled platform gems, with no decision asked of the user. This replaces the platform-gem support of #2150 and #2154 (merged after 5.1.0, not released) with the shape Socket's backend serves today. Agent mode is not touched. It supersedes #2257 and #2226.Why
A native gem such as nokogiri is locked as platform gems (
nokogiri (1.19.3-x86_64-linux-gnu),nokogiri (1.19.3-arm64-darwin)), and a real lock names several platforms at once: linux and macOS, often Windows and JRuby. A patched build exists only for the platforms the patch service can rebuild and prove, and Bundler takes one source per gem. A rule of "every locked platform or nothing" would leave most real projects unpatched.The patch service now gives a gem's patch a registry that serves every platform of the gem version: the patched gem where a patched build exists, and upstream's own gem everywhere else. The package reference says, for each platform, which it is. So the gem always moves, the platforms that can be patched are, and nothing breaks on the others.
What a user sees
Hosted, one line per gem and no warning:
CHECKSUMSline takes the sha256 the registry serves for it.nokogiri 1.19.3: now also patched for arm64-darwin; already patched for x86_64-linux-gnu.nokogiri 1.19.3: no patched build yet for …; left on its upstream registry.bundle lock --add-platform <p>afterwardsVendored mode needs a patched build for every locked platform, because a
path:gem is not fetched. With one, it vendors one tree per platform, each from its own platform's patch. Without, it writes nothing, exits 0 and says which platform is missing and that hosted mode can patch the others now.How it works
"gemBuilds": trueand answers the registry URL and the list of builds: for each platform the sha256 the registry serves and the patch that built it, or none for upstream's gem. There is no per-platform lookup and no index request before writing. Without the list (an older service, or a gem with no platform gems) the patch is a ruby-gem-only patch, as in 5.1.0.…/<uuid>/s/<key>/) that names one fixed list, so the checksums a lock pins stay valid for as long as it names that key. A list with more patched builds has another key, which the next scan takes.appliedevent under its own patch UUID, withdetails.gemFix,details.platformanddetails.newlyPatched. A build that keeps upstream's gem is an event that is not counted, withgem_upstream_build_kept. Rollout budgets and severity floors count the gem as one package.not_affectedunder its own patch; a build on upstream's gem isaffected. Standalonevexattests a build only when the sha256 the lock installs is that patch's, with two small requests per such gem (three for a lock with noCHECKSUMSsection). Vendored mode attests each tree from its ledger, offline.?platform=<p>) are for agent mode. Hosted and vendored mode never select one as a fix of its own.Codes against
main: addedredirect_gem_no_patched_build,redirect_gem_build_pending,gem_upstream_build_kept,vex_gem_build_unknown; none removed;redirect_gem_platform_unsupportednow covers only a reference with no list and Bundler before 2.2;vendor_prebuilt_platform_pendingalso covers a platform on upstream's gem. The retiredgemPlatformsfield and thegem-platform/gem-platform-stub-gemspecartifact kinds are no longer read.CLI_CONTRACT.mdanddocs/ecosystems.mddescribe all of it.Before this is released
Socket's backend also reads a project's
Gemfile.lockto decide what is patched. It must understand a registry URL with a key before a CLI that writes one is released, or it would count upstream's gems under that URL as patched. That change is in progress on the backend and is a condition of the release, not of this merge: nothing here reaches a user until a release is cut.Testing
cargo fmt --all -- --checkandcargo clippy --locked --workspace --all-features -- -D warnings: clean.cargo test --locked -p socket-patch-core --no-fail-fast: 9,374 passed, 0 failed, 3 ignored.cargo test --locked -p socket-patch-cli --no-fail-fast: 5,915 passed, 2 failed, 530 ignored. The two failures are ine2e_vendor_cargo_build, which this branch does not touch (Bad CPU type in executable, an x86_64 toolchain on an arm64 Mac).--ignored:e2e_redirect_gem_build64 passed,e2e_vendor_gem_build13 passed. They cover a lock with one patched and one upstream platform (frozen mode too), no locked build patched, a later list with more patched builds,bundle lock --add-platform, and locks with and without aCHECKSUMSsection.Not run: the nokogiri workflow itself and the
docker-e2esuites (CI runs them), Linux, Bundler 2.2 and 2.6 to 3.x, and anything against the real patch service: no platform gem patch is published yet.🤖 Generated with Claude Code