Skip to content

Use the published patch for each locked Ruby platform - #2422

Merged
Mikola Lysenko (mikolalysenko) merged 9 commits into
mainfrom
fix/certified-gem-registry
Dec 2, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 9 commits into
mainfrom
fix/certified-gem-registry

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Bundler can lock several platform gems for one dependency. Hosted and vendored scans now require a patch for each locked build from the same fix before changing its source. Each build has its own patch record, archive and SHA-256.

Standalone hosted VEX resolves the registry URL to the patch for each locked platform and checks the compact-index digest against its package reference and the checksum in the lock when present. An unresolved platform suppresses attestation for the gem. Vendored installs retain their per-platform patch records for offline verification.

The Nokogiri compatibility test exercises frozen installation in a fresh checkout, native extension loading, VEX patch identity and rollback. This also updates the previous platform selection work in #2257 for current main.

High-effort review found two additional cases. Ejecting from a platform member now preserves that member's identity, and a complete set of platform patches can be vendored when the only offered Ruby source belongs to another fix. Both cases have regression coverage.

Local validation passed all 80 Nokogiri checks on macOS arm64 using Ruby 3.4.10 and Bundler 4.0.15. A fresh checkout installed with the lock frozen, including after ejecting a platform member. The test checked platform-specific VEX identities, loaded native code and verified rollback. The workspace also passed the all-features Cargo check.

All 56 hosted Ruby installer integration cases also passed locally. The platform fixture now requires the exact set of per-platform VEX identities for both standalone and embedded VEX. A mismatched checksum on one locked platform suppresses attestation even with installed-file verification disabled.

After merging current main, 693 Ruby-related core tests, 56 hosted Bundler integration tests and 14 vendored installer tests passed. For a Ruby-only lock the manifest and lock must agree on the source. For a multiplatform lock the confirmed set contains only the builds that the lock actually selects.

Use the platform builds published for one fix across hosted and vendored
installs. Match standalone hosted VEX to the locked builds and their
registry checksums. Cover fresh frozen installs and rollback in Bundler.
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review December 1, 2026 20:18
@cursor

cursor Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

PR Summary

High Risk
Changes core gem hosted/vendored redirect, ledger, VEX, and Bundler lock semantics for platform gems—incorrect fix selection could break frozen installs or partial patching.

Overview
Ruby platform gems (e.g. nokogiri) now patch as a “fix”: one patch per locked platform build, linked by rebuiltFromUuid to the ruby-platform source patch, instead of a single grant carrying gemPlatforms prebuilds.

Hosted and vendored flows GemLock to narrow selection to every build Gemfile.lock names, require one fix covering all of them, and in get/scan/vendored download expand selection to sibling platform patches. Before redirect, hosted mode fetches each fix registry index to confirm listed builds match lock checksums. Wiring uses the source patch’s registry URL (with redirect_gem_member_registry when only a platform patch is available). VEX and summaries treat multiple platform uuids as one package via anchor uuids; stale install refresh judges/archives each build by that platform’s patch SHA.

Vendored mode records gemBuilds per platform under the fix’s lead uuid; policy retains whole fixes; new skips include gem_fix_unsettled and vendor_gem_builds_kept. Agent discovery compares platform patch records only to the matching installed leaf (gem_patch_is_of_copy). sort_by_purl moves to socket-patch-core; CI/docs/contracts reflect the new model.

Reviewed by Cursor Bugbot for commit 3d8f0bb. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can 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 3d8f0bb. Configure here.

…istry

# Conflicts:
#	crates/socket-patch-cli/tests/e2e_redirect_gem_build.rs
#	crates/socket-patch-core/src/patch/redirect/mod.rs
#	crates/socket-patch-core/src/vendor/gem.rs
@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Dec 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Dec 1, 2026
No textual conflict. A test main gained with the multi-release jar check
builds vex_sources::Sources field by field, and this branch adds the
hosted_gem_fixes field, so the merged tree did not compile and the merge
queue dropped the PR. The test's initializer gets the new field, empty.

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

Copy link
Copy Markdown
Collaborator Author

[agent] The merge queue dropped this PR at 23:42Z: the merged tree did not compile (error[E0063]: missing field hosted_gem_fixes in initializer of vex_sources::Sources, in e2e-build and windows-compile-check). A test that reached main today with the multi-release jar check (#2411) builds Sources field by field, and this branch adds a field to it.

Pushed 81cbe16d6: main merged in (no textual conflict) with the new field added, empty, to that one test. On the merged tree cargo fmt --check, cargo clippy --workspace --all-features -- -D warnings and cargo check --workspace --all-targets --all-features are clean, and the 22 vex_sources tests pass. The PR goes back into the queue once its checks pass on that commit.


Generated by Claude Code

@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 0a1709b Dec 2, 2026
115 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the fix/certified-gem-registry branch December 2, 2026 00:24
Mikola Lysenko (mikolalysenko) added a commit that referenced this pull request Dec 2, 2026
Add entries for the 64 changes merged since the first draft, replace the
platform-gem entry with what main does since #2422, fold fixes for bugs
that never shipped into the entries of their features, and state the
release's known limitations (platform-locked gems, PDM, Yarn Plug'n'Play)
at the top of the section.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.

3 participants