Skip to content

Document what socket-patch supports in a Bazel workspace - #2188

Merged
Mikola Lysenko (mikolalysenko) merged 2 commits into
mainfrom
docs/bazel-support-table
Nov 20, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 2 commits into
mainfrom
docs/bazel-support-table

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

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.md and five lines in docs/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.md does 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".

Ecosystem and ruleset Hosted Vendored Agent VEX
npm, aspect_rules_js Supported Supported Not supported Supported
PyPI, rules_python Supported Not supported Not supported Supported
Go, gazelle go_deps Supported Supported Not supported Supported with a hosted or vendored patch
RubyGems, rules_ruby Supported with no gem_checksums on the call Not supported Not supported Supported
Cargo, rules_rust Supported with cargo_config on the hub Supported Not supported Supported with a hosted or vendored patch
NuGet, rules_csharp Supported with nuget_config on the tag Not supported Not supported Supported with no restored copy on the machine
Composer, a rule of the project's own Supported Not supported Not supported Supported with a hosted patch
Maven, rules_jvm_external Supported with Bazel 7.4.0 or later Not supported Not supported Supported with a hosted patch

Under 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.lock that 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 the bazel-<ecosystem>.yml workflows run on Bazel 9.3.2, 8.8.2 and 7.7.2 (Maven also on 7.4.0):

Cell Flow
npm hosted, vendored npm::hosted_npm_translate_lock, npm::vendored_npm_translate_lock
PyPI hosted pypi::hosted_pip_parse
Go hosted, vendored go::hosted_go_deps, go::vendored_go_deps
RubyGems hosted ruby::hosted_bundle_fetch (no gem_checksums, a lock with CHECKSUMS)
Cargo hosted, vendored cargo::hosted_from_cargo_with_config, cargo::vendored_from_cargo_with_config
NuGet hosted nuget::hosted_from_lock
Composer hosted composer::hosted_repository_rule, composer::hosted_genrule
Maven hosted maven::a_tree_only_bazel_builds, maven::a_pom_patch_beside_a_pinned_hub

The ruleset releases in the list under the table are the ones the fixtures' MODULE.bazel files pin.

VEX:

  • "Supported" for npm, PyPI and RubyGems is what "Bazel workspaces: VEX" already documents: the document says affected of a package whose patch Bazel does not build. npm::agent_npm_translate_lock and pypi::vendored_pip_parse hold it to that on real Bazel.
  • "Supported with a hosted (or vendored) patch" is what the flows above assert of the document after their patched build. For these ecosystems the document does not say affected of a package whose patch is in no build of Bazel's, and the docs say so and say not to publish it then.
  • NuGet's cell names its own condition: vex attests 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_lock asserts both).
  • For Maven the cell restates the Maven section: vex attests the entry in MODULE.bazel after it has looked at the hub. e2e_bazel_maven_beside.rs holds 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 apply patches 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:

  • "Bazel workspaces: VEX" no longer lists agent mode among the Go flows it calls tested. What VEX reports for an installed copy is unchanged.
  • "Bazel workspaces: .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.
  • The agent mode section of docs/usage.md points to the table.

No test is removed: go::agent_go_deps and composer::agent_committed_vendor stay 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:

  • vendored mode for PyPI, RubyGems, NuGet and Composer;
  • hosted Cargo on a hub without cargo_config, and Cargo on a hub with a cargo-bazel lock, which needs a repin;
  • hosted NuGet on a tag without nuget_config;
  • a hosted gem that gem_checksums pins;
  • npm on a hub with update_pnpm_lock = True;
  • vendored Go with gazelle 0.36.0 or older.

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.parse that reads the platform's requirements from another file.

Three more are neither: vendor --check and vex right after a build under rules_rust 0.75.0, vex for 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 in cargo.rs and nuget.rs of 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:

  1. "Not supported" and the agent paragraph stated that the patch does not reach a Bazel build, which is not true of every ruleset. Reworded as above.
  2. The table's VEX column and the VEX section disagreed on what is tested. The section now names the three other flows and no longer says that nothing else is checked.
  3. The table's words clashed with the page's v5 tiers. A note says they are the table's own.
  4. The remedy for a gem that gem_checksums pins promised a check by the lock's CHECKSUMS section, which a lock may not have. It now names the condition.
  5. The advice "use hosted or vendored mode" named a mode the table lists as not supported for five ecosystems. It names hosted mode first.
  6. The access token in a hosted NuGet build's output was missing from the known problems.
  7. A hosted NuGet scan finds no package on a machine without a restore, and vex writes no document on the machine that ran the scan. Both are now in the lists, and the VEX cell carries the condition.
  8. "Supported" promised a patched build with no other step. It now names the frozen-lock exception.
  9. The shared VEX wording said the document is not checked against the build, which is wrong for Maven. The wording now says what the document leaves out, and points to the Maven section.
  10. The cases where a build passes on the unpatched package were missing. They have a list of their own.

How it was checked

  • Every in-page link of docs/ecosystems.md, and every link from docs/usage.md into it, names a heading that exists.
  • python3 -B -m unittest discover -s scripts/tests: 422 tests pass, 1 skipped.
  • The repository has no docs or link check of its own to run. The pages were not rendered.

Not covered

  • Rulesets, releases and call forms beyond the ones the list names. The section says they are not tested.
  • Windows. Linux and macOS are what the workflows run.
  • The README is not changed; its support sentence still points to docs/ecosystems.md.

🤖 Generated with Claude Code

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>
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review November 20, 2026 17:37
@cursor

cursor Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Documentation-only changes with no runtime or build behavior impact.

Overview
Adds Bazel-specific guidance so the general mode×ecosystem matrix no longer applies when Bazel builds the packages.

A new "Bazel workspaces: what is supported" section in ecosystems.md replaces that matrix for Bazel projects: per-ecosystem/ruleset support for hosted, vendored, agent, and VEX, plus definitions of those labels, tested Bazel/ruleset versions, MODULE.bazel.lock staleness, and long known-problems lists (silent exit 0 followed by broken builds, builds that stay unpatched, and VEX/check gaps).

Agent mode is documented as not supported for any Bazel-built package, with cross-links from usage.md, .bazelignore (still ignores agent copies), and Bazel VEX (tested flows drop agent for Go; more ecosystems called out as tested or hand-measured).

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

@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Nov 20, 2026
Merged via the queue into main with commit 956d9bf Nov 20, 2026
83 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the docs/bazel-support-table branch November 20, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants