GeezerVison is showing github.com — Sweep core utils notice, npm_range, pep440, pipenv, purl by mikolalysenko · Pull Request #1920 · SocketDev/socket-patch
Conversation
LLM Description written by Claude Code:claude-opus-5-5
Sweep of the audited core rows utils/{notice,npm_range,package_manager,pep440,pipenv,purl}.rs in coverage/files.tsv, done by the architecture refactor routine (discussion #1830). See the living document's Part 4 (structure) and Part 5 (tests).
Changes
notice.rs: inlined is_muted into notice_once, its only caller.
npm_range.rs: the operator character set was written out twice. It is now one private is_operator.
pep440.rs: the two copies of the trailing-zero trim are now one trim_trailing_zeros. Dropped a bare #1589.
pipenv.rs:
purl.rs:
- Deleted the
JsrPurlParts alias and the is_purl wrapper. target.rs now calls starts_with("pkg:") in both places.
parse_name_version is private.
- Trimmed the
strip_purl_qualifiers essay, the JSR "as of writing" note, the builder banner, the REGRESSION/B73/remove and rollback don't PEP 503-normalise PyPI purl identifiers, so remove pkg:pypi/[email protected] exits 1 "No patch found" while get accepts the same identifier #1024 tags and 5 test section banners.
- Folded the 3 test modules into one.
- Tests: deleted
test_is_purl, 7 test_build_*_purl tests (which restate a format!), 7 *_round_trip tests and cargo_purl_round_trips_through_the_encoded_spelling (which repeat the parse tests). They are replaced by one test, builders_round_trip_through_their_parsers, which round-trips every builder with a literal + version. It went red when build_jsr_purl was mutated to drop the /. test_parse_golang_purl_percent_decodes and test_parse_jsr_purl_percent_encoded_scope were duplicates; their one unique assert each (Azure case is kept; an encoded bare @ is rejected) moved into the parse tests.
package_manager.rs: nothing local. The yarn_major note is A13, and its callers' files (vendor/mod.rs) are held by Fix Go patch delivery, audits, and reinstalls #1698.
Not done because the files are held by open PRs: inlining the 7 build_*_purl wrappers (callers in crawlers and vendor files held by #1882, #1886, #1891 and #1698), inlining parse_jsr_purl into deno_crawler (#1891), and moving the PurlKey asserts to purl_key.rs (#1907).
Size
+135 / −432 in 6 files: about −55 production lines and −242 test lines.
Behavior change
None.
/code-review high
7 findings. I fixed 2: the builder/literal-+ round-trip coverage, and _root. I left 5 unchanged:
npm_range_admits(">=", v) reads as *: pre-existing, and fixing it changes behavior. It is noted in the register for an issue.
- The Windows
.bat spawn test went with pipenv.rs: process.rs tests PATHEXT resolution and the batch-shim spawn with .cmd. A .bat case belongs there, but process.rs is held by Fix env-keyed probe memo written three ways (#1888) #1895.
- Removing
pub fn is_purl is a breaking change: core is consumed only by this workspace's CLI, and earlier sweeps narrowed pub items the same way.
starts_with("pkg:") is case-sensitive: identical to the old is_purl.
- Two copies of
starts_with("pkg:"): a one-token literal; a wrapper for it is what the audit asked to remove.
Verification
cargo clippy --workspace --all-features -- -D warnings is clean.
cargo test -p socket-patch-core --lib: 6975 passed. The 4 failures are permission-dependent tests that fail under the root sandbox and are untouched here: copy_tree::relax_loop_must_not_traverse_symlinked_root, vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry, pypi_poetry::wire_write_failure_maps_error_and_leaves_lock_untouched and pypi_requirements::wire_failure_rolls_back_already_written_files.
- CI (82 checks) and Bugbot are green on
9a0b930.
Risk
Low. The changes are local inlines and test edits. No platform-specific production code changed; only a cfg(windows) test was deleted.
https://claude.ai/code/session_011f9aeQHPtUvnVjDnuWKCpj
Generated by Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
Inline notice's is_muted and pipenv's resolve_on_path, name npm's
operator set once, and share pep440's trailing-zero trim. Drop the
JsrPurlParts alias and the is_purl wrapper, and make
parse_name_version private.
Delete pipenv's three PATH-resolution tests (process.rs tests the
shared resolver) and purl's builder, round-trip and is_purl tests,
which restate a format! or repeat the parse tests. Fold purl's three
test modules into one, and drop history and banner comments.
Behavior is unchanged.
Assisted-by: Claude Code:claude-opus-5-5
Each builder now round-trips through its parser with a literal +
version, replacing the 14 deleted builder and round-trip tests with
one that fails when a builder and its parser disagree. The pipenv
probe's unused root parameter is named _root.
Assisted-by: Claude Code:claude-opus-5-5
cursor[bot] reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ 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 9a0b930. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
[burn-down agent] Labeled Ready for review at 9a0b930.
- CI: all 82 checks on 9a0b930 pass or are skipped (32 success, 50 skipped). Mergeable, no conflicts.
- Bugbot: reviewed 9a0b930, no findings. No unresolved review threads.
- Reviewer note: refactor sweep of core utils (
notice, npm_range, pep440, pipenv, purl). Net −297 lines, most of it in utils/purl.rs. No CHANGELOG.md change.
Generated by Claude Code
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Final review brief (9a0b930)
What it does. A refactor sweep of six core utils files with no intended behavior change. It inlines is_muted, resolve_on_path and is_purl, folds duplicated helpers (npm is_operator, pep440 trim_trailing_zeros), and makes parse_name_version private. It also replaces 16 purl builder and round-trip tests with one test that round-trips every builder, and deletes 3 pipenv resolver tests that repeat process.rs's resolve_tool_* tests.
Risk: low. I compared each production rewrite with the old code and found them equivalent:
pipenv::installed_major now calls process::resolve_tool("pipenv"), which is resolve_tool_with(name, env::var_os), the same absolute-PATH-only resolver as before. The probe still runs in temp_dir().
is_purl(t) was t.starts_with("pkg:"), which is now inlined at both call sites in target.rs.
- The
notice, npm_range and pep440 changes are mechanical extractions or inlines.
Look here
Verified
- Read the full diff (6 files, +135/−432) and the description, and they match.
- Coverage the deleted tests had is still there:
- The coordinate-validation test
purl_builders_validate_coordinates (path traversal, extra levels) was moved, not deleted.
- The golang
%2Bincompatible decode is still covered by parsers_percent_decode_the_version.
- The relative-PATH and non-executable resolver cases are covered in
process.rs.
- Nothing else in the workspace uses
is_purl or JsrPurlParts. CHANGELOG.md is untouched, and I found no debug leftovers.
- CI is green on
9a0b930 (ci-ok and clippy pass). Bugbot found no issues, and there are no review threads. I didn't run the tests locally and relied on CI for this one.
Changes I made: none.
Open questions (not blocking)
- The deleted
cfg(windows) test resolve_on_path_honours_pathext_shims was the only test that spawned a .bat shim end to end. process.rs covers .cmd. The author deferred a .bat case because process.rs is held by Fix env-keyed probe memo written three ways (#1888) #1895. Consider a follow-up once that PR lands.
pub fn is_purl is removed from the published core crate. Nothing in this workspace uses it, and earlier sweeps narrowed pub items the same way.
Auto-merge is armed, so approving sends this straight to the merge queue.
Generated by Claude Code
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[agent] Reviewed 9a0b930aaa3be4473d4ce5dca6ddbc71b1ea8d47. Checked notice suppression, npm range and PEP440 equivalence plus neutral pipenv probes. No major correctness issues found. Validation: source and regression-test review plus the available exact-head CI checks; no local test pass is claimed.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
arch-refactor
PR opened by the scheduled architecture refactor routine
Ready for review
Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review
refactor
Structural change: duplicated code or logic, missing abstraction, layering, dead code
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|