fix(vendor): count skipped packages, not advisory warnings - #166
Open
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Open
fix(vendor): count skipped packages, not advisory warnings#166Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Conversation
`record_warning` routed every backend advisory through `Envelope::record` as a `Skipped` event, so each one bumped `summary.skipped`. A successful `vendor_prebuilt_downloaded` service fetch then reported `applied:1 skipped:1`, a 1-package project could print "2 skipped", and a refresh that skipped nothing still counted "1 skipped". Push the advisory event directly onto `events` instead: it stays visible to JSON consumers (same `Skipped` action + code/detail, which never flips run status) but no longer inflates `summary.skipped`, which now counts only packages that were genuinely skipped (recorded via `Envelope::record` — `already_vendored`, `package_not_installed`, benign refusals, ...). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mikola Lysenko (mikolalysenko)
enabled auto-merge (squash)
August 12, 2026 23:47
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
The
vendorcommand'sskippedcount is untrustworthy because per-package advisory warnings are recorded asSkippedevents that bumpsummary.skipped.record_warning(crates/socket-patch-cli/src/commands/vendor.rs:242) routed every backendVendorWarningthroughEnvelope::recordas aSkippedevent. But a vendor warning is an advisory ABOUT how a package was vendored — a successfulvendor_prebuilt_downloadedservice fetch (crates/socket-patch-core/src/vendor/cargo.rs:164,gem.rs:707,composer_lock.rs:566, ...), an artifact rebuild, a content-mismatch overwrite — not a package that was skipped. The package's genuineApplied/Skipped/Failedoutcome is recorded separately, so the advisory double-counted.Observed against real production data (2026-08-12):
action:"skipped"(vendor_prebuilt_downloaded), so a single service vendor reportedapplied:1 skipped:1.summary.skippedcounted warning EVENTS, not skipped PACKAGES — "2 skipped" on a 1-package project, "1 skipped" on a refresh that skipped nothing.Fix
crates/socket-patch-cli/src/commands/vendor.rs:242(record_warning): push the advisorySkippedevent directly ontoenv.eventsinstead of throughEnvelope::record. The advisory stays visible to JSON consumers (unchangedSkippedaction +errorCode/reason;Skippednever flips run status, so no status signal is lost) but no longer bumpssummary.skipped. That counter now reflects only packages that were genuinely skipped — those recorded viaEnvelope::record(already_vendored,package_not_installed,vendor_unsupported_ecosystem, benign refusals). A successful service vendor is now countedapplied:1 skipped:0.Test
crates/socket-patch-cli/src/commands/vendor.rsnew hermetic modulewarning_counting_tests:advisory_warning_does_not_bump_skipped_summary— anappliedpackage + avendor_prebuilt_downloadedadvisory yieldsapplied:1 skipped:0, with the advisory still present inevents[].multiple_advisories_do_not_accumulate_skips— two advisories on one package keepskipped:0(reproduces the "2 skipped" report).genuine_package_skip_still_counts— analready_vendoredskip still bumpssummary.skipped(the fix narrows the counter, it does not zero it out).RED before / GREEN after (verified by reverting the one-line change: the first two assertions fail with
skipped:1). Also re-ran the hermetic vendor suites unchanged:--lib vendor(19),in_process_vendor(27, incl.mismatched_baseline_vendors_with_warning_eventwhich asserts a warning is still askippedevent),scan_vendor_e2e(18),e2e_vex_vendor(8),json_envelope(23), full--lib(350). Build clean.Scope
Kills the count/label sweep findings: vendor-skip-count-inflation (P2), vendor-envelope-service-download-as-skip (P3), vendor-event-applied-plus-skipped-info (P3), service-success-recorded-as-skipped (P3), vendor-unverifiable-skip-noise (P2).
Deferred (not in this focused PR):
wiring_in_sync+copy_matches_after_hasheshot path atcrates/socket-patch-core/src/vendor/cargo.rs:396; thedocker_e2e_vendor_*suites assert byte-stable re-vendor). This PR already makes the no-op REPORT honestly (Vendored 0; 1 skippedforalready_vendored, no advisory inflation). The residual re-fetch on a not-installed / fresh-clone re-vendor routes throughfind_packages_for_purlsatcrates/socket-patch-cli/src/commands/vendor.rs:699— the qualified-purl "not installed" lookup owned by a separate PR — so the write-avoidance for that path is intentionally left to it and not touched here.🤖 Generated with Claude Code
Note
Low Risk
CLI reporting and JSON envelope counting only; no change to vendoring behavior, lockfile wiring, or run exit semantics for successful vendors.
Overview
Fixes
vendorreporting wheresummary.skippedand human “N skipped” lines counted advisory warnings (e.g. successfulvendor_prebuilt_downloadedservice downloads) as skipped packages, so one applied package could showapplied:1 skipped:1or “2 skipped” on a single-package run.record_warningstill emits aSkipped-shaped event with stableerrorCode/reasonfor JSON, but pushes it ontoeventsdirectly instead ofEnvelope::record, sosummary.skippedonly reflects genuine package skips (already_vendored,package_not_installed, etc.). Run status is unchanged because advisorySkippedevents never drove failure status.Adds
warning_counting_teststo lock in applied + advisory →skipped:0, multiple advisories on one package, and real skips still incrementing the counter.Reviewed by Cursor Bugbot for commit 52a950f. Configure here.