Skip to content

Commit 56bffb2

Browse files
mikolalysenkoclaude
andcommitted
Fix review findings in NuGet other-version discovery
- Vendored: the feed's single nupkg names the patched version, so it is the only ref, even when no lock entry is at it (keeping the ledger's vendored_claim live); other locked versions are reported in the unattested detail, never as refs pointing at nupkgs that don't exist. - Each ref's other-version check excludes its own version: the detail and file name the lock holding the OTHER version, listed in NuGet precedence (13.0.9 before 13.0.10), and say "also lock" only when the ref's version is locked. - Trim `resolved` before normalizing; an empty one is diagnosed and counts as another version (the writers would refuse it). - The contentHash-conflict diagnostic names the locks and spellings. - Only Socket-mapped ids are indexed; one push_ref helper marks refs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 9c8b7ea commit 56bffb2

2 files changed

Lines changed: 410 additions & 204 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ Discovery is read-only, never touches the network, and never fails the run: a ma
539539
| composer | `composer.lock` (`packages` + `packages-dev`) | `dist.url` on the patch host | `dist: {type: "path", url: ".socket/vendor/composer/<uuid>/…", reference: "<uuid>"}` | `dist.shasum`, required |
540540
| maven | `pom.xml` (+ `.mvn/maven.config`, `.mvn/checksums/checksums.sha256`) | a dependency version `<base>-socket.<hex8>` matching exactly ONE `socket-patch-<uuid>` repository on the patch host | pre-v5 single-POM wiring only: `socket-patch-vendor-<uuid>` repository + exactly one jar under `.socket/vendor/maven/<uuid>/` with a matching `.sha1`. A v5 suffixed pin served from `.socket/vendor/maven2` is no reference here: its ledger entry's wiring check gates it, so without a ledger it is not attested | Trusted Checksums line when enabled; not required (the suffixed version is the pin) |
541541
| gradle (v5.0) | `.socket/gradle/hosted-index.tsv`, the owned hosted script, and every settings script and lock file the script graph reaches | an index row whose repository URL is on the patch host and names the row's uuid, live only while the owned script is intact, every build's settings file applies it with the current index digest, every lock entry of the GA is the suffixed version, no `settings-gradle.lockfile` names the GA and no build script sets a custom `lockFile` (otherwise `patched_ref_invalid`) | none here: a vendored Gradle entry is gated by its ledger entry's wiring check | the suffixed copies installed in the Gradle cache; required (never the lock basis), because the script lets a higher upstream version resolve |
542-
| nuget | the first of `nuget.config` / `NuGet.config` / `NuGet.Config`, + `packages.lock.json` | source `socket-patch-<uuid>` + its exclusive exact-id `<packageSourceMapping>`; version from `packages.lock.json` | the same mapping onto `.socket/vendor/nuget/<uuid>`; version from the lock, else the feed's single nupkg | `contentHash`, required. Lock versions match under `normalize_nuget_version`, as the writers match them (`1.0` and `1.0.0` are one version). When the governed locks also lock the mapped id at a version other than the patched one (another target framework or project), which both writers refuse (`redirect_nuget_lock_other_version`, `vendor_nuget_lock_other_version`), every reference of that source is kept but not attested (`vex_nuget_lock_other_version`). The patched version is the vendored feed's single nupkg; a hosted url names no version, so there any two locked versions qualify. |
542+
| nuget | the first of `nuget.config` / `NuGet.config` / `NuGet.Config`, + `packages.lock.json` | source `socket-patch-<uuid>` + its exclusive exact-id `<packageSourceMapping>`; version from `packages.lock.json` | the same mapping onto `.socket/vendor/nuget/<uuid>`; version from the feed's single nupkg (the patched version), else the lock | `contentHash`, required. Lock versions match under `normalize_nuget_version` of the trimmed `resolved`, as the writers match them (`1.0` and `1.0.0` are one version; an empty one is `patched_ref_invalid`). When the governed locks also lock the mapped id at a version other than the patched one (another target framework or project), which both writers refuse (`redirect_nuget_lock_other_version`, `vendor_nuget_lock_other_version`), the reference is kept but not attested (`vex_nuget_lock_other_version`, naming the other versions and their locks). Vendored, the patched version is the feed's single nupkg: it is the only reference, even when no lock entry is at it, and other locked versions are never references. A hosted url names no version, so each hosted reference is checked against its own version: any two locked versions withhold them all, and a single locked version other than the patch's is gated by the patch record (`record_mismatch`). |
543543
| deno | `deno.lock`'s npm section, only as evidence against an npm-family pin of a `name@version` it also locks, which `vex` then omits (see **Unattested references**, #406); hosted and vendored npm runs warn about such a pin (`redirect_npm_deno_lock` / `vendor_npm_deno_lock`) | — (no hosted mode) | — (no vendored backend) | — |
544544

545545
Recognition rules that hold for every ecosystem:

0 commit comments

Comments
 (0)