Skip to content

Sweep core utils notice, npm_range, pep440, pipenv, purl - #1920

Open
Mikola Lysenko (mikolalysenko) wants to merge 3 commits into
mainfrom
arch-refactor/sweep-core-utils-notice-purl
Open

Mikola Lysenko (mikolalysenko) wants to merge 3 commits into
mainfrom
arch-refactor/sweep-core-utils-notice-purl

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

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

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

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) added refactor Structural change: duplicated code or logic, missing abstraction, layering, dead code arch-refactor PR opened by the scheduled architecture refactor routine labels Nov 1, 2026
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
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review November 1, 2026 07:18
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

Mikola Lysenko (mikolalysenko) pushed a commit that referenced this pull request Nov 1, 2026
Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Nov 1, 2026
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

[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

@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants