Skip to content

Commit 863b2fe

Browse files
committed
Merge main into fix/user-patched-deps-pnpm-yarn-vlt
Resolve args.rs: main's #2025 landed utils::repo_root::ReadScope, the type this PR's user_patches::ReadScope stood in for. Take main's GlobalArgs::read_scope and re-export the shared type from user_patches so its callers keep compiling with one scope type. Co-Authored-By: Claude <noreply@anthropic.com>
2 parents 47491a2 + bb17e0d commit 863b2fe

76 files changed

Lines changed: 4261 additions & 675 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 73 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ a version without a non-empty section in this file.
6262
`=begin`/`=end` blocks, heredoc bodies and `__END__` data are skipped, so
6363
a commented-out dev dependency no longer adds a bogus requirement and a
6464
heredoc no longer refuses the Gemfile (#1932, #1936).
65+
- A gem declared inside nested `source … do` blocks is attributed to the
66+
innermost block, as Bundler reads it, so hosted `rollback` and `remove`
67+
of a pin inside the user's own source block no longer refuse with
68+
`hosted_wiring_contested` on Bundler 2.1 and older (#1997, #1999).
6569
- **npm family.**
6670
- pnpm workspace globs with brace sets and character classes
6771
(`packages/{a,b}`, `packages/[ab]*`) are read the way pnpm reads them in
@@ -88,6 +92,14 @@ a version without a non-empty section in this file.
8892
npm config layer sets `omit-lockfile-registry-resolved`, which makes the
8993
next `npm install` drop the hosted URL and fail with `EINTEGRITY`, and
9094
names where it is set and the remedies (#1871, #1872).
95+
- Hosted vlt scans no longer download every granted patch archive to
96+
check its encoding, and no longer withhold dependencies with
97+
`redirect_vlt_artifact_unverifiable`; a mirror that re-encodes archives
98+
makes `vlt ci` fail closed with `EINTEGRITY`. The in-memory hosted
99+
engine (the Node addon and `hosted-bundle`) now pins vlt dependencies
100+
instead of withholding them as offline (#2013).
101+
- The lock inventory skips Rush subspace locks with unsafe names, as
102+
lockfile discovery already did (#2003).
91103
- **PyPI.**
92104
- A requirements line pinned through an environment variable
93105
(`six==${SIXV}`) is refused by `vendor` with
@@ -106,16 +118,52 @@ a version without a non-empty section in this file.
106118
- A `poetry.lock` in an old format (0, 1.0, 1.1) keeps its "written by
107119
Poetry < 1.4" warnings and refusals even when a hand-merged header claims
108120
a newer Poetry (#1847, #1865).
109-
- **Go.** In a go 1.16 (unpruned) module where a dependency imports a fork
110-
that the root `go.mod` replaces with the patched module, `apply`,
111-
`apply --check`, hosted mode and `vex` read the module graph to tell
112-
whether the patch is really built, instead of reporting it applied while
113-
`go build` linked the unpatched code (#1840, #1843).
114-
- **Maven.** A Maven 4 root that builds its subdirectories implicitly
115-
(model 4.1.0, `pom` packaging, no `<subprojects>`) is treated as a reactor
116-
by hosted mode, `vex` and the Maven cache scope, not only by vendored mode,
117-
so a root-only pin is no longer attested while a module keeps its own
118-
version (#1809, #1886).
121+
- Hosted `rollback`, `remove` and `scan` restore the pins hosted mode
122+
writes into uv 0.2 `[[distribution]]` locks (uv < 0.2.35) instead of
123+
refusing them (#2014).
124+
- **Go.**
125+
- In a go 1.16 (unpruned) module where a dependency imports a fork that
126+
the root `go.mod` replaces with the patched module, `apply`,
127+
`apply --check`, hosted mode and `vex` read the module graph to tell
128+
whether the patch is really built, instead of reporting it applied
129+
while `go build` linked the unpatched code (#1840, #1843).
130+
- `vex` reads the `go.work` that governs the project (`GOWORK`, else the
131+
nearest one at or above it, with members anywhere), as hosted and
132+
vendored modes already did, and no longer attests a Socket replace the
133+
workspace keeps out of the build (`go_workspace_override`) (#2011).
134+
- **JVM.**
135+
- A Maven 4 root that builds its subdirectories implicitly (model 4.1.0,
136+
`pom` packaging, no `<subprojects>`) is treated as a reactor by hosted
137+
mode, `vex` and the Maven cache scope, not only by vendored mode, so a
138+
root-only pin is no longer attested while a module keeps its own
139+
version (#1809, #1886).
140+
- Hosted Maven keeps every line of `.mvn/checksums/checksums.sha256` it
141+
doesn't own (single-space or `*` sha256sum lines, tabs, comments) and
142+
the file's line endings, instead of silently dropping them (#2016).
143+
- Vendored Maven `vex` no longer attests a build that may still use the
144+
unpatched jar: an executable classifier copy of the patched artifact,
145+
or a suffixed version left only in a plugin, profile or unused property,
146+
now withholds attestation (#2006).
147+
- Vendored Gradle withholds attestation when a `gradle.lockfile` locks
148+
the patched artifact at another version
149+
(`gradle_lock_overrides_vendored`) or a custom `lockFile` location is
150+
used (`gradle_custom_lock_file`) (#2004).
151+
- sbt: `vex` no longer attests a hosted pin that a build reassignment of
152+
`dependencyOverrides` or `resolvers`, `sbt.override.build.repos=true`,
153+
or newer resolution evidence shows the build doesn't apply
154+
(`vex_sbt_pin_bypassed`) (#2030), nor a vendored pin without current
155+
sbt resolution evidence or with its vendored tree missing
156+
(`vex_sbt_resolution_unverified`, `vex_sbt_vendored_tree_missing`)
157+
(#2008).
158+
- **NuGet.** When a `packages.lock.json` locks a patched package at a
159+
version the writers refuse to wire (another target framework or
160+
project), `vex` no longer attests that version
161+
(`vex_nuget_lock_other_version`); `1.0` and `1.0.0` count as one version
162+
(#2007).
163+
- **Composer.** A `composer.lock` with a UTF-8 BOM is read everywhere,
164+
and vendor then `--revert` keeps the BOM byte for byte; a revert no
165+
longer deletes a vendored artifact such a lock still installs from
166+
(#2017).
119167
- **Vendoring.**
120168
- Vendored dry runs leave already-vendored patches out of the "Would
121169
download and vendor" headline and list them as skipped, matching the wet
@@ -129,6 +177,17 @@ a version without a non-empty section in this file.
129177
slot (#1976, #1977).
130178
- In a vlt project, `vendor` no longer requests service downloads for
131179
packages it then refuses (#1909, #1947).
180+
- Every vendored entry point (`scan` previews and rollout plans, the
181+
download phase, `get`, and `vendor`) applies the same refusals before
182+
any download: a v1 `package-lock.json` project, or a hosted pnpm pin
183+
whose takeover would be refused, is refused before its patch is
184+
fetched; `get <uuid> --mode vendored` reports every such refusal and
185+
writes nothing; and `vendor` refuses before restoring a hosted pin
186+
instead of restoring it and rolling back. Codes and details are
187+
unchanged (#2015).
188+
- A vendored revert keeps an artifact the lock still references through
189+
an escaped path spelling (`\/` in an older `composer.lock`, Windows
190+
backslashes) instead of deleting it (#2022).
132191
- **General.**
133192
- The nested-project remedy quotes its path for the shell it prints for,
134193
including Windows and `%` (#1859, #1884).
@@ -146,7 +205,10 @@ a version without a non-empty section in this file.
146205
runner, `copy_tree` and apply fixtures; hermetic children scrub color
147206
variables; failing tests are annotated in CI; offline bun.lockb rollback
148207
mock and a Windows venv layout in the PyPI fixture (#1891, #1890, #1905,
149-
#1944, #1955, #1964, #1972, #1978, #1988, #1994).
208+
#1944, #1955, #1964, #1972, #1978, #1988, #1994, #2000); release
209+
workflow artifact steps move off Node 20 actions (#2027). A design doc
210+
and line-count budget plan one lock model for every lockfile reader
211+
(#2001).
150212

151213
## [5.0.1] — 2026-10-13
152214

‎crates/socket-patch-cli/CLI_CONTRACT.md‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,9 @@ are patched by `socket-patch apply` like every other ecosystem:
690690
--check` is a read-only audit of the committed redirect.
691691
The `go.work` in effect is resolved as go resolves it: `GOWORK` naming an absolute file, none under
692692
`GOWORK=off`, else (unset, empty or `auto`) the nearest `go.work` at or above the project; a relative
693-
`GOWORK` is invalid to go, so nothing is written or attested. A `-modfile` in `GOFLAGS` (#1799)
693+
`GOWORK` is invalid to go, so nothing is written or attested. A `go.work` outside the repository
694+
root is never read and refuses the same way (see "Reads bounded to the repository root").
695+
A `-modfile` in `GOFLAGS` (#1799)
694696
that names any file other than the project's `go.mod` (a relative one is taken from the project
695697
directory) makes go build from that file and ignore `go.mod`'s replaces, and in workspace mode go
696698
refuses `-modfile` outright: `apply`, `vendor` and `scan --mode hosted` write nothing
@@ -932,6 +934,19 @@ socket-patch creates `.socket/` and everything under it itself and never writes
932934

933935
Not covered: the agent-mode blob cache and manifest are checked from `.socket` down, so a `.socket` that is itself a link still redirects those writes (deciding that at lock time is deferred).
934936

937+
### Reads bounded to the repository root
938+
939+
**Workspace runs only.** The bound applies to project-scoped runs (the default `--cwd` project). A global run (`--global` / `-g`, or `--global-prefix`, on any command) reads anywhere on the system, so it can scan global `node_modules`, `site-packages`, `~/.m2`, the cargo and Go caches, and their settings wherever they live: nothing in this section applies to it. The mode is fixed once per run from those flags and passed to every bounded read (core `utils::repo_root::ReadScope`: `Workspace` or `Global`; `ReadBoundary::Workspace { root }` or `ReadBoundary::Unbounded`). It is never inferred from the filesystem. Hosted and vendored mode refuse global runs anyway, and VEX discovery and verification do not run in them.
940+
941+
VEX discovery, the lock inventory, hosted mode and vendored mode never read a PROJECT file outside the repository root: the git checkout enclosing the project (the nearest `.git`, by the same rules as the repository lookup), or the project directory itself when there is none. One check (core `utils::repo_root::ReadBoundary`) decides it on the REAL path: every project-file read is checked, an in-tree name included, and a level that resolves outside through `..` or a symlink (a `..` after a link climbs from the link's target, as the OS resolves it) counts as outside. A refused read behaves like a missing file to a reader; a writer refuses with the reason (`… is outside the repository root …; socket-patch does not read project files outside it`). Machine-level tool configuration (the user `~/.npmrc` / `.yarnrc.yml` / `NuGet.Config`, the `GOENV` file, `$CARGO_HOME`, module and package caches) is not a project file and is read as before.
942+
943+
- **Go** (an upward lookup: without a checkout, as before): a `go.work` outside the root (an ancestor's, or one an absolute `GOWORK` names) is only noticed, never read: the workspace is invalid, so vendored and hosted writes refuse with the Go workspace refusal and discovery withholds every Go ref. Inside the root, a `use` member or a `replace` directory outside it reads as missing, so the selection it would decide is unknown.
944+
- **Requirements includes**: a `-r` include outside the root is never read. Discovery and the lock inventory see it as missing; vendored mode refuses `pypi_requirements_outside_root`, since the pins pip installs from it are unknowable.
945+
- **NuGet parent configs** (an upward lookup: without a checkout, as before): a `nuget.config` in a directory above the root is never read. Vendoring refuses (`… also merges <path>, which is outside the repository root …`) and hosted mode skips each NuGet dep with `redirect_nuget_inherited_config_outside_root`, writing nothing for it.
946+
- **Relative and absolute references read through the project view** (yarn `file:` / `portal:` / `link:` copies, include chains, any `../` path a lockfile names) and the hosted upstream restore's staged reads: outside the root they read as missing, and the restore refuses.
947+
- **Upward lookups** (a workspace root or settings file the package manager searches the project's ancestors for): inside a git checkout none reads above the repository root. When one of the files the lookup would read exists above it (a stat, never a read, and never in the home directory or above), the tool may honor it, so writers refuse and readers withhold: a lockless npm-family member or a member's own npm/Bun/vlt lock under a `package.json`, `pnpm-workspace.yaml` or `vlt.json` above (`redirect_workspace_lockfile_elsewhere` in hosted mode, `vendor_lockfile_missing` in vendored mode, unattested in discovery); the nearest `pnpm-workspace.yaml` above (but never one in the home directory or above it) counts as governing (`redirect_pnpm_settings_elsewhere`, `vendor_pnpm_settings_elsewhere`, and a `gitBranchLockfile` that may be on); a uv workspace `pyproject.toml` above (`redirect_workspace_lockfile_elsewhere`, `pypi_uv_workspace_unsupported`) or uv settings above (`pypi_uv_ancestor_settings`; hosted `redirect_uv_project_unsupported` / `redirect_uv_script_unsupported` / `redirect_uv_lock_unsupported`); a `Cargo.toml` above (`cargo_manifest_not_workspace_root`) or a `.cargo/config(.toml)` above (`user_authored_patch_entry` in vendored mode; hosted mode refuses the run with `redirect_cargo_config_outside_root`; agent-mode `apply` and `apply --check` refuse a run with Cargo patches with `cargo_config_outside_root`, naming the file, since it may replace crates.io while apply would patch the registry cache, and the cargo build-cache invalidation warns `cargo_build_cache_stale` that a `build.target-dir` / `build.build-dir` set there was not read); a `.yarnrc.yml` above (its `nodeLinker` reads as unknown, so PnP; no `pnpmStoreFolder` store is admitted; the Berry upstream restore refuses the registry lookup); a yarn classic `.yarnrc` / `.npmrc` above, or a workspace member linked from outside the repository (`redirect_yarn_classic_offline_mirror`, naming the file or member); a `pom.xml`, Gradle settings or `build.sbt` above (`not_build_root`). Gradle settings above are not analysed by the crawler, an `injectEnvironmentFiles` dotenv file outside the repository (other than beside the home rc) injects nothing, a cargo `[patch]` path outside it reads as unknown (`user_authored_patch_entry`), and agent mode's build-cache invalidation stays inside it. Without a git checkout every upward lookup walks on as before.
948+
- **Vendored ownership**: writers, reverters and the GC claim a lockfile reference only when it is root-anchored into THIS project's `.socket/vendor/` (`./.socket/vendor/…`, or `../` from a file below the root back to exactly the root). A sibling checkout's `../.socket/vendor/<eco>/<uuid>/…`, even for the same patch uuid, is never rewritten, reverted or deleted; the revert leaves it with `vendor_lock_entry_drifted` and keeps the artifact. The one exception is pnpm <= 8, which records override specifiers as machine-absolute paths itself: an absolute `…/.socket/vendor/npm/<uuid>/<leaf>` naming the entry's own uuid and leaf is still the entry's.
949+
935950
## Vendor command contract
936951

937952
`vendor` converts the hosted patches pinned in the project's lockfiles into committable

‎crates/socket-patch-cli/src/args.rs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,12 @@ impl GlobalArgs {
447447
self.global || self.global_prefix.is_some()
448448
}
449449

450-
/// The read scope this run's mode fixes: a global run (`--global` /
451-
/// `--global-prefix`) reads anywhere on the system; a project run never
452-
/// reads a project file outside the git repository root. #2025's
453-
/// `GlobalArgs::read_scope` has the same contract.
454-
pub(crate) fn read_scope(&self) -> socket_patch_core::patch::user_patches::ReadScope {
455-
socket_patch_core::patch::user_patches::ReadScope::of_global(self.is_global())
450+
/// The read scope this run's mode fixes for every bounded read: a
451+
/// global run (`--global` / `--global-prefix`) reads anywhere on the
452+
/// system; a project run never reads a project file outside the
453+
/// repository root (see `socket_patch_core::utils::repo_root`).
454+
pub(crate) fn read_scope(&self) -> socket_patch_core::utils::repo_root::ReadScope {
455+
socket_patch_core::utils::repo_root::ReadScope::of_global(self.is_global())
456456
}
457457

458458
/// Whether `--ecosystems` selects `eco` (every ecosystem when unset or

0 commit comments

Comments
 (0)