Repository navigation
Sweep vendored_backend mod.rs and repair.rs - #1939
Mikola Lysenko (mikolalysenko) merged 4 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
Inline revert_vendor_entry and its result struct into VendoredBackend::revert, and give VendorRevertStep one unwired() predicate for the two lists that spelled it out. In repair.rs, inline workspace_copy_issue, rebuild_reason_label and format_ledger_missing, drop Candidate's Clone and its copy of entry.detached, and build the lazy API client in one place, which removes an expect. Merge the ui_format_tests module into tests, rename the FIFO test after what it checks, and cut bare issue numbers from comments. Behavior is unchanged. Assisted-by: Claude Code:claude-opus-5-5
Take the slot and insert the client back, so ensure_client returns the reference with no panic path. Restore the scan tests' notes on the FIFO-safe reader and the one shared scan. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Assisted-by: Claude Code:claude-opus-5-5
|
Ready for review — burn-down agent.
Generated by Claude Code |
Final review briefWhat it does: A behavior-preserving cleanup of Risk: low. It is a mechanical refactor, and every variant list, user-facing string and side-effect order matched the old code (checked below). Look here:
Verified:
Changes I made: none. Nits (not blocking): Auto-merge (squash) is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
Wenxin Jiang (Wenxin-Jiang)
left a comment
There was a problem hiding this comment.
[agent] Reviewed 823cfbf6ee313f0ab593d3c29a77eb7619c65feb. Checked vendored revert step transitions, advisory timing, ledger failures and lazy repair-client reuse. No major correctness issues found. Validation: source and regression-test review plus the available exact-head CI checks; no local test pass is claimed.
Resolve the conflict with #1954 in VendoredBackend::revert: the entry's wiring files, read from the cloned entry before the revert drops it, go to push_vendor_advisory as main now requires. 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 0e72166. Configure here.
|
[final reviewer] Re-enqueued at Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Sweep of
crates/socket-patch-cli/src/commands/vendored_backend/{mod,repair}.rs, from the audit's coverage notes for these rows (living document: discussion #1830, Part 4 structure). Callers invendor.rs(#1698),rollback.rs(#1864),remove.rsandcommands/repair.rs(#1875) are held by open PRs, so the crate-visible API is unchanged and only file-local cleanups land here.Changes
mod.rsrevert_vendor_entryand deletedVendorRevertResult(its only caller wasVendoredBackend::revert). The entry is now cloned once, so the separateflavor/gempre-captures are gone.VendorRevertStep::unwired()in place of two hand-written match lists (the pypi advisory's list isunwired() || WouldRevert).repair.rsworkspace_copy_issue(a forwarder toArtifactHealth::is_workspace_copy_issue),rebuild_reason_labelandformat_ledger_missing.Candidate: dropped the unusedCloneand thedetachedfield, which copiedentry.detached.ensure_clientreplaces the two copies of the build-once API client code, and drops theexpect.ui_format_testsintotests; renamedrepair_returns_with_fifo_script→scan_skips_fifo_wiring_files(it tests the scan, not repair); removed therebuild_reason_labelpassthrough assert along with the function. Removed 6 bare issue references from comments.Size
git diff --stat: 2 files, +115 / −165. About +106 / −149 production and +9 / −16 test lines.Merge with main
Merged
mainafter #1954 to clear a merge-queue conflict:revertnow passes the entry's wiring files (read from the cloned entry before the revert) topush_vendor_advisory, asmainrequires. Lib, in-process vendor/remove/rollback suites pass.Behavior
None. Output bytes, JSON, exit codes and error codes are unchanged.
Verification
cargo clippy --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-cli --lib: 940 passed.--test in_process_remove_repair_lifecycle,in_process_rollback_vendored,in_process_vendor,remove_rollback_api_overrides,remove,rollback: all passed.--test repair: 127 passed, 2 failed. The failures are the known root-sandbox chmod tests (repair_cleanup_failure_is_reported_in_json_and_silent_modes,repair_exits_zero_and_stays_quiet_when_lock_file_unremovable), which pass in CI.cfg(windows)/cfg(unix)production code was changed./code-review high
It found no correctness bugs. I fixed 2 of its 8 low-severity findings:
ensure_clientno longer ends in anunwrap, and the scan tests' notes on the FIFO-safe reader and the one shared scan are restored. I left the other 6:remove.rsL1327's doc still namesrevert_vendor_entry, andcommands/repair.rshas its own build-once client copy. Both files are held by Sweep remove.rs and repair.rs #1875; recorded in the register for the next sweep.other => otherarm in the preview label is unreachable, because a candidate's reason is always missing or corrupt. Making it an enum touches the event JSONreasonfield's source; it stays total.VendorRevertStep.Risk
Low. Mechanical inlining, covered by the in-process revert/repair suites.
🤖 Generated with Claude Code
https://claude.ai/code/session_011f9aePYVxtNghHHt1yrb1D
Note
Low Risk
Mechanical inlining and comment cleanup in vendored revert/repair paths; PR asserts unchanged behavior with broad CLI test coverage.
Overview
Refactors
vendored_backend/mod.rsandrepair.rswith no intended behavior change (same CLI output, JSON, and exit codes).In
mod.rs,revert_vendor_entryandVendorRevertResultare removed; their logic lives inline inVendoredBackend::revert, with one ledger entry clone up front instead of repeated lookups.VendorRevertStep::unwired()centralizes which revert outcomes count as “unwired” for PyPI reinstall advisories, gem stale-cache warnings, andgo_undo_warnings. Bare GitHub issue numbers are stripped from comments while keeping explanatory text.In
repair.rs, small one-line helpers (workspace_copy_issue,rebuild_reason_label,format_ledger_missing) are inlined at call sites. RepairCandidatedrops an unusedCloneand redundantdetachedfield (usesentry.detached). Shared lazy API client setup is factored intoensure_client, used by the redownload phase andfetch_record_by_uuid. Tests consolidateui_format_testsintotestsand rename the FIFO test to reflect that it exercisesscan_vendor_references, not repair.Reviewed by Cursor Bugbot for commit 0e72166. Configure here.
Generated by Claude Code