Repository navigation
fix: vendor hosted patches directly from lockfiles - #1648
Mikola Lysenko (mikolalysenko) wants to merge 6 commits into
Conversation
|
[agent] I ran Question for a human: when As written (
Other findings for the author, not verified in depth:
CI on the current head is green for the draft subset (6 passed, 31 skipped). The full matrix and Bugbot haven't run yet. Generated by Claude Code |
|
[agent] Burn-down agent: I ran Question: when
With (a), manifest patches that have no hosted pin are skipped. The run still exits 0, so a fresh checkout installs those packages unpatched. Projects that use a manifest also hit new refusals: Confirmed failures (local
The review also flags the same takeover expectations in Other review findings to handle once (a) or (b) is chosen:
Generated by Claude Code |
(a) is the correct approach for now. If a user wants to vendor the manifest patches they should do a full scan with vendor mode and apply the edits in the lockfiles. |
A plain `vendor` with a hosted pin in scope now ejects exactly the lockfile's hosted patch, even when `.socket/manifest.json` names another patch for the same purl; vendoring manifest patches takes a full `scan --mode vendored`. The hosted→vendored and A→B→A tests expected the old per-purl takeover onto the manifest's patch. Point the eject at the mock API, serve the granted crate (with the sha512 the artifact download checks), and assert the new contract: the hosted UUID is vendored and attested, the manifest-only UUID is neither vendored, reported nor attested, and the manifest is left byte-identical. The fail-closed test now covers both refusals: `--offline` is refused up front (`offline_eject_unavailable`), and an index that cannot re-resolve the crates.io entry still yields `redirect_revert_failed` with the checkout remedy, nothing touched. Co-Authored-By: Claude <noreply@anthropic.com>
|
Burn-down agent: picked this up now that the product question is answered (17:43 comment: (a), Why CI is red on Reproduced locally on this head:
Next step: rewrite each of these as an eject. Mount the hosted record endpoint for Not labeled; state set to Generated by Claude Code |
With a hosted pin in scope, plain `vendor` ejects the lockfile's hosted patch and ignores `.socket/manifest.json`; the bun hosted→vendored and dry-run tests still expected the manifest's patch (uuid_v) to take over the hosted pin, with the per-purl takeover advisories. Point `vendor_cmd` at the mock API so the eject can fetch the record, expect the hosted uuid to be vendored (detached ledger entry, VEX on the view's CVE), and assert that the manifest-only patch is not previewed, reported or vendored and that the manifest is left byte-identical. The dry run now previews the eject (`eject_planned`) instead of the old `vendor_would_revert_redirect` advisory. Co-Authored-By: Claude <noreply@anthropic.com>
The classic and berry hosted→vendored legs expected plain `vendor` to take over the hosted pin with the staged manifest's patch (UUID_V) and announce `vendor_takeover_reverted_redirect`. With a hosted pin in scope `vendor` now ejects the lockfile's hosted patch and ignores the manifest. Point the vendor runs at the mock API (the eject fetches the record from `patches/view`), expect UUID_H and its CVE in the manifest-less VEX matrices with UUID_V as the never-attested patch, and replace the takeover-advisory check with the eject contract: the manifest-only patch is neither reported nor vendored, and the manifest is not rewritten. Co-Authored-By: Claude <noreply@anthropic.com>
The test staged a manifest naming UUID_V over a hosted go.mod pin and expected plain `vendor` to take the pin over with the manifest's patch. With a hosted pin in scope `vendor` now ejects the lockfile's hosted patch (UUID_H) and ignores the manifest; the run reached the public proxy for the record and failed. Point the run at the mock API, serve the hosted patch's prebuilt module from the artifact-service mock, and expect the go.mod replace to name UUID_H. Assert the manifest-only patch is neither reported nor vendored and the manifest is left byte-identical; the existing upstream-restore checks (no hosted replace, go.sum back to its pre-redirect bytes, no ledger) are unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
The "Takeover reconciliation" contract and the `run_eject` doc comment still described plain `vendor` as a per-purl takeover onto the manifest's patches. With a hosted pin in scope it ejects exactly the lockfile's hosted pins as one planned transition and ignores the manifest; say so, point manifest vendoring at `scan --mode vendored`, and keep the per-purl takeover wording for `scan` / `get --mode vendored` and the no-hosted-pin manifest path. Co-Authored-By: Claude <noreply@anthropic.com>
|
Burn-down agent: following the maintainer's answer (keep (a): vendor only the hosted lockfile pins), I pushed
Generated by Claude Code |
socket-patch vendorcould ignore hosted lockfile pins when an agent manifest existed, and an unrelated Python environment could reject a pinned patch as not installed. Select hosted patches from the lockfiles first, download their prebuilt artifacts into.socket/vendor/, and rewrite the dependency files without requiring installed packages.Reuse the existing lockfile readers and vendoring backend. Hosted conversion skips installed-package discovery and a redundant wiring scan, while reusing the restored-lock preview and failure rollback. Preserve the legacy manifest fallback when no hosted pins are in scope, and update CLI help and documentation.
Validation on current
main(dc0dc755d):cargo clippy --workspace --all-features -- -D warningspassed.cargo fmt --all -- --checkandgit diff --checkpassed.Draft pending
/code-review high, whichAGENTS.mdrequires before marking a PR ready for review. That command is not available in the publishing session.Note
Medium Risk
Changes how
vendorselects patches and sources artifacts for hosted projects; incorrect behavior could mis-wire lockfiles or skip patches, though the change is scoped to vendoring with broad test coverage.Overview
socket-patch vendornow treats hosted lockfile pins as the primary input, even when.socket/manifest.jsonexists or nothing is installed. Hosted conversion runs the eject path: fetch patch records from the API, restore upstream lock metadata for reversal, download prebuilt patched artifacts into.socket/vendor/, and rewire locks—without crawlingnode_modules/site-packages or using the manifest to pick patches.The vendoring engine skips installed-package discovery and per-package hosted takeover during eject (upstream restore already happened in one transaction). Dry-run reuses the takeover backend preview on in-memory restored lock text so refusals like unsupported pnpm catalog entries match wet runs.
--offlineon hosted eject fails up front withoffline_eject_unavailableinstead of per-pinredirect_revert_failed. Manifest-only vendoring remains when no hosted pins are in scope.CLI help,
CLI_CONTRACT.md, anddocs/usage.mddescribe lockfile-first behavior; integration tests cover manifest+hosted coexistence, fresh checkouts, ambient virtualenvs, and updated event codes (eject_plannedvs legacy takeover advisories).Reviewed by Cursor Bugbot for commit 25a3728. Configure here.
Generated by Claude Code