fix(scan): honor --vendor-source in the vendored flow - #160
Open
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Open
fix(scan): honor --vendor-source in the vendored flow#160Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Conversation
scan --mode vendored hardcoded service=None (build-only), while the vendor command builds a VendorServiceConfig from --vendor-source (default auto = service download). For the same patch the two entry points committed different tarball bytes + lock integrity, so committing a lock made by one then running the other rewrote the integrity with nothing changed (lock churn / merge conflicts). Build the same service config the vendor command builds inside run_scan_vendor_step (respecting --vendor-source / --vendor-url / --patch-server-url, defaulting to auto) and thread it through boxed_vendor_records into vendor_records. scan --mode vendored and vendor now produce byte-identical artifacts by default. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mikola Lysenko (mikolalysenko)
enabled auto-merge (squash)
August 12, 2026 23:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
scan --mode vendored(default) and the standalonevendorcommand default to DIFFERENT vendor-sources, producing DIFFERENT committed bytes / lock integrity for the same patch.crates/socket-patch-cli/src/commands/scan/vendor_flow.rsunconditionally passedservice = Nonetovendor_records(build-only), and--vendor-source(a GLOBAL flag) was parsed but silently ignored by scan.crates/socket-patch-cli/src/commands/vendor.rs:292builds aVendorServiceConfigfrom--vendor-source(defaultauto= service download).Confirmed against real prod (minimist@1.2.2 / patch 80630680):
scan --mode vendoredproduced tarball sha256d5050fe…+ lock integritysha512-N1gyz3…(==vendor --vendor-source build), while plainvendorproduced sha256607e4e3…+sha512-YzCNS0…(==vendor --vendor-source service). Both are deterministic, so committing a lock written by one entry point then running the other rewrites the integrity though nothing changed — lock churn / merge conflicts. (Content installs identically either way.)Fix
Make
scan --mode vendoredbuild the SAMEVendorServiceConfigthevendorcommand does and thread it through the vendored path, defaulting to the same default (auto/service).scan_vendor_service_config(vendor_flow.rs) mirrorsvendor::run's config construction (source from--vendor-source, plus--vendor-url/--patch-server-url/--offline).run_scan_vendor_step(vendor_flow.rs) now builds the run-level client viaget_api_client_with_overridesand passesSome(&service)intoboxed_vendor_records(vendor_flow.rs:646), which forwards it tovendor_recordsinstead of the hardcodedNone. Dry runs short-circuit before this step, so no client is built in preview mode.After the fix,
scan --mode vendoredandvendorproduce byte-identical committed artifacts + lock integrity by default, andscan --mode vendored --vendor-source buildmatchesvendor --vendor-source build.Test
cargo test -p socket-patch-cli --lib service_config_tests— 4 hermetic tests invendor_flow.rsasserting the vendored flow builds its service config FROM--vendor-source(not hardcoded None):default_source_permits_service_like_vendor_command(regression: defaultautomust permit the service, matchingvendor)service_source_requires_service,build_source_never_uses_service,overrides_thread_throughFull
commands::scan::suite: 42 passed.cargo clippy -p socket-patch-cli --libclean.Scope
Touches only
scan/vendor_flow.rs(config construction + threading) and a one-line stale doc comment onvendor_records'serviceparam invendor.rs. No signature changes to the JSON/interactive path ormod.rs, to minimize conflict surface with parallel PRs. The client is rebuilt in the vendored step (mirroringvendor::run) rather than threaded down fromscan::run; a follow-up could thread the already-resolved client to avoid the secondget_api_client_with_overridescall.🤖 Generated with Claude Code
Note
Medium Risk
Changes how vendored artifacts are produced for scan (default shifts from local build to service-capable
auto), which affects committed bytes and lockfiles but aligns scan withvendorand is covered by regression tests.Overview
Fixes a parity bug where
scan --mode vendoredalways vendored build-only (service = None) while the standalonevendorcommand honored--vendor-source(defaultauto, service download). The same patch could therefore produce different tarball hashes and lock integrity, causing lock churn when teams mixed entry points.scan_vendor_service_configmirrorsvendor::run: it assemblesVendorServiceConfigfrom--vendor-source,--vendor-url,--patch-server-url, and--offline.run_scan_vendor_stepresolves the API client viaget_api_client_with_overrides, passesSome(&service)throughboxed_vendor_recordsintovendor_records(dry runs still skip this path). Four hermetic unit tests lock inauto/service/buildand override threading.Reviewed by Cursor Bugbot for commit 8bab316. Configure here.