Repository navigation
Sweep scan/discovery.rs - #1884
Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
Move the tests for ui::shell_word, ranking::batch_supersedes and lock_inventory::unsupported_layout_warnings next to the code they check. scan/discovery.rs tested them through wrappers and re-exports that the next commit deletes. The shell_word test now covers the Windows quoting and `%`. Assisted-by: Claude Code:claude-opus-5-5
Drop the re-exports of unsupported_layout_warnings and merge_ledger_records_for_updates; scan and get import them from core. Inline candidate_supersedes and the severity_order wrapper into their callers, and delete the 5 severity_order tests core's ranking tests already cover. The nested-project remedy now quotes its PATH with ui::shell_word, so on Windows it is double-quoted and a `%` is quoted everywhere (#1859). Trim restating doc comments and test banners, and fold the trailing collect_vuln_ids dedup test into its siblings. Assisted-by: Claude Code:claude-opus-5-5
Fold the last info_with_advisories caller onto patch_with, and make the comment over scan's discovery re-exports name what they export. 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 ff4b1ae. Configure here.
Assisted-by: Claude Code:claude-opus-5-5
|
Burn-down agent: labeled Ready for review at
Generated by Claude Code |
|
Final review brief (head What it does. This is a cleanup of Risk: low. The code changes are mechanical removals of forwarding functions. The one visible change is how the nested-project remedy command quotes its path, which now goes through the shared Look here
Verified
Changes I made: none. Open questions (non-blocking)
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
This PR sweeps
crates/socket-patch-cli/src/commands/scan/discovery.rs. The file's coverage row was audited at c8e26f6. The work is for the architecture refactor routine (discussion #1830, Part 4 "structure"). It also folds in T18 because the fix stays inside this file.Fixes #1859
Changes
discovery::unsupported_layout_warningsis gone.scan/mod.rsandget.rsnow import it fromsocket_patch_core::vendor::lock_inventory.discovery::merge_ledger_records_for_updatesis gone.scan/mod.rsnow imports it fromsocket_patch_core::ledgers.candidate_supersedes→ranking::batch_supersedes.severity_order(&str)→ coreranking::severity_order(Some(s)), at its 4 call sites inscan/mod.rsandrender.rs.shell_wordis deleted. Thenested_project_skippedremedy now quotes throughcrate::ui::shell_word.UpdateInfo,detect_updatesandcollect_vuln_ids, the stale "severity helpers" in the module doc, and 8 test banners). The mod.rs comment over the discovery re-exports now names what they export.severity_ordertests (critical/case/known/moderate/unknown). They tested a forwarding wrapper, and core'sseverity_ladder_is_*andmoderate_is_the_medium_tieralready cover the same cases.api/ranking.rs(4 → 3): thecandidate_supersedestests, rewritten onto core'sbatch/batch_multihelpers asbatch_supersedes_on_advisory_count_at_equal_severity,batch_supersedes_on_severity_before_advisory_countandbatch_supersedes_ignores_cve_aliases_beside_a_ghsa.lock_inventory/tests.rs: theunsupported_layout_warningstest. It now asserts all three arms (both known codes renamed and rephrased, an unknown code forwarded verbatim). Red→green: forwarding an empty detail for unknown codes fails it.ui/text.rs: theshell_wordtest, whichui::shell_wordhad no test of its own for. It now pins%and the Windows forms too. Red→green: adding%to the plain set fails it.collect_vuln_ids_dedups_across_patchesmoved next to its siblings, rebuilt onpatch_with, and now also assertsall.info_with_advisorieshelper is deleted; its last test builds onpatch_with.Size
git diff --stat: 7 files, +127 / −283.Behavior change
Only the
nested_project_skippedremedy text changes, as #1859 asks:%is now single-quoted.The PATH is already
/-normalized, so backslash handling does not come up. Every other output, JSON field, exit code and error code is unchanged.Review notes (
/code-review high)Fixed: the stale re-export comment and the leftover
info_with_advisorieshelper.Not fixed here (they belong to
ui::shell_word, which every other pasteable command already uses, and which this PR does not change):%VAR%inside double quotes."is not escaped on Windows.The remedy now matches the rest of the CLI, and fixing those for every caller is a separate change. The per-comparison lowercase allocation in core
severity_orderexisted before this PR.Verification
cargo clippy --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-core --lib -- api::ranking vendor::lock_inventory::tests: 142 passed.cargo test -p socket-patch-cli --lib --bins -- scan:: ui::text: 280 passed.cargo test -p socket-patch-cli --test scan -- nested_project: 7 passed. The remedy parser inscan_nested_project_e2estill parses the remedy.The Windows branch of the moved
shell_wordtest only runs on Windows CI.Risk
Low. Mostly deletions and import moves.
get.rschanges by one line (L911). #1698 also touchesget.rs, but only at L3540, so the two should merge without conflict.https://claude.ai/code/session_011f9aeQJdZ8UcVnhg3sXBcn
Generated by Claude Code