Repository navigation
Fix vendored dry-run counting in-sync patches (#1850) - #1856
Mikola Lysenko (mikolalysenko) wants to merge 3 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
`scan --mode vendored --dry-run` and `get --mode vendored --dry-run`
told users they "Would download and vendor N patches" even when every
patch was already vendored, while the same preview's JSON and the wet
run both said there was nothing to do.
The human headline now leaves out patches the vendor ledger already
holds at this uuid ("Would download and vendor 0 of 1 patch (1 already
vendored)"), and each one gets the wet run's
"[skip] <purl> (already vendored)" line. `get` now shares scan's
headline, so it also stops counting patches the preflight would refuse.
Fixes #1850
Assisted-by: Claude Code:claude-opus-5-5
`scan` and `get` now print the vendored dry-run preview through one call, so the headline and its skip and refusal lines cannot drift between the two commands again. The Bun dry-run test now expects the shared headline, which leaves a refused patch out of the count. Refs #1850 Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 015ca58. Configure here.
|
Burn-down agent: labeled Ready for review at
Generated by Claude Code |
Final review briefWhat it does: Before this PR, Risk: low. Only the human dry-run output changes. JSON output, exit codes and the wet path are unchanged. A row gets exactly one verdict, and refusal is checked before already-vendored, so Look here:
Verified: I read the full diff against #1850. The tests would fail without the fix. There is no debug code or scope creep, Changes I made: none. Open questions (non-blocking, follow-up material): The human Auto-merge (squash) is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Fixes #1850
Summary
On a project that is already vendored,
scan --mode vendored --dry-runandget <uuid> --mode vendored --dry-runsaid "Would download and vendor Npatches", while the same preview's
--json(skipped/already_vendored) and the wet run ("already vendored; nothing to do")both said there was nothing to do.
Now the human preview matches them:
Mixed runs list only the non-zero clauses, e.g.
1 of 4 patches (2 already vendored, 1 would be refused).Root cause
preview_vendoralready classified each row (PreviewVerdict::AlreadyVendored)and the JSON arm recorded it, but the human renderer ignored the verdict:
render::dry_run_linesubtracted only would-refuse rows,print_refusalsprinted nothing for in-sync rows, and
getused its ownformat_dry_run(…, selected.len())that subtracted nothing at all.Fix
render::Plan::Vendor { total, refused, in_sync }: the headline leavesout in-sync and refused rows.
VendorPreview::print_human()prints the headline, the[skip] … (already vendored)lines (via the wet run'sformat_record_skip, onstderr like the wet run), the
[would-refuse]lines and the symlinkadvisories.
scanandgetboth call it, so they can't drift. Sideeffect:
get --mode vendored --dry-runnow also leaves refused patchesout of its count, as
scanalready did.No wrapper changes needed (
npm/,pypi/,gem/only dispatch to the binary).Tests (red → green)
tests/scan/scan_render.rs::scan_human_vendored_dry_run_skips_already_vendoredWould download and vendor 1 patch)tests/get/get_render.rs::human_vendored_uuid_dry_run_skips_already_vendoredscan::vendor_flow::preview_tests::preview_headline_leaves_out_already_vendored,scan::render::tests::dry_run_line_counts_already_vendoredUpdated
tests/vendor/in_process_vendor_bun.rs::dry_run_human_names_would_refuse_recordsto expect the shared headline (
0 of 1 patch (1 would be refused)).Commands run locally:
cargo fmt --all -- --check: cleancargo clippy --workspace --all-features -- -D warnings: cleancargo test -p socket-patch-cli --all-features --lib: 942 passedcargo test -p socket-patch-cli --all-features --test scan --test get --test vendor: 248 / 174 / 151 passedcargo test --workspace --all-featuresbuild ran out of thiscontainer's disk while linking; CI covers the rest.
Review notes (/code-review high)
Plan::Vendorand the two print calls intoprint_human().AlreadyVendoredwhenever theledger holds the purl at the same uuid, even for a legacy non-detached
entry or one whose artifact was deleted, which the wet run would
re-download or rebuild. That classification predates this PR and the
JSON preview already reports those rows as
already_vendored. This PRonly makes the human output agree with it. Making the classifier check
artifact and wiring would be a separate change.
Generated by Claude Code