Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/nokogiri-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ name: nokogiri patch compatibility
# of each real platform gem; then a frozen install from a fresh checkout,
# `vex` and a byte-identical `rollback`. On JRuby the platform is `java`.
#
# The `vendored` legs run the script's vendored scenario instead: a vendored
# scan of a lock that pins nokogiri as platform gems, against a stand-in for
# the patch service (tests/nokogiri/patch_service.rb) that serves a patched
# build of each real platform gem; then a frozen install from a fresh
# checkout with the service unreachable, `vex` and a `rollback` to the lock
# as it was. On JRuby the platform is `java`.
#
# Every leg downloads gems from rubygems.org, and a rebuild of a precompiled
# install downloads the source gem and `mini_portile2` from it too.
#
Expand All @@ -74,6 +81,11 @@ on:
- 'crates/socket-patch-core/src/patch/redirect/grant.rs'
- 'crates/socket-patch-core/src/patch/redirect/upstream/gem.rs'
- 'crates/socket-patch-cli/src/commands/gem_refresh.rs'
# Vendored mode's gem backend.
- 'crates/socket-patch-core/src/vendor/gem.rs'
- 'crates/socket-patch-core/src/vendor/verify.rs'
- 'crates/socket-patch-core/src/vendor/redownload.rs'
- 'crates/socket-patch-core/src/vendor/service_fetch.rs'
push:
branches: [main]
paths:
Expand Down Expand Up @@ -161,6 +173,16 @@ jobs:
- {os: ubuntu-latest, ruby: '3.1', nokogiri: '1.15.7', install: precompiled, args: '--scenarios hosted', note: hosted}
- {os: macos-latest, ruby: '3.4', nokogiri: '1.18.10', install: precompiled, cli: build, args: '--scenarios hosted', note: hosted}
- {os: ubuntu-latest, ruby: 'jruby-9.4', nokogiri: '1.18.10', install: java, args: '--scenarios hosted', note: hosted}
# Vendored mode on a lock that pins nokogiri as platform gems: the
# scan commits a patched build of each real platform gem, served
# by a stand-in for the patch service, under `.socket/vendor/gem`,
# and a fresh checkout installs from that tree with the lock
# frozen and the service unreachable. On JRuby the platform is
# `java`.
- {os: ubuntu-latest, ruby: '3.4', nokogiri: '1.18.10', install: precompiled, args: '--scenarios vendored', note: vendored}
- {os: ubuntu-latest, ruby: '3.1', nokogiri: '1.15.7', install: precompiled, args: '--scenarios vendored', note: vendored}
- {os: macos-latest, ruby: '3.4', nokogiri: '1.18.10', install: precompiled, cli: build, args: '--scenarios vendored', note: vendored}
- {os: ubuntu-latest, ruby: 'jruby-9.4', nokogiri: '1.18.10', install: java, args: '--scenarios vendored', note: vendored}
needs: static-cli
runs-on: ${{ vars.DISABLE_DEPOT_RUNNERS != 'true' && matrix.os == 'ubuntu-latest' && 'depot-ubuntu-24.04-4' || matrix.os }}
timeout-minutes: 60
Expand Down
10 changes: 6 additions & 4 deletions crates/socket-patch-cli/CLI_CONTRACT.md

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions crates/socket-patch-cli/src/commands/vendor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ use socket_patch_core::vendor::refusals::refusal_is_benign;
/// `vendor_prebuilt_required` failure it always was, a failed `Done` minus
/// the unserved marker (its error already says it).
///
/// One unserved refusal is a skip with nothing to keep as well:
/// [`vendor::VENDOR_PREBUILT_PLATFORM_PENDING`], a gem locked as platform
/// gems whose prebuild for one of the locked platforms the service does
/// not list. A prebuild is listed only once built, so the run cannot tell
/// "not yet" from "never", and the project is exactly as it was.
///
/// [`Discovery::vendor_entry_live`]: socket_patch_core::vex::discover::Discovery::vendor_entry_live
async fn keep_older_vendored_patch(
outcome: Option<VendorOutcome>,
Expand Down Expand Up @@ -191,6 +197,9 @@ async fn keep_older_vendored_patch(
entry,
warnings,
},
None if code == vendor::VENDOR_PREBUILT_PLATFORM_PENDING => {
VendorOutcome::Refused { code, detail }
}
None => VendorOutcome::Refused {
code: vendor::VENDOR_PREBUILT_REQUIRED,
detail,
Expand Down Expand Up @@ -302,6 +311,14 @@ async fn takeover_dry_refusal(
.await;
drop(probe);
match outcome {
// A skip, not a failure, for a takeover in the vendor loop: the
// wet run rolls the restore back, so the hosted pin stays (see
// `keep_older_vendored_patch`). The eject plan refuses it.
Some(VendorOutcome::Refused { code, detail })
if code == vendor::VENDOR_PREBUILT_PLATFORM_PENDING =>
{
Some((code, detail))
}
// A takeover has no older vendored patch to keep in force.
Some(VendorOutcome::Refused { code, detail }) if vendor::is_unserved(code) => {
Some((vendor::VENDOR_PREBUILT_REQUIRED, detail))
Expand Down Expand Up @@ -2097,6 +2114,13 @@ async fn run_eject(
)
.await
{
// An eject has no skip: a pin it cannot vendor stays hosted
// and the eject is refused whole, so a prebuild that is not
// built yet is the plain miss here.
let code = match vendor::is_unserved(code) {
true => vendor::VENDOR_PREBUILT_REQUIRED,
false => code,
};
refused.push((pin.purl.clone(), code, detail));
}
// sbt / scala-cli also require build evidence. The backend treats
Expand Down Expand Up @@ -3795,6 +3819,17 @@ pub(crate) async fn vendor_records_reusing(
)
.await
{
if refusal_is_benign(code) {
// The wet run's skip: nothing is taken over.
if !common.silent && !common.json {
eprintln!("Skipping {}: {detail}", normalize_purl(candidate));
}
env.record(
PatchEvent::new(PatchAction::Skipped, candidate.clone())
.with_reason(code, detail),
);
continue;
}
has_errors = true;
env.record(
PatchEvent::new(PatchAction::Failed, candidate.clone())
Expand Down
Loading
Loading