You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
scan --prune's vendored GC reverts entries by hand instead of through VendoredBackend::revert, and drops each revert's error and still-wired orphans #1910
agent:triagedarch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)priority:p3refactorStructural change: duplicated code or logic, missing abstraction, layering, dead code
[agent] Filed by the scheduled architecture audit (audit-cli-tests). Register: register comment.
Kind: refactor. Register ID: T37 (child of T16/#1861).
Problem
VendoredBackend::revert (vendored_backend/mod.rs L137-L200,`` plus revert_vendor_entry at L360-L391)``` is the shared vendored undo. remove, rollback and `vendor --revert` call it.
run_vendor_gc L4964-L5132, which scan --prune uses, does not. It calls dispatch_revert_one directly at L4978 and L5047 and redoes the classification, the advisories and the ledger write by hand. Its leg (a) reverts the same manifest_dropped_purls set that reconcile_dropped reverts through the backend.
The hand copy has drifted:
It drops the revert error. It never reads outcome.error: on failure it only does out.failed.push(purl). Neither run_vendor_gc nor dispatch_revert_one_opts prints anything. Yet scan/gc.rs L529-L531 says "the backend's own error was printed as it happened". revert_vendor_entry keeps the error (VendorRevertStep::Failed(outcome.error…), L374).
It saves the ledger once at the end (L5077), not per entry the way revert_vendor_entry does.
It drops KeepCause::Reference. A keep caused by a residual reference is reported as a drift ("undo the drift", scan/gc.rs L517-L527).
It drops the orphan sweep's still_wired set (L5125-L5131). remove, rollback and vendor --revert each report it.
It runs no go_undo_warnings.
I read all of this from the code and executed none of it.
Proposed change
run_vendor_gc legs (a) and (b) call VendoredBackend::revert and fold the returned RevertedEntry steps into VendorGcSummary, keeping each failure's detail.
Report still_wired the way vendor --revert does.
Delete the GC's own classification. gc_note loses its unused _code parameter.
Make scan/gc.rs print the carried failure detail, and fix the comment.
Size
vendor.rs, scan/gc.rs. About −60 / +30 lines.
Acceptance criteria
scan --prune envelopes are unchanged for successful reverts.
A failed revert's detail appears in human output and warnings[].
A kept-by-reference entry is no longer described as drift.
The GC unit tests in vendor.rs and the e2e_scan_prune* suites stay green.
[agent] Triaged: priority:p3 (cross-cutting vendored GC refactor). Related to #1861 (remove/rollback render VendorRevertStep) but a different code path (run_vendor_gc bypassing VendoredBackend::revert), so tracked separately. No open PR covers it.
[agent] Claiming this for the architecture refactor routine. Branch: arch-refactor/1910-prune-gc-keep-cause.
Ran two of this issue's claims on main at 332b3e8 with a unit test in scan/gc.rs; both hold:
A keep that is not a drift is reported as one. A requirements project whose patch left the manifest, with a second requirements file that still installs from the vendored wheel: the pass restores requirements.txt, keeps the wheel and the ledger entry, and prints GC: kept 1 drifted vendored entry: lock entries were re-resolved since vendoring, so their artifacts and manifest/ledger entries were retained; undo the drift and re-run vendor --revert to finish. Nothing drifted, the recorded wiring was restored, and the file that still installs from the wheel is never named (its vendor_revert_residual_reference warning is dropped). remove and rollback report this keep correctly since remove and rollback call a vendored PyPI residual-reference keep "lockfile wiring drifted", and their "re-run scan --mode vendored to normalize, then remove" remedy loops (Pipenv pipenv requirements export) #1184.
A failed revert loses its reason. With requirements.txt a symlink the revert refuses, and the pass prints only GC: failed to revert 1 vendored entry: pkg:pypi/six@1.16.0.
Scope of the PR: those two (the keep cause and the failure reason), in run_vendor_gc and scan/gc.rs. Moving the pass onto VendoredBackend::revert wholesale, the orphan sweep's still-wired set and the Go undo warnings stay open here.
[agent] Architecture refactor routine: the still_wired bullet is now run, not just read. It holds on main at 9a2a946.
Project.requirements.txt installs from .socket/vendor/pypi/<uuid>/six-1.16.0-py2.py3-none-any.whl, and .socket/vendor/state.json is a valid ledger with no entry for that uuid (what a git merge that kept one side of state.json leaves).
Command
Exit
What it says
vendor --revert --dry-run --json
0
a skipped event, vendor_orphan_still_wired: "a project lockfile still points at .socket/vendor/pypi/, which no ledger entry owns; the artifacts were kept (restore the missing entries …)"
rollback --dry-run --json --offline
1
vendor_ledger_missing, with the same remedy
scan --prune --json --dry-run
0
status: "success", no warnings, a gc of zeros
scan --prune (human, wet)
0
nothing about the directory
The wheel is kept in every case, so nothing breaks: the defect is only that the prune pass computes the still-wired set (sweep_orphan_vendor_dirs) and drops it, where the three other callers of the same sweep report it.
It is a small fix in run_vendor_gc, the function #2253 has to change to report a ledger it could not read. The two fit in one PR; I have noted that in the register. The Go undo warning (the last bullet) is still unverified: the sandbox has no Go toolchain.
[agent] Architecture refactor routine: the still_wired bullet is fixed in #2261, with #2253. scan --prune now reports vendor_orphan_still_wired for a vendored directory that no ledger entry owns and a project file still installs from, also when the ledger holds no entry at all.
agent:triagedarch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)priority:p3refactorStructural change: duplicated code or logic, missing abstraction, layering, dead code
Activity
mikolalysenko commentedon Nov 1, 2026
[agent] Triaged: priority:p3 (cross-cutting vendored GC refactor). Related to #1861 (remove/rollback render VendorRevertStep) but a different code path (
run_vendor_gcbypassingVendoredBackend::revert), so tracked separately. No open PR covers it.Generated by Claude Code
mikolalysenko commentedon Nov 25, 2026
[agent] Claiming this for the architecture refactor routine. Branch: arch-refactor/1910-prune-gc-keep-cause.
Ran two of this issue's claims on
mainat 332b3e8 with a unit test inscan/gc.rs; both hold:requirements.txt, keeps the wheel and the ledger entry, and printsGC: kept 1 drifted vendored entry: lock entries were re-resolved since vendoring, so their artifacts and manifest/ledger entries were retained; undo the drift and re-run vendor --revert to finish.Nothing drifted, the recorded wiring was restored, and the file that still installs from the wheel is never named (itsvendor_revert_residual_referencewarning is dropped).removeandrollbackreport this keep correctly sinceremoveandrollbackcall a vendored PyPI residual-reference keep "lockfile wiring drifted", and their "re-runscan --mode vendoredto normalize, then remove" remedy loops (Pipenvpipenv requirementsexport) #1184.requirements.txta symlink the revert refuses, and the pass prints onlyGC: failed to revert 1 vendored entry: pkg:pypi/six@1.16.0.Scope of the PR: those two (the keep cause and the failure reason), in
run_vendor_gcandscan/gc.rs. Moving the pass ontoVendoredBackend::revertwholesale, the orphan sweep's still-wired set and the Go undo warnings stay open here.Generated by Claude Code
Classify a kept vendored revert in one place
Say why scan --prune kept or failed a revert
Address review of the prune GC keep reporting
refactor: prune GC keep cause in #2246; L01-L03 run
refactor: #2246 and #2241 merged; #1910 claim released
mikolalysenko commentedon Nov 25, 2026
[agent] Architecture refactor routine: the
still_wiredbullet is now run, not just read. It holds onmainat 9a2a946.Project.
requirements.txtinstalls from.socket/vendor/pypi/<uuid>/six-1.16.0-py2.py3-none-any.whl, and.socket/vendor/state.jsonis a valid ledger with no entry for that uuid (what a git merge that kept one side ofstate.jsonleaves).vendor --revert --dry-run --jsonskippedevent,vendor_orphan_still_wired: "a project lockfile still points at .socket/vendor/pypi/, which no ledger entry owns; the artifacts were kept (restore the missing entries …)"rollback --dry-run --json --offlinevendor_ledger_missing, with the same remedyscan --prune --json --dry-runstatus: "success", nowarnings, agcof zerosscan --prune(human, wet)The wheel is kept in every case, so nothing breaks: the defect is only that the prune pass computes the still-wired set (
sweep_orphan_vendor_dirs) and drops it, where the three other callers of the same sweep report it.It is a small fix in
run_vendor_gc, the function #2253 has to change to report a ledger it could not read. The two fit in one PR; I have noted that in the register. The Go undo warning (the last bullet) is still unverified: the sandbox has no Go toolchain.Generated by Claude Code
refactor: #2250 review nit fixed; #2259 filed
Report what scan --prune could not reconcile
mikolalysenko commentedon Nov 25, 2026
[agent] Architecture refactor routine: the
still_wiredbullet is fixed in #2261, with #2253.scan --prunenow reportsvendor_orphan_still_wiredfor a vendored directory that no ledger entry owns and a project file still installs from, also when the ledger holds no entry at all.What remains here after #2246 and #2261:
VendoredBackend::revert, which have no demonstrated defect.Generated by Claude Code