Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
9bd7d4f
Test PyPI and RubyGems vendored mode beside a Bazel hub on real Bazel
mikolalysenko Nov 23, 2026
9c9f202
Decline PyPI and RubyGems vendored mode where a Bazel hub reads the lock
mikolalysenko Nov 23, 2026
2d652c5
Close three ways a vendored run could still write a file a Bazel hub …
mikolalysenko Nov 23, 2026
9a022a8
Decline a vendored run where a hub reads a parent file or is in doubt
claude Nov 24, 2026
0ad45cb
Test a patched wheel as a download cache of Bazel, written by hand
mikolalysenko Nov 24, 2026
551c946
Vendor a PyPI wheel as a download cache of Bazel where a hub reads th…
mikolalysenko Nov 24, 2026
6005d87
Test a gem committed for a Bazel hub and named by a relative file: URL
mikolalysenko Nov 24, 2026
3cb7610
Vendor a gem for a Bazel hub as its archive, named by a relative file…
mikolalysenko Nov 24, 2026
103352a
Merge the declines' branch into vendored gems for a Bazel hub
mikolalysenko Nov 24, 2026
bf6734b
Merge the decline's branch into the PyPI download cache
mikolalysenko Nov 24, 2026
dd2651e
Close six gaps of a gem vendored for a Bazel hub that a review found
mikolalysenko Nov 24, 2026
c6aa228
Close four ways the PyPI download cache was written where it is not s…
mikolalysenko Nov 24, 2026
eb2ff0a
Expect the reported .bazelrc path without the Windows verbatim prefix
mikolalysenko Nov 24, 2026
b9141ea
Decline a .bazelrc that is not a regular file before probing it
claude Nov 24, 2026
2e0f2d3
Test what vendored mode does for a NuGet package of a rules_csharp hu…
mikolalysenko Nov 20, 2026
3a8f1bd
Decline vendored PyPI where git ignores an untracked .bazelrc
claude Nov 24, 2026
89f7310
Make vendored mode work for a NuGet package of a rules_csharp hub, or…
mikolalysenko Nov 24, 2026
af5dd83
Merge main into vendored mode for a NuGet package of a rules_csharp hub
mikolalysenko Nov 24, 2026
fadf0e9
Keep the block of a rules_csharp hub right through an undo, a later p…
mikolalysenko Nov 24, 2026
ac313c0
Merge remote-tracking branch 'origin/main' into bazel-guard/vendored-…
mikolalysenko Nov 24, 2026
66d9cd1
Merge remote-tracking branch 'origin/main' into bazel-guard/vendored-…
mikolalysenko Nov 24, 2026
5d958bc
Build the NuGet hub tests on Windows
mikolalysenko Nov 24, 2026
dd8d1c4
Merge commit '66d9cd10395bd73a2d4dcc40af4d8f99629d0d7e' into bazel-ve…
mikolalysenko Nov 24, 2026
bcb8af9
Merge commit '66d9cd10395bd73a2d4dcc40af4d8f99629d0d7e' into bazel-ve…
mikolalysenko Nov 24, 2026
23398b6
Accept either unseen repository where a Cargo flow comments out the i…
mikolalysenko Nov 24, 2026
12e2edb
Accept either unseen repository where a Cargo flow comments out the i…
mikolalysenko Nov 24, 2026
ae085da
Accept either unseen repository where a Cargo flow comments out the i…
mikolalysenko Nov 24, 2026
f3e5623
Hold the unseen repository to Bazel's own words, and say so in the docs
mikolalysenko Nov 24, 2026
c5d6d84
Hold the unseen repository to Bazel's own words, and say so in the docs
mikolalysenko Nov 24, 2026
21f3b69
Hold the unseen repository to Bazel's own words, and say so in the docs
mikolalysenko Nov 24, 2026
30cb8cc
Merge main into bazel-vendored/nuget-feed-block
claude Nov 25, 2026
ec60674
Merge remote-tracking branch 'origin/main' into bazel-guard/vendored-…
mikolalysenko Nov 25, 2026
938a43e
Merge commit 'ec60674a1186f30042cc073bab4b8991fbe3050e' into bazel-ve…
mikolalysenko Nov 25, 2026
362885e
Merge commit 'ec60674a1186f30042cc073bab4b8991fbe3050e' into bazel-ve…
mikolalysenko Nov 25, 2026
8d6f447
Merge main into bazel-vendored/nuget-feed-block
claude Nov 25, 2026
4fe3b14
Pass over a WORKSPACE file where the checkout names Bazel 9 or later
mikolalysenko Nov 25, 2026
b84835d
Merge main into vendored mode for a NuGet package of a rules_csharp hub
mikolalysenko Nov 25, 2026
49b963e
Merge remote-tracking branch 'origin/main' into bazel-guard/vendored-…
mikolalysenko Nov 25, 2026
6b67c81
Hold the off switch and the VEX answer to a NuGet package vendored fo…
mikolalysenko Nov 25, 2026
7bf9e3c
Merge commit '49b963e3dcab712b2330d8647a8b16f7c38a04b3' into bazel-ve…
mikolalysenko Nov 25, 2026
de7cc74
Decline a NuGet package for vendored mode where a hub may read the lo…
mikolalysenko Nov 25, 2026
cc616d1
Merge main into vendored mode for a NuGet package of a rules_csharp hub
mikolalysenko Nov 25, 2026
ac0430a
Mark the codes of the gem file source experimental in the contract
mikolalysenko Nov 25, 2026
9a25e86
Merge commit '49b963e3dcab712b2330d8647a8b16f7c38a04b3' into bazel-ve…
mikolalysenko Nov 25, 2026
4dde8a2
Say both ways a hub that is not seen fails after a flat vendored run
mikolalysenko Nov 25, 2026
c8ae9c6
Take the line of a download cache out of .bazelrc with SOCKET_NO_BAZE…
mikolalysenko Nov 25, 2026
bb5cdb2
Merge the PyPI and RubyGems vendored refusals into vendored mode for …
mikolalysenko Nov 25, 2026
af5b810
Merge main into vendored mode for a NuGet package of a rules_csharp hub
mikolalysenko Nov 25, 2026
de3a3e5
Name the checksum an undo leaves in the hub's call with SOCKET_NO_BAZ…
mikolalysenko Nov 25, 2026
003df1f
Merge remote-tracking branch 'origin/main' into bazel-vendored/gem-fi…
mikolalysenko Nov 25, 2026
3e12698
Hold the NuGet vendored gate apart from a WORKSPACE file
mikolalysenko Nov 25, 2026
749b2a3
Merge main into vendored mode for a NuGet package of a rules_csharp hub
mikolalysenko Nov 25, 2026
3599739
Merge main into vendored mode for a NuGet package of a rules_csharp hub
mikolalysenko Nov 25, 2026
ad8a851
Merge commit '003df1f0af472d86a2f8e5a6f9d7374d2eb43b7d' into bazel-ve…
mikolalysenko Nov 25, 2026
45fc418
Merge remote-tracking branch 'origin/bazel-vendored/nuget-feed-block'…
mikolalysenko Nov 25, 2026
d9925fc
Merge main into bazel-vendored/gem-file-source
mikolalysenko Nov 25, 2026
21f526c
Merge commit '45fc41857b1c0da3d2e96c18d921b8d2f17a7ca9' into bazel-ve…
mikolalysenko Nov 25, 2026
5579eb3
Merge commit 'd9925fc568686d1cb1750278e507fc5bca1b3e87' into bazel-ve…
mikolalysenko Nov 25, 2026
20195b1
Merge remote-tracking branch 'origin/main' into bazel-vendored/pypi-d…
mikolalysenko Nov 25, 2026
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
5 changes: 4 additions & 1 deletion .github/workflows/bazel-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ on:
# starts the legs of every ecosystem. `bazel/` also says which lock a
# hub reads, for the refusal of vendored mode beside such a hub
# (vendor/bazel_hub.rs), which vendor/refusals.rs hands to every
# command. Nothing else that
# command, and for the form vendored mode writes where a build takes
# a committed wheel (vendor/pypi_distdir.rs). Nothing else that
# another ecosystem's flow owns is here, so any other change to one
# ecosystem starts that ecosystem's legs only.
#
Expand Down Expand Up @@ -79,6 +80,7 @@ on:
- 'crates/socket-patch-core/src/vendor/pypi_requirements.rs'
- 'crates/socket-patch-core/src/vendor/pypi_wheel.rs'
- 'crates/socket-patch-core/src/vendor/bazel_hub.rs'
- 'crates/socket-patch-core/src/vendor/pypi_distdir.rs'
- 'crates/socket-patch-core/src/vendor/refusals.rs'
- 'crates/socket-patch-core/src/vex/discover/pypi_other.rs'
- 'crates/socket-patch-core/src/bazel/**'
Expand Down Expand Up @@ -116,6 +118,7 @@ on:
- 'crates/socket-patch-core/src/vendor/pypi_requirements.rs'
- 'crates/socket-patch-core/src/vendor/pypi_wheel.rs'
- 'crates/socket-patch-core/src/vendor/bazel_hub.rs'
- 'crates/socket-patch-core/src/vendor/pypi_distdir.rs'
- 'crates/socket-patch-core/src/vendor/refusals.rs'
- 'crates/socket-patch-core/src/vex/discover/pypi_other.rs'
- 'crates/socket-patch-core/src/bazel/**'
Expand Down
14 changes: 8 additions & 6 deletions crates/socket-patch-cli/CLI_CONTRACT.md

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion crates/socket-patch-cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,9 @@ pub struct GlobalArgs {
/// that makes the hub take the copy cannot be shown to work
/// (`vendor_nuget_bazel_workspace`). Pass it when the build does find
/// the copy, does not take the project's packages from that lock, or
/// does not build the project. Without it a gem is committed for a
/// does not build the project. A PyPI package is then written by its
/// path also where vendored mode would commit its wheel as a download
/// cache of Bazel. Without it a gem is committed for a
/// rules_ruby hub as an archive that the hub builds, where that is
/// known to build; with it every gem is vendored by its path. Other
/// subcommands accept it silently.
Expand Down
88 changes: 60 additions & 28 deletions crates/socket-patch-cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,28 @@ pub(crate) fn project_state_in_scope(common: &crate::args::GlobalArgs) -> bool {
/// the project's patched Go module copies, of the vendored crates a crate
/// hub builds, and of the patched Maven jars that vendored mode keeps for a
/// rules_jvm_external hub, so that Bazel and gazelle read no package there
/// (`socket_patch_core::bazel::ignore`). A command that can write or
/// remove such a copy calls this once, after the last step that can change
/// a copy or take one back and before it gives up its apply lock. Nothing
/// is done in a dry run or a `--global` run, and a run whose `--ecosystems`
/// leaves `golang`, `cargo` or `maven` out only takes away that ecosystem's pair of
/// a copy that is gone. So does the prune pass of a scan, which comes here
/// after its scan has (`adds` false) and can only have removed a copy: a
/// file it cannot write is left to the next command's warning.
/// (`socket_patch_core::bazel::ignore`), and the root's `.bazelrc` names
/// the directory of each patched wheel that vendored mode committed as a
/// download cache of Bazel, so that the build takes the wheel from there
/// (`socket_patch_core::vendor::pypi_distdir`). A command that can write
/// or remove such a copy calls this once, after the last step that can
/// change a copy or take one back and before it gives up its apply lock.
/// Nothing is done in a dry run or a `--global` run, and a run whose
/// `--ecosystems` leaves `golang`, `cargo`, `maven` or `pypi` out only takes away
/// that ecosystem's pair of a copy that is gone. So does the prune pass of
/// a scan, which comes here after its scan has (`adds` false) and can only
/// have removed a copy: a file it cannot write is left to the next
/// command's warning.
///
/// A human run is told here that the file changed, or why it could not be;
/// A human run is told here that a file changed, or why it could not be;
/// the result is that warning again, for the command's envelope.
pub(crate) async fn sync_bazelignore(
common: &crate::args::GlobalArgs,
adds: bool,
) -> Vec<crate::json_envelope::RunWarning> {
use socket_patch_core::bazel::ignore;
use socket_patch_core::crawlers::Ecosystem::{Cargo, Golang, Maven};
use socket_patch_core::bazel::{distdir, ignore};
use socket_patch_core::crawlers::Ecosystem::{Cargo, Golang, Maven, Pypi};
use socket_patch_core::vendor::pypi_distdir::sync_bazelrc;
let mut warnings = Vec::new();
if common.dry_run || common.is_global() {
return warnings;
Expand All @@ -87,13 +92,14 @@ pub(crate) async fn sync_bazelignore(
projects.push(common.project_root());
}
let (loud, mut told) = (!common.json && !common.silent, Vec::new());
let [go, cargo, maven] =
[Golang, Cargo, Maven].map(|eco| adds && common.ecosystem_selected(eco));
let [go, cargo, maven, pypi] =
[Golang, Cargo, Maven, Pypi].map(|eco| adds && common.ecosystem_selected(eco));
for project in projects {
match ignore::sync(&project, go, cargo, maven).await {
Ok(Some((file, copies))) if loud => {
// A root that both projects are under is named once for
// each kind of copy whose lines changed there.
// For each file that changed: the line a person is told, and what
// that line is told once by.
let copies = ignore::sync(&project, go, cargo, maven).await;
let copies = copies.map(|changed| {
changed.map(|(file, copies)| {
let (shown, copies) = (file.display(), copies.join(" and "));
let line = match file.exists() {
true => format!(
Expand All @@ -104,21 +110,47 @@ pub(crate) async fn sync_bazelignore(
format!("Removed {shown}: no patched {copies} copy is left under .socket")
}
};
if !told.contains(&line) {
// A root that both projects are under is named once for
// each kind of copy whose lines changed there.
(line.clone(), line)
})
});
let wheels = sync_bazelrc(&project, pypi).await.map(|changed| {
changed.map(|file| {
let shown = file.display();
let line = match file.exists() {
true => format!(
"Updated {shown}: the lines that make Bazel take patched wheels from \
.socket/vendor/pypi"
),
false => format!(
"Removed {shown}: no patched wheel is left under .socket/vendor/pypi for \
Bazel to take"
),
};
// A root that both projects are under is named once.
(shown.to_string(), line)
})
});
let synced = [
(copies, ignore::NOT_UPDATED),
(wheels, distdir::NOT_UPDATED),
];
for (synced, not_updated) in synced {
match synced {
Ok(Some((once, line))) if loud && !told.contains(&once) => {
println!("{line}");
told.push(line);
told.push(once);
}
}
Err(detail) if adds => {
if loud {
eprintln!("Warning: {detail}");
Err(detail) if adds => {
if loud {
eprintln!("Warning: {detail}");
}
let warning = crate::json_envelope::RunWarning::new(not_updated, detail);
warnings.push(warning);
}
warnings.push(crate::json_envelope::RunWarning::new(
ignore::NOT_UPDATED,
detail,
));
_ => {}
}
_ => {}
}
}
warnings
Expand Down
8 changes: 7 additions & 1 deletion crates/socket-patch-cli/src/commands/vex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1964,7 +1964,13 @@ async fn unbuilt_by_bazel(
}
let patched = |purl: &String| {
let record = plan.view.patches.get(purl)?;
let pinned = plan.hosted.contains_key(purl) && !purl.starts_with(MAVEN);
// A wheel committed as a download cache of Bazel is pinned in the
// file the hub reads as a hosted pin is: by its URL and sha256.
let cached = plan.vendor_entries.get(purl);
let cached = cached
.is_some_and(|entry| socket_patch_core::vendor::pypi_distdir::line_of(entry).is_some());
let hosted = plan.hosted.contains_key(purl) && !purl.starts_with(MAVEN);
let pinned = cached || hosted;
let judged = !pinned && !record.vulnerabilities.is_empty();
judged.then(|| Patched {
purl: purl.clone(),
Expand Down
8 changes: 8 additions & 0 deletions crates/socket-patch-cli/tests/e2e_bazel_build/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,14 @@ impl Cell {
Run::of(cmd).unwrap_or_else(|why| panic!("{}: {why}", self.test))
}

/// [`Cell::bazel`] from the directory `dir` of the workspace copy, as a
/// user who works below the root runs it.
pub fn bazel_below(&self, dir: &str, command: &str, args: &[&str]) -> Run {
let mut cmd = self.command("update", command, args);
cmd.current_dir(self.path(dir));
Run::of(cmd).unwrap_or_else(|why| panic!("{}: {why}", self.test))
}

/// `bazel build --lockfile_mode=error <targets>`: passes only when
/// `MODULE.bazel.lock` already holds what the build resolves.
fn frozen_build(&self, targets: &[&str]) -> Run {
Expand Down
Loading
Loading