Repository navigation
Sweep scan/hosted nuget.rs and takeover.rs - #1903
Mikola Lysenko (mikolalysenko) merged 3 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
Inline revert_keeps_wiring, residual_takeover_warning, drifted_takeover_warning and unwires_alias_copy into their only callers in Takeover::stage and Takeover::unpinned. The residual-ref check now uses vendor::RESIDUAL_REFERENCE_CODE instead of a copy of the literal, KEPT_VENDORED is private, and the cargo probe filters purl_parts by type instead of a starts_with + then + flatten chain. Bare issue references are dropped from comments here and in nuget.rs. Output bytes, codes and skip reasons are unchanged. Assisted-by: Claude Code:claude-opus-5-5
Drop the residual-reference conjunct from the keep-wiring branch: it is reached only when residual_only_keep returned None, so a residual warning there implies drift_skipped, which the branch already checks. Fix that branch's comment to cover kept_artifact, keep the yarn alias rule as the named unwires_alias_copy predicate, and name the repeated refusal code REVERT_FAILED. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Assisted-by: Claude Code:claude-opus-5-5
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 3c9459a. Configure here.
|
[burn-down agent] Labeled Ready for review at
Generated by Claude Code |
Final review briefWhat it does: Behavior-neutral cleanup of Risk: low. Warning codes and detail strings are byte-identical, and no platform-specific code changed. Look here:
Verified: Read the full diff and compared each inlined string against the deleted helpers. Changes I made: none. Auto-merge is armed, so approving sends it 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 3c9459acd531302fcfc6b55219c9dab7770c7a12. Checked takeover revert refusal equivalence, residual wiring and alias-copy protection. No major correctness issues found. Validation: source and regression-test review plus the available exact-head CI checks; no local test pass is claimed.
LLM Description written by Claude Code:claude-opus-5-5
Architecture refactor sweep of
crates/socket-patch-cli/src/commands/scan/hosted/{nuget,takeover}.rs, coverage rows 22 and 24 of the ledger (python.rsis held by #1883). It follows the audit notes and Part 4 (structure) of the living document.Changes
takeover.rsTakeover::stage:revert_keeps_wiring,residual_takeover_warninganddrifted_takeover_warning.any(code == residual reference)). It is dead: the branch is reached only whenresidual_only_keepreturnedNone, which means eitherdrift_skipped()is true (already a conjunct) or there is no residual warning."vendor_revert_residual_reference"is replaced byvendor::RESIDUAL_REFERENCE_CODE. The 4 copies of"redirect_vendored_revert_failed"are now aREVERT_FAILEDconst.KEPT_VENDOREDwaspub(super)with no outside user and is now private.purl_parts(purl).filter(type == "cargo")instead ofstarts_with+then+flatten.std::collections::BTreeSetis replaced by the imported name.pip freeze >writes) as absent: exit 0, no warning, and pip keeps installing the unpatched pin #721,removeandrollbackcall a vendored PyPI residual-reference keep "lockfile wiring drifted", and their "re-runscan --mode vendoredto normalize, then remove" remedy loops (Pipenvpipenv requirementsexport) #1184, Vendored→hosted takeover on yarn classic un-patches a vendorednpm:alias copy when a direct copy is pinned, instead of retracting the takeover #1158, Vendored → hosted takeover strands a requirements.txt pin that lives in a-rinclude or a vendored "(transitive)" line: the wet run reverts it to the unpatched release, while--dry-runpreviews a clean takeover #699, uv vendored → hosted takeover strands a package that vendored mode pinned to a different version than uv.lock: the wet run reverts to the unpatched release (exit 1), while --dry-run previews a clean takeover #723, Poetry 0.x vendored → hosted takeover un-vendors the package before hosted mode refuses the lock, while --dry-run previews a clean takeover (redirected: 1, exit 0) #945, Hosted uv scan gives no uv < 0.5.6 advisory for transitive overrides or repointed constraints, so on uv ≤ 0.5.4 a plainuv syncsilently reinstalls the unpatched wheel after a clean exit 0 #1569 ×2, Hosted yarn berry rewrites a mixed-line-ending package.json that vendored mode refuses #628). The comment on the keep-wiring branch now also coverskept_artifact, not only drift.nuget.rs: dropped the bare(#352)from the module doc.Tests: none changed. The existing
explainandnames_packageunit tests still apply.classic_takeover_keeps_vendored_alias_copy_patched(mode_migration_npm) guardsunwires_alias_copy: breaking itsyarn.lockmatch turned that test red.Diff: +65 / −94, all production code in
takeover.rsandnuget.rs. No test lines changed.Behavior change
None. Output bytes, codes and skip reasons are the same.
Risk
Low. This is a local inlining in one CLI module, with no
cfg(windows)/cfg(unix)code touched.Verification
cargo clippy -p socket-patch-cli --all-features -- -D warningspasses.socket-patch-clilib tests pass (940).scan(247),mode_migration_{cargo,composer,npm,pypi,vlt,bun},in_process_vendor, andin_process_vendor_{pnpm,bun}_takeover./code-review highran. I fixed the dead conjunct, the stale comment and the repeated code literal. I keptunwires_alias_copynamed, because inlining it nested 5 closures.Not fixed here (pre-existing; each changes output)
pinsplit doesn't decode the purl. It splits by hand without percent-decoding, sopkg:pypi/six@1.16.0%2Bsocket.1would advisesix==1.16.0%2Bsocket.1.purl_partsdecodes, but switching to it changes the message bytes. A14 (Tracking: build and classify purls through one validated utils::purl API #748).vendor --revertclassify a residual keep differently.residual_only_keepdoesn't requirekept_artifact, while coreRevertOutcome::kept_for_residual_referencedoes. A wet revert always sets it, but a dry-run revert emits the residual warning without it.🤖 Generated with Claude Code
https://claude.ai/code/session_011f9aeNy5nnxWTLcart5Joa
Note
Low Risk
Local CLI refactor in hosted scan takeover logic with explicit parity on output bytes; no auth, data, or cross-platform paths touched.
Overview
Refactors
takeover.rsand trimsnuget.rsmodule docs as an audit-driven structure sweep, with no intended behavior change to warning codes, skip reasons, or JSON output.In
Takeover::stage, vendored-revert refusal handling is inlined (replacingrevert_keeps_wiring,residual_takeover_warning, anddrifted_takeover_warning) and the keep-wiring check is simplified tokept_artifact || drift_skipped()after dropping a dead residual-warning conjunct. Repeated"redirect_vendored_revert_failed"strings become aREVERT_FAILEDconst; residual lookup usesRESIDUAL_REFERENCE_CODE.KEPT_VENDOREDis now module-private.Smaller cleanups: cargo ledger-less probing uses
purl_parts+ type filter instead of apkg:cargo/prefix chain;unwires_alias_copytakes&BTreeSetandunpinnedusesis_some_and; bare issue references are removed from comments.nuget.rsdrops(#352)from its module doc.Reviewed by Cursor Bugbot for commit 3c9459a. Configure here.
Generated by Claude Code