Skip to content

Hosted and vendored mode: take each platform gem of a fix from its own patch - #2257

Closed
Mikola Lysenko (mikolalysenko) wants to merge 24 commits into
mainfrom
feat/gem-platform-patch-families
Closed

Mikola Lysenko (mikolalysenko) wants to merge 24 commits into
mainfrom
feat/gem-platform-patch-families

Conversation

@mikolalysenko

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

Copy link
Copy Markdown
Collaborator

Hosted and vendored mode now take each platform gem of a fix from that platform's own patch. This converts the platform-gem support of #2150 and #2154 (merged after 5.1.0, not released) to the shape Socket's backend publishes today. Agent mode is not touched.

Why

A native gem such as nokogiri is usually locked as precompiled platform gems (nokogiri (1.19.3-x86_64-linux-gnu), nokogiri (1.19.3-arm64-darwin)), often with no plain nokogiri (1.19.3). #2150 and #2154 moved such a gem by reading per-platform "prebuilds" attached to the ruby-platform gem's patch: gemPlatforms in the registry override and the gem-platform / gem-platform-stub-gemspec artifacts. The patch service no longer sends those. A fix is now published as one patch per platform gem:

  • each platform gem has its own patch, keyed by its qualified purl (pkg:gem/nokogiri@1.19.3?platform=x86_64-linux-gnu), with the same package reference as any gem patch;
  • each package reference says which patch it was built from (rebuiltFromUuid, null for the ruby-platform gem's patch, the source of the fix);
  • the registry of any patch of a fix lists and serves every platform gem of that fix, so one registry URL is a valid Bundler source for the whole lock.

Without this change the support on main reads fields that are never sent, so a platform-locked gem is always skipped.

What changes

Hosted

  • One patch per locked build, by qualified purl. The gem moves only when every build the lock names has a usable patch of one fix. Otherwise nothing is written and redirect_gem_platform_unsupported says which build has no patch, or which builds belong to different fixes: a machine of a platform the registry does not serve could not install the gem.
  • The Bundler source is the registry of the fix's source patch, also when the lock has no ruby entry, so the Gemfile line does not change when platforms are added or removed. Each lock entry and each CHECKSUMS line takes the sha256 of its own platform's patch.
  • When the source patch is not available to the run (not offered to the organisation, for example), the gem still moves: every registry of a fix serves every build of it, so the source is the registry of the first locked build's patch, and the new warning redirect_gem_member_registry says so and that the Gemfile line changes if that platform leaves the lock. The order is: the registry the lock already uses, while it belongs to the fix; else the source patch's; else the first locked build's. A working pair is not rewritten when the source patch turns up later.
  • Before writing, one request to the registry's info/<gem> confirms it lists every locked build with the checksum about to be pinned. If it does not, or cannot be read, the gem is skipped.
  • bundle lock --add-platform <p> afterwards adds the platform from the patch registry by itself; a re-scan then changes nothing and reports both builds.
  • Each build is reported and attested under its own patch UUID. The stale-install guard and the unwind judge and refresh each installed platform copy by its own platform's patch.

Vendored

  • The layout of Vendored mode: vendor gems locked as precompiled platform gems (nokogiri), on MRI and JRuby #2154 stays (one unpacked tree per platform under one directory). Each tree now comes from its own platform's patch (its .gem and its stub gemspec), and the directory is named by the source patch's UUID, so it does not move when platforms change.
  • The ledger records, per platform, the patch UUID and the integrity of what was vendored (gemBuilds). vendor --check, repair and vex check and attest each tree by its own patch.
  • The same rule applies: every locked platform needs a patch of the same fix, or the gem is not vendored (vendor_prebuilt_platform_pending, with the reason per platform). A lock that later gains a platform gets that platform's tree added in place.
  • Without the source patch the gem is vendored through the platform patches alone, and the directory is named by the same order as the hosted source.
  • Events and the JSON summary count one entry per platform gem, each under its own patch UUID, as hosted mode does; details.gemFix ties a gem's events together, and the human lines count the gem as one package in both modes.
  • A gem locked as the ruby-platform source gem with native extensions is still refused, as before.

get <uuid> in hosted or vendored mode takes the whole fix of a gem patch, because one platform's patch alone could never move the gem.

A project that a development build of main already wired

  • Hosted: a re-scan converges the pair (only a CHECKSUMS entry that is not its patch's sha256 changes). While a locked build has no patch the pair is left byte for byte, and the warning names socket-patch rollback as the way back.
  • Vendored: a ledger with the earlier gemPlatforms field still reads, passes vendor --check and can be reverted byte for byte. A run with no platform patches keeps the copy (vendor_gem_builds_kept); a run with a patch for every platform rebuilds it in place.
  • A response that still carries the retired fields parses as the ruby gem's patch alone.

Policy and rollout hold for a fix as a whole: a fix that --min-severity or another filter does not admit is never taken, and a gem that --max-new-patches defers is deferred with every patch of its fix and reported as deferred. When the lookup that says which fix the platform patches belong to fails, the gem is left as it is by that run (gem_fix_unsettled).

Codes: new are vendor_gem_builds_kept (a skipped advisory), redirect_gem_member_registry and gem_fix_unsettled (warnings), and events of a fix carry details.gemFix. None is renamed or removed; the wording of redirect_gem_platform_unsupported, vendor_prebuilt_platform_pending and platform_gem_unsupported changes. CLI_CONTRACT.md and docs/ecosystems.md describe all of it.

Open points for review

  1. Standalone vex on a hosted platform gem attests by the lock's one UUID (the patch whose registry is the source); only the scan's own --vex attests each build by its own patch. A hosted scan commits only Gemfile and Gemfile.lock, and the lock holds each build's sha256 but one UUID, so vex cannot do better from committed state. Two ways to: a lookup from vex (one search and one reference request per such gem, attesting a build by its own patch only when the lock's checksum equals that patch's, and falling back offline), or a small committed record of {purl, platform, uuid, sha256}. Not built; waiting for a decision.
  2. Review. /code-review high reported ten findings on the first version of this branch; all are fixed with tests except two efficiency items left on purpose: the archive fetch still asks for a platform's reference a second time (it is one client call that starts with its own reference request and retry handling; removing the repeat means splitting that call), and the scan and get flows read Gemfile.lock more than once per run.
  3. When the source patch is refused, a run also prints Skipped pkg:gem/<gem>@<version>?platform=ruby: not entitled to this patch beside the new warning.

Testing

  • cargo fmt --all -- --check and cargo clippy --locked --workspace --all-features -- -D warnings: clean.
  • cargo test --locked -p socket-patch-core --no-fail-fast: 9,303 passed, 0 failed, 3 ignored.
  • cargo test --locked -p socket-patch-cli --no-fail-fast: 5,824 passed, 2 failed, 507 ignored. The two failures are in e2e_vendor_cargo_build, which this branch does not touch (Bad CPU type in executable, an x86_64 toolchain on an arm64 Mac).
  • Real Bundler 4.0.15, with --ignored: e2e_redirect_gem_build 56 passed, e2e_vendor_gem_build 13 passed. They cover a complete fix, a missing platform, a lock that gains a platform, a fix without its source patch, and the earlier vendored state.
  • The stand-in patch service of the nokogiri workflow (tests/nokogiri/patch_service.rb) now serves one patch per platform, rebuiltFromUuid and a registry for the whole fix. It ran locally against the final binary: it repacked nokogiri 1.18.10 for two platforms and served hosted and vendored scans, with the whole fix on offer and with the source patch refused.
  • Output was read on a pty at 80, 100 and 120 columns for the hosted and vendored cases above, the no-source case included; four wordings were fixed from that.

Covered by unit or golden tests only, not by a CLI run: a source patch that is not available, a registry index that does not match or cannot be read, a patch of another fix in vendored mode, and a vendored lock that gains a platform.

Not run: the docker-e2e suites, the nokogiri workflow itself (CI runs it), any platform other than an arm64 Mac, and anything against the real patch service: no platform gem patch is published yet.

🤖 Generated with Claude Code

Socket's backend no longer lists a gem patch's platform builds inside the
patch (`registryOverride.identifiers.gemPlatforms`, artifacts of kind
`gem-platform` / `gem-platform-stub-gemspec` with a `platform`). A fix is
now one patch per gem: the ruby gem's patch, and a patch of its own for
each platform gem, with its own uuid, its own record under
`pkg:gem/<name>@<version>?platform=<platform>` and a package reference
like any gem patch's. A platform patch's reference names the patch it was
built from in the new `rebuiltFromUuid`; the fix a patch belongs to is
`rebuiltFromUuid ?? uuid`.

This is the part every mode shares:

* `PackageVendorResult.rebuilt_from_uuid` is read leniently (a wrong type
  never fails the batch), and the retired fields are read past, so a
  response that still carries them parses as the ruby gem's patch alone.
* `hosted::gem_fixes::GemLock` says which patches a run takes for a gem
  the Bundler lock names as platform builds. The per-package ranking picks
  a patch for each purl on its own, and two fixes that tie can come out
  one ahead on one platform and the other on another, while Bundler takes
  a gem from one source. So a run that changes what Bundler installs drops
  the patches of platforms the lock does not name, reads the references of
  the patches on offer for the locked builds (one batched request, none
  for a project with no such gem) and takes ONE fix that covers every
  locked build: the one the project is on unless the first-ranked fix
  supersedes it, else the fix the ruby gem's ranking puts first, else the
  first complete one. `scan` does this between selection and
  classification; `get` does it for the packages it names, and
  `get <uuid>` of one patch of such a gem takes the rest of its fix with
  it, since asking for one platform's patch alone could never move the
  gem.
* The lock is read in every source section for this, so a gem already
  vendored (its platform entries sit in a `PATH` section) still names its
  builds.
* Classification: a hosted or vendored project records one uuid for the
  gem (the registry in its lock, the vendored directory), so the rows of a
  gem's builds are classified together, and the row of a platform gem is
  no upgrade from another build's patch. Only for runs that settle gem
  builds: agent mode and a report-only scan classify every row by its own
  purl, exactly as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Hosted mode pinned every platform entry of a gem to the one patch that
listed a patched gem per platform. With one patch per platform gem there
is no such patch, and Bundler still takes a gem from one source, so the
rewrite has to choose a registry and prove it serves every locked build.

* The engine hands the rewriter one override per patch, tagged with the
  platform of the gem it patches (from the purl's qualifier, never from
  the API's word) and the patch it was built from. The rewriter groups a
  gem version's patches, requires a patch of ONE fix for every build the
  lock names, and wires the registry of that fix's source patch: the
  registry of any member serves the whole fix, and the source's is the
  one URL that stays the same when the lock gains or loses a platform, so
  the Gemfile line never changes because of one. When the lock has no
  ruby-platform entry the source patch's reference is asked for too; it
  only lends its registry and is reported in no event.
* Each lock entry and `CHECKSUMS` line takes the sha256 of its own
  patch's reference. Before writing, the run reads `info/<gem>` of that
  registry (one small request per platform-locked gem, through the mirror
  when one is configured) and moves the gem only when the registry lists
  every locked build with exactly that sha256: a member that was
  withdrawn or is not published yet would otherwise fail `bundle install`
  on its platform.
* Every locked build or nothing, as before: a build with no usable patch,
  builds patched only by different fixes, a source patch that is not
  available, or a registry that does not serve what the lock would pin
  skip the gem with `redirect_gem_platform_unsupported` and no file
  changed. The detail names the locked builds and the case.
* Events, `selectedUuids`, the stale-install guard and the run's `--vex`
  go by each build's own patch: a platform copy is judged, refreshed and
  attested by the patch of its platform. The human summary still counts
  the gem as one package.
* The disk host and the in-memory engine share all of it and stay in
  parity.

A pair an earlier development build wired has every platform entry under
the ruby gem's patch registry, which is today's source patch registry. A
re-scan converges it (only a `CHECKSUMS` entry that is not its patch's
sha256 changes). While a locked build has no patch the pair is left
exactly as it is, and the warning now names the way back:
`socket-patch rollback pkg:gem/<name>@<version>`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Vendored mode unpacked one tree per locked platform from the platform
gems one patch listed. Each platform gem now has a patch of its own, so
each tree comes from that platform's patch (`tarball` and
`gem-stub-gemspec`), and the ledger has to say which.

* The gem is still one vendored unit with main's layout
  (`<name>-<version>/<platform>/`, its `.gitignore` / `.gitattributes`,
  the same lock edit). The unit is led by the fix's source patch, whose
  uuid names the directory and the ledger entry: the directory does not
  move when the lock's platforms change. The platform patches are not
  candidates of their own; a platform patch must state that it was built
  from the lead, so trees of two fixes are never mixed.
* The ledger entry records each tree in `gemBuilds`: platform, that
  platform's patch uuid, the checksums of the gem and gemspec it came
  from, and the patch's record. `vendor --check`, `repair` and `vex` hold
  each tree to its own patch, and `vex` attests each platform gem by its
  own patch uuid.
* Every locked platform or nothing, with the same skip
  (`vendor_prebuilt_platform_pending`): the detail now says per platform
  why it has no patch (none on offer, still being built, not available,
  no stub gemspec, a patch of another fix).
* The download and preview paths look a platform patch up in the entry of
  its fix, so an in-sync re-run asks the patch API and the service for
  nothing, and `vendor --check` no longer reports a platform patch's
  manifest record as unvendored.
* An eject of a hosted pin reads the fix's platform patches from the
  patch API: the lock's pin names the source patch alone.

An entry an earlier development build wrote names the platforms only
(`gemPlatforms`). It is still read, checked against its one patch,
attested and reverted byte for byte. A run with a patch for every locked
platform rebuilds the copy in place and records `gemBuilds`; a run
without them keeps the committed copy while it still matches the ledger
and says so with the new advisory `vendor_gem_builds_kept`.

A gem locked as its ruby-platform source gem with native extensions stays
refused in vendored mode.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The fixtures and stand-in services still answered in the retired shape,
so they could not hold the conversion.

* Golden fixtures: the moved, re-run and missing-platform trees now carry
  one override per patch; a two-fixes tree is new; and the old
  `platform-prebuilds` input and overrides live on unchanged as
  `platform-retired-fields`, whose expectation is now a skip (a response
  that still lists platforms inside one patch is the ruby gem's patch
  alone). Both hosted engines run every one of them.
* The stand-in patch service of the nokogiri workflow and the mocks of
  the CLI suites serve one patch per gem, `rebuiltFromUuid`, and a
  registry per patch that lists the whole fix.
* New cases: a platform patch whose reference is `pending_build` or
  `withdrawn`; `get` by the source patch, by a platform patch and by
  package; a pair that is already moved converging, and being kept with
  the way back named once a build loses its patch.
* Real Bundler: the hosted capstones assert one pin per locked build
  under its own patch; a new one has `bundle lock --add-platform` add a
  platform from the patch registry with the Gemfile untouched; the
  vendored capstone holds the per-platform ledger record and VEX, and
  walks a project an earlier development build left through check, a
  kept re-run, VEX, revert, rollback and the conversion to the
  per-platform record. Its takeover arms cover both `get <uuid>` and a
  scan.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The CLI contract and the ecosystem guide described a patch that lists a
patched gem per platform. They now describe what the modes do with a fix
that is one patch per platform gem: which registry a platform-locked gem
is wired to and why its Gemfile line does not change with the lock's
platforms, the registry check before a write, how each build is reported
and attested, when the gem is skipped and what the warning names, the
vendored unit and its `gemBuilds` ledger record, the new
`vendor_gem_builds_kept` advisory, and what becomes of a project wired in
the earlier shape.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Main gained the package products of VEX statements, the cause of a failed
apply in telemetry and events, and the vendored-mode decline where a Bazel
hub reads the lock. Two rows of the documentation conflicted: the gem row
of the CLI contract's vendor table and the RubyGems row of the ecosystem
guide's support table. Each takes main's row with this branch's wording
for platform gems (one patch per platform gem) applied to it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Two checks of the full core suite that the targeted runs did not reach:

* Production code tells a purl's ecosystem through `Ecosystem::from_purl`,
  never an inline `starts_with("pkg:gem/")`; the two new gem checks in
  the classification and the vendor ledger now do.
* The lockfile-discovery golden lists every fixture project by path. The
  platform gem fixtures were renamed and two were added, so their entries
  follow. What discovery reads from each tree is unchanged: one hosted
  pin of the gem for a moved pair, nothing for an unmoved one.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…graph

The eject of a hosted pin (`vendor`) and `get` both ask which other
patches belong to a gem's fix. The helper sat in `agent_download`, which
gave `vendor` an import of it and closed a cycle between command modules
(`agent_download -> rollback -> vendor -> agent_download`), which the
layering test forbids. The two lookups use nothing but core types, so
they move beside `GemLock` in core: `hosted::gem_fixes::fix_siblings`
and `hosted::gem_fixes::settle`. No behaviour changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…urce patch is unavailable

A gem locked as platform builds was skipped when the fix's source patch
(the ruby gem's) was not available to the run, although every locked build
had a usable patch: the source patch's registry was the only one the
rewrite would name. The registry of any patch of a fix lists and serves
every gem of that fix, so the gem can move all the same.

The registry the gem takes as its source is now chosen in this order:

1. the registry the lock already takes the gem from, when it belongs to
   the fix's source patch or to the patch of a build the lock still
   names. A pair that works is not rewritten for another URL of the same
   fix, so a gem moved while the source patch was unavailable stays where
   it is when that patch turns up;
2. the source patch's registry, where the run has it: the one URL that is
   the same whichever platforms the lock names;
3. the registry of the first locked build's patch (platforms in the
   lock's own sorted order).

The index check runs against whichever registry was chosen. When the
choice is a build's registry because the source patch is not available,
the run says so with the new warning `redirect_gem_member_registry`,
naming the platform, both patches, and that the Gemfile's `source:`
changes if that platform leaves the lock. If it does leave, the next run
re-anchors by the same order.

The rewrite now reports, for each pinned build, the patch whose registry
the lock names (`RewriteResult::gem_anchor_uuids`), and the engine's pin
attribution and the run's VEX go by that instead of assuming the source
patch. The engine asks the rewriter which index documents to read, so the
two cannot choose differently.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ource patch

Two changes to how vendored mode handles a gem the lock pins as platform
gems. They meet in the same functions, so they come together.

Events. Hosted mode reports one counted event per locked build, each under
that build's own patch. Vendored mode reported one counted event for the
patch the gem was vendored through and listed the platform patches as
uncounted copies of it, so `summary` meant something different in the two
modes. Vendored mode now reports like hosted: the outcome of the gem
(applied, already vendored, skipped, failed) is one counted event per
platform gem under its own patch, and the patch the directory is named
after has no event of its own unless no platform gem has a patch.
`details.gemFix` ties a gem's events together, which is how the human
lines and the vendored-count telemetry still count the gem as one
package. `vendor --check` reports its verdict the same way.

No source patch. With the ruby gem's patch not among the run's records
the platform patches were left as ordinary candidates and each failed
with `platform_gem_unsupported`. The gem is now vendored through the
patch of one locked platform, by the same rule as the hosted registry:
the patch the ledger says the gem is vendored through while it is still
one of them (a copy that works is not moved), else the ruby gem's patch,
else the patch of the first locked platform. That patch names the
directory and the ledger entry; each tree still comes from its own
platform's patch, and every platform must name the same fix as the lead.
A platform's patch by itself is still refused.

The platform references are also asked together, a few at a time,
instead of one after another.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The vendored baseline check compared every selected patch with the one
copy installed on the machine. A lock that names several platform gems
has a patch for each, and only one of them is installed: on an
x86_64-linux-gnu machine the aarch64-linux-gnu patch's `beforeHash` of
the gem's binary was held against the x86_64 file, and `scan --mode
vendored` reported a modified baseline for a gem nobody had touched.

A platform gem's patch is now compared only with a copy installed as that
platform's gem. The ruby gem's patch, and every other ecosystem, are
compared as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A fix for a gem locked as platform builds is several patches that move
together. Review found five places where one of them was judged alone.

Policy filters. `GemLock::choose` picked among every offer the tier
filter let through, so a gem `--min-severity` (or `minSeverity`) had left
out was picked back in and pinned or vendored while the policy report
said it was filtered. `Offers` now names the offers no filter admits
(`refused`: below the severity floor, or withheld) and `choose` takes
only the rest, with the filter's own winner for a purl ahead of the
ranking, so its preference for a smaller patch holds too.

Rollout. With `--max-new-patches` spent, the builds' rows were deferred
and dropped while the source patch, which has no row, stayed: the second
rewrite saw the source alone and warned that no patch was available for
the locked builds. A deferred build now takes every patch of its gem
version with it (`engine::drop_deferred`), in both hosted engines.

Classification. A platform build's row was called already in place
whenever any other uuid was recorded for the gem, also when the run was
about to move the gem to another fix. A row is now in place only when
what the run takes for the build is of the recorded fix: `choose`
classifies every locked build of a gem that has something recorded,
whether or not a fix was settled, and `mark_pinned` compares fixes
(`engine::gem_fixes_of`) instead of assuming. Without that knowledge a
row is a move, never an assumed match.

One decision. The fix was chosen in `choose` and again, by a simpler
rule, in the rewriter. When the request that says which fix each patch
belongs to failed, only the rewriter decided, from a selection ranked
purl by purl, and could move a project to a fix `choose` would have
left alone. Such a run now leaves those gems out of the selection and
says so (`gem_fix_unsettled`), in `scan`, `get` and the in-memory
engine: the fix is settled once or not written at all.

`get`. The selection was echoed, and the merged-patch note computed,
before it was settled. It is settled first.

Also: the eject's lookups run together over one read of the lock, and
the helpers that existed twice (`gem_patch_sha256`, the platform
qualifier parse, `sort_by_purl`) exist once.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ew warnings

The CLI contract and the ecosystem guide now say what vendored mode
reports for a gem pinned as platform gems (one counted event per platform
gem, tied by `details.gemFix`), which registry a platform-locked gem
takes when the fix's source patch is not available and what
`redirect_gem_member_registry` says about it, which patch a vendored gem
is led by in that case, that a deferred build defers its fix whole, and
what `gem_fix_unsettled` means.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The human printer capitalises a warning's first letter, which turned
`nokogiri 1.18.10 takes ...` into `Nokogiri 1.18.10 takes ...`. The
detail now opens the way the gem's other warnings do, with the lock:
`Gemfile.lock takes nokogiri 1.18.10 from the patch registry of ...`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A CLI-level case for the deferral: with `--max-new-patches 0` a gem
locked as platform builds is written nowhere, its builds are reported as
deferred, and the run gives no platform warning for it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A gem that takes the registry of one build's patch (its fix's source
patch was not available when it was moved) records that build's patch
for the gem. On the next scan the fix's source patch, selected only to
lend its registry, was compared with that record by its own purl and
announced as a newer patch (`updates[]`, "1 package has a newer patch
available") although the gem was on that very fix and nothing was
rewritten.

The source patch's row is now judged like a build's: in place when it is
of the recorded fix, a move otherwise. Found on a terminal run against
the stand-in service; held by the selection test and by the CLI test of
the member registry, whose re-scans now name the patch server so the
loopback pin is read as the hosted pin it is.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The selection test for a gem already on a fix counted two classified
rows, the two builds. The source patch that lends its registry is
classified with them since the previous commit, so there are three.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`get` in hosted mode settles a platform-locked gem's fix before it prints
its selection or computes the merged-patch note. This holds it at the
command: two fixes cover every locked build, and the per-purl ranking
takes one fix for the ruby gem and one platform and the other fix for the
second platform. The run uses the first fix for every build, so the
`Selected:` echo must show that fix's patch for the second platform, and
the merged-patch note (and the `merged_patch_pending` warning of
`--json`) must name what that selection leaves. Computed from the
ranking's mix, the note would find nothing that every build leaves and
say nothing.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A gem vendored as platform gems is reported once per platform gem, each
under its own patch: the vendor loop rewrites the event of the unit's
lead into one event per platform. It found that event as the first one
at or after a mark with the candidate's purl, and the mark was taken
before a hosted pin's takeover settles. A takeover that stands records
its own advisory for the same purl first
(`vendor_takeover_reverted_redirect`), so that advisory was the one
copied per platform: `summary.skipped` grew by one per extra platform,
and the real `applied` event stayed under the lead's purl with no
`gemFix`.

The mark is now taken right before the outcome's event is recorded, and
only that event is rewritten.

The real-Bundler capstone asserts it on its hosted-to-vendored
takeover: one `applied` event per platform gem under that gem's patch,
and the takeover advisory once.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
For a gem the Bundler lock names as platform builds, the project records
one uuid for every build: the registry in its lock, or the directory it
is vendored under. Which fix that is was read only from the offers the
run may take, so two cases went wrong.

The recorded patch is no longer on offer. A gem moved to the registry
of a build's own patch, whose platform has since left the lock, records
a patch that no locked build offers any more. The fix it belongs to was
then unknown, the project was not seen as being on it, and a tying fix
that happened to rank first took the gem over. The recorded uuids are
now asked about with the offers, and the fix is what the recorded
patch's own reference names.

A raised severity floor. The policy keeps the one recorded patch
selected and refuses the patches of the builds, so the writers received
a fix with no patch for the locked builds and skipped the gem with
`redirect_gem_platform_unsupported` on every scan. A recorded fix is
now kept whole: where no filter admits a fix for every locked build,
the recorded fix's patch for each of them stays selected, refused or
not, with its source patch. Nothing recorded, nothing kept: the filter
holds for a gem the project has no patch of.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A pin found by the second discovery pass names one patch for every
build of a gem. A build's row was already judged by its fix; the row of
the fix's source patch was not, so against a lock that names the
registry of a build's own patch (a gem moved while the source patch was
not available) the source patch of that same fix was reported as a
newer patch. Every row of a gem is now judged by its fix. The two
helpers this left without a caller are removed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A gem vendored through the patch of a platform gem takes its fix from
what that patch's reference names. While that one reference was not
ready (its gem still being built), no fix was known, and every other
platform, though ready, was reported as belonging to another fix. The
fix is then what the first ready platform names, each platform is
judged by it, and the skip names the one platform that is not ready.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Two things about the registry a gem locked as platform builds takes.

Which registry the lock is on. A gem stays on the registry it is on
while that patch is still one of the fix's. The rule looked for a
remote whose last path segment is the patch uuid, so a registry at an
address of another shape was never recognised and the gem was rewritten
for another URL of the same fix. It now reads the patch's own registry
URL, as the manifest wiring does, with the grant token the one
wildcard, and asks nothing of the URL's shape. The check of a lock an
earlier run moved had the related flaw: built on the URL without its
closing slash, its pattern never made the patch uuid a wildcard, so a
lock on the registry of a patch that is no longer among the run's was
not known as hosted.

Which registry is read. The index lookup that precedes the rewrite
copied the rewriter's grouping and decided the registry a second time;
had the two ever disagreed, the rewriter found no document for the
registry it chose and pinned the gem unchecked. Both now use one
grouping and one decision, and a caller that reads registries hands its
documents in every time (also when it has none), so that a gem whose
registry it holds no document for is skipped with
`redirect_gem_platform_unsupported`, never pinned. The rewrite by
itself, with no caller that reads registries, is unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

Superseded by #2273, which reaches the same goal with a simpler model: one request per gem, and a locked platform with no patched build keeps upstream's gem, so nothing is skipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant