Repository navigation
Document what socket-patch supports in a Bazel workspace - #2188
Conversation
A Bazel build takes each package from what a ruleset reads in the checkout, in a repository of its own, and not from the copies a package manager installed. The mode by ecosystem matrix at the top of docs/ecosystems.md therefore does not carry over to a project that Bazel builds, and until now the docs had no one place that says what does. Add "Bazel workspaces: what is supported" ahead of the three Bazel sections: one table of ecosystem and ruleset by hosted, vendored, agent and VEX, whose cells say "Supported", "Supported with <one condition>" or "Not supported". - Hosted and vendored cells are the flows of crates/socket-patch-cli/tests/e2e_bazel_build, which build each shape on Bazel 9.3.2, 8.8.2 and 7.7.2 (Maven also on 7.4.0): hosted for all eight ecosystems, vendored for npm, Go and Cargo. - Agent mode is "Not supported" in every row. It is made for installed copies, which a Bazel build does not use, and the support statement is kept simple: hosted or vendored mode for a package that Bazel builds. - VEX is "Supported" where the document is checked against what Bazel builds (npm, PyPI, RubyGems) and "Supported with a hosted (or vendored) patch" where it is right for a patch of that mode and is not checked against the build. Under the table: the Bazel releases, rulesets and call forms each row was tested with, the stale MODULE.bazel.lock after some commands, and a list of known problems, the cases where a command exits 0 today and the next Bazel build fails (vendored PyPI, RubyGems, NuGet and Composer; a Cargo hub without cargo_config or with a cargo-bazel lock; a NuGet tag without nuget_config; a gem that gem_checksums pins; update_pnpm_lock; vendored Go on an old gazelle), each with what to do instead. The VEX section no longer lists agent mode among the Go flows it calls tested, the .bazelignore section says where agent mode stands, and docs/usage.md points from its agent mode section to the table. Two sentences about a vendored gem now say that its build was measured by hand and that no test runs it yet. No code and no test changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ells leave out A review of the new section found statements that were not true of every row, and gaps between it and the VEX section it links to: - "Not supported" and the agent mode paragraph said that the patch does not reach a Bazel build. That depends on the ruleset. They now say what the words mean here: no release promises what a Bazel build holds after the mode ran. The advice names hosted mode, and vendored mode only where the table lists it. - The table's words are the same as the v5 support tiers of the page, where "Not supported" means a refusal. A note says they are the table's own, and that several such cells run, exit 0 and break the build. - "Supported" promised a patched build with no other step. It now names the one exception, a build that may not update Bazel's own lock. - The VEX section named four tested shapes and told readers to publish nothing outside them, while the table called three more supported. The section now names the Cargo, Composer and NuGet flows that hold `vex` to their patched build, and no longer says that nothing else is checked. - The NuGet VEX cell now carries its condition: `vex` attests on a machine whose NuGet folder does not hold the package, and writes no document on the one that ran the scan. - The remedy for a gem that `gem_checksums` pins no longer says that Bundler holds the gem to the lock's CHECKSUMS section when the lock may have none. - The known problems gain the cases where a build passes on the unpatched package (a NuGet scan without a restore, a higher version of a Go module that another Bazel module requires, a `pip.parse` that reads another requirements file) and the access token that a hosted NuGet build prints in Bazel's output, which the NuGet flow records as a known gap. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
PR SummaryLow Risk Overview A new "Bazel workspaces: what is supported" section in Agent mode is documented as not supported for any Bazel-built package, with cross-links from Reviewed by Cursor Bugbot for commit 3fa9af6. Configure here. |
The docs now have one table that says what socket-patch supports for a project that Bazel builds: each ecosystem by hosted, vendored and agent mode and VEX, with agent mode listed as not supported for Bazel builds.
Docs only:
docs/ecosystems.mdand five lines indocs/usage.md. No code and no test changes. Based on main.Why
A Bazel build takes each package from what a ruleset reads in the checkout, in a repository of its own, and not from the copies a package manager installed. So the mode by ecosystem matrix at the top of
docs/ecosystems.mddoes not carry over to such a project. The three Bazel sections the docs already have (Maven,.bazelignore, VEX) each cover one topic in depth, and nothing said in one place which mode works for which ecosystem.What the table says
A new section, "Bazel workspaces: what is supported", ahead of those three. Cells say "Supported", "Supported with " or "Not supported".
go_depsgem_checksumson the callcargo_configon the hubnuget_configon the tagUnder it: what each word means, the paragraph on agent mode, the Bazel releases, rulesets and call forms each row was tested with, a note on the stale
MODULE.bazel.lockthat some commands leave, and a list of known problems.The words are the table's own and the section says so. The page already uses "Supported" and "Not supported" for its v5 support tiers, where "Not supported" means a refusal. Here it means that no release promises what a Bazel build holds after the mode ran, and in several cells the command runs, exits 0 and breaks the build.
Where each cell's proof is
Every "Supported" for hosted and vendored mode is a flow of
crates/socket-patch-cli/tests/e2e_bazel_build, which thebazel-<ecosystem>.ymlworkflows run on Bazel 9.3.2, 8.8.2 and 7.7.2 (Maven also on 7.4.0):npm::hosted_npm_translate_lock,npm::vendored_npm_translate_lockpypi::hosted_pip_parsego::hosted_go_deps,go::vendored_go_depsruby::hosted_bundle_fetch(nogem_checksums, a lock withCHECKSUMS)cargo::hosted_from_cargo_with_config,cargo::vendored_from_cargo_with_confignuget::hosted_from_lockcomposer::hosted_repository_rule,composer::hosted_genrulemaven::a_tree_only_bazel_builds,maven::a_pom_patch_beside_a_pinned_hubThe ruleset releases in the list under the table are the ones the fixtures'
MODULE.bazelfiles pin.VEX:
affectedof a package whose patch Bazel does not build.npm::agent_npm_translate_lockandpypi::vendored_pip_parsehold it to that on real Bazel.affectedof a package whose patch is in no build of Bazel's, and the docs say so and say not to publish it then.vexattests on a machine whose NuGet folder does not hold the package, and writes no document on the machine that ran the scan (nuget::hosted_from_lockasserts both).vexattests the entry inMODULE.bazelafter it has looked at the hub.e2e_bazel_maven_beside.rsholds that without Bazel; no real-Bazel flow asserts a Maven document."Bazel workspaces: VEX" named four tested shapes and told readers to publish no document outside them. It now also names the Cargo, Composer and NuGet flows, so the two sections agree.
Agent mode
Listed as "Not supported" in every row, by a decision of the maintainer on 2026-11-20: agent mode is out of scope for Bazel builds, and the docs are to say so plainly instead of listing the cases one by one. The paragraph says why: agent mode is made for installed copies that
socket-patch applypatches after each install, and a Bazel build takes its packages from what its rulesets read and runs no such step. It names hosted mode, and vendored mode where the table lists it.The paragraph does not say that an agent-mode patch never reaches a Bazel build, because that is not true of every ruleset: it says that this differs from one ruleset to the next and that no release promises it for any.
Three existing passages change so that nothing presents agent mode as a way to patch a Bazel build:
.bazelignore" says that agent mode is not supported for Bazel builds, and that its Go copies get the line all the same, so that they cannot break the workspace.docs/usage.mdpoints to the table.No test is removed:
go::agent_go_depsandcomposer::agent_committed_vendorstay as they are.Known problems
The list names the cases where a command exits 0 today and the next Bazel build fails, each with the message Bazel prints and what to do instead:
cargo_config, and Cargo on a hub with a cargo-bazel lock, which needs a repin;nuget_config;gem_checksumspins;update_pnpm_lock = True;A second list names the cases where a command exits 0 and the build passes on the unpatched package: a hosted NuGet scan on a machine without a restore, a higher version of a patched Go module that another Bazel module requires, and a
pip.parsethat reads the platform's requirements from another file.Three more are neither:
vendor --checkandvexright after a build under rules_rust 0.75.0,vexfor a hosted NuGet patch on the machine that ran the scan, and the access token that a hosted NuGet build prints in Bazel's output. All three are recorded as known gaps incargo.rsandnuget.rsof the flows.Of the build failures, a test of this repository runs the vendored PyPI one (
pypi::vendored_pip_parse). The others were measured by hand on real Bazel, on the releases the text names, and the text says so. Two sentences of the VEX section that said no build of a vendored gem had been run now say that it was measured by hand and that no test runs it yet.Code review
A review of the first commit gave ten findings. All ten held, and the second commit fixes them:
gem_checksumspins promised a check by the lock'sCHECKSUMSsection, which a lock may not have. It now names the condition.vexwrites no document on the machine that ran the scan. Both are now in the lists, and the VEX cell carries the condition.How it was checked
docs/ecosystems.md, and every link fromdocs/usage.mdinto it, names a heading that exists.python3 -B -m unittest discover -s scripts/tests: 422 tests pass, 1 skipped.Not covered
docs/ecosystems.md.🤖 Generated with Claude Code