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
8 changes: 4 additions & 4 deletions crates/socket-patch-cli/CLI_CONTRACT.md

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions crates/socket-patch-cli/src/commands/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1088,8 +1088,9 @@ async fn filter_to_installed_purls(
pnp_diags.retain(|diag| maven || diag.code != hub);
if mode != super::scan::ScanMode::Agent {
present.extend(supplement.entries.iter().map(|e| PurlKey::new(&e.purl)));
// A hosted run's supplement also names the gems the lock
// resolves only as precompiled platform builds.
// The supplement also names the gems the lock resolves only
// as precompiled platform builds, and a hosted run's the jars
// of a Bazel workspace's hubs.
present.extend(supplement.purls.iter().cloned());
let vendored =
super::scan::project_vendored_supplement(&ctx, &[], &ctx.loaded().await.vendor)
Expand Down
26 changes: 14 additions & 12 deletions crates/socket-patch-cli/src/commands/scan/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ pub(crate) struct LockfileSupplement {
/// of re-parsing every project lockfile. Empty for global scans.
pub(crate) entries: Vec<LockfileEntry>,
/// The gems the Bundler lock resolves only as precompiled platform
/// builds, as `pkg:gem/<name>@<version>`. `entries` leaves them out,
/// in every mode, and the lock names them all the same: with
/// `entries` they are what the project's lockfiles resolve.
/// builds, as `pkg:gem/<name>@<version>`. `entries` leaves them out
/// and the lock names them all the same: with `entries` they are what
/// the project's lockfiles resolve, and one with no installed copy is
/// in `packages` like any other.
pub(crate) platform_gems: Vec<String>,
/// npm layouts the lockfile inventory REFUSED (Plug'n'Play loaders).
/// Scan surfaces these as refusal warnings: under PnP the installed-tree
Expand All @@ -73,12 +74,15 @@ pub(crate) struct LockfileSupplement {
/// lockfile-only, since there is no crawl to tell whether it is installed.
/// `entries` still holds the full inventory.
///
/// `hosted`: the run is a hosted scan. The inventory leaves out a gem the
/// Bundler lock resolves only as precompiled platform builds (`nokogiri
/// (1.18.10-arm64-darwin)`: no one `.gem` stands for it, so it cannot be
/// vendored from the lock, and an in-place patch needs the installed copy).
/// Hosted mode redirects such a gem to its per-platform prebuilds from the
/// lock alone, so a hosted supplement names it too. It also names the jars
/// The inventory leaves out a gem the Bundler lock resolves only as
/// precompiled platform builds (`nokogiri (1.18.10-arm64-darwin)`: no one
/// `.gem` stands for it). The lock resolves it all the same, and a hosted
/// or vendored run patches it from the lock alone, through the prebuilt
/// patched gem of each locked platform, so the supplement names it too,
/// in every mode: left out, a checkout with nothing installed would never
/// ask about it.
///
/// `hosted`: the run is a hosted scan. Its supplement also names the jars
/// of [`hub_jars`], and what was not read of the hubs joins `unsupported`.
pub(crate) async fn lockfile_supplement(
ctx: &crate::commands::context::ProjectContext<'_>,
Expand Down Expand Up @@ -112,12 +116,10 @@ pub(crate) async fn lockfile_supplement(
if entries.is_empty() && platform_gems.is_empty() && jars.is_empty() {
return out;
}
// Only a hosted supplement names a platform-only gem that has no
// installed copy (see above).
let resolved = entries
.iter()
.map(|entry| entry.purl.as_str())
.chain(platform_gems.iter().filter(|_| hosted).map(String::as_str))
.chain(platform_gems.iter().map(String::as_str))
.chain(jars.iter().map(String::as_str));
(out.packages, out.purls) = lockfile_only_packages(resolved, crawled, only, &common.cwd);
out.entries = entries.clone();
Expand Down
Loading
Loading