You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Route purl ecosystem checks through Ecosystem::from_purl instead of 24 inline starts_with("pkg:<type>/") tests #747
[agent] Filed by the scheduled architecture audit routine (CLI and core). Register: discussion #560 register.
Kind: refactor (mechanical, no behavior change). Source: review 6.4, 7.3; register C20, child 1 of the purl tracking issue.
Problem (verified on 045d7ec)
Ecosystem::from_purl is the one map from purl type to ecosystem. Production code outside it still spells the type prefixes inline: 24 starts_with("pkg:<type>/") checks.
patch/apply.rs:745 and patch/rollback.rs:355, the npm sidecar gates;
api/client.rs:1338;
vex/verify.rs:210.
CLI:
commands/vendor.rs (3, L1907-L1943);
commands/bun_preflight.rs (3);
vlt_preflight.rs:50, rollback.rs:2446, get.rs:1536, apply.rs:2315, scan/discovery.rs:108 and scan/hosted/python.rs:28.
All 24 agree with from_purl today (all are case-sensitive prefix tests), so there is no drift yet. But the type vocabulary has 25 copies. A purl-type change, such as accepting pkg:PyPI/, or jsr mapping to Deno, would have to find all of them. And matching on Ecosystem makes the npm-only gates exhaustive and greppable.
Proposed change
Replace each check with Ecosystem::from_purl(p) == Some(Ecosystem::X), or a matches! on it. Where a site checks several types, add a small Ecosystem::is_one_of-style helper only if it reads better.
Delete the inline literals.
Leave from_purl itself and the parsers in utils/purl.rs unchanged.
Size and scope
About 24 one-line production edits across 14 files; no test changes expected.
Out of scope: the purl builders (later children of the tracking issue), and the starts_with("pkg:") "is this a purl" tests (utils::purl::is_purl).
Acceptance criteria
No starts_with("pkg:<type>/") remains in non-test code outside crawlers/types.rs and utils/purl.rs. Add a source-scan architecture test like crawlers::architecture_tests, normalizing CRLF.
cargo test -p socket-patch-core --lib and cargo test -p socket-patch-cli stay green; clippy stays clean.
[agent] Claiming this issue for the architecture refactor routine (highest leverage: it's the top scoring candidate whose sites are all in files no open PR changes). Slice 1 only: the 7 inline type-prefix checks in free files (bun_preflight.rs, vlt_preflight.rs, fuzzy_match.rs, sidecars/coursier.rs, vex/verify.rs), plus a one-sided source-scan guard that lists the remaining files open PRs change. Branch: arch-refactor/747-purl-ecosystem-checks. Claim-ID: 2026-10-08T10:59:14Z-aa074d
[agent] Slice 1 is in #1126: the 7 checks in bun_preflight.rs, vlt_preflight.rs, fuzzy_match.rs, sidecars/coursier.rs and vex/verify.rs go through Ecosystem::from_purl, plus an equivalence table test and a one-sided guard. What remains is the checks in 16 files that open PRs change (listed as PENDING_INLINE_PREFIXES in crawlers/types.rs); migrate them as those PRs land.
[agent] Janitor: released the stale claim Claim-ID: 2026-10-08T10. 59:14Z-aa074d:#1126 (merged 2026-10-11 01:02Z) is slice 1 only; about 68 inline starts_with("pkg:<type>/") checks remain on origin/main and no open PR covers them, and the claimer has posted nothing here in more than 48h. The issue stays open and can be claimed again.
Activity
audit-core: C23 filed (#746), C20 tracking (#748, #747), new C43 (#745)
mikolalysenko commentedon Oct 4, 2026
[agent] Triaged:
priority:p3(cross-cutting refactor). This is the first child of tracking issue #748. Not a duplicate, and no existing fix PR.Generated by Claude Code
mikolalysenko commentedon Oct 8, 2026
[agent] Claiming this issue for the architecture refactor routine (highest leverage: it's the top scoring candidate whose sites are all in files no open PR changes). Slice 1 only: the 7 inline type-prefix checks in free files (
bun_preflight.rs,vlt_preflight.rs,fuzzy_match.rs,sidecars/coursier.rs,vex/verify.rs), plus a one-sided source-scan guard that lists the remaining files open PRs change. Branch: arch-refactor/747-purl-ecosystem-checks. Claim-ID: 2026-10-08T10:59:14Z-aa074dGenerated by Claude Code
mikolalysenko commentedon Oct 8, 2026
[agent] Slice 1 is in #1126: the 7 checks in
bun_preflight.rs,vlt_preflight.rs,fuzzy_match.rs,sidecars/coursier.rsandvex/verify.rsgo throughEcosystem::from_purl, plus an equivalence table test and a one-sided guard. What remains is the checks in 16 files that open PRs change (listed asPENDING_INLINE_PREFIXESincrawlers/types.rs); migrate them as those PRs land.Generated by Claude Code
List main's new inline purl checks as pending
mikolalysenko commentedon Oct 13, 2026
[agent] Janitor: released the stale claim
Claim-ID: 2026-10-08T10. 59:14Z-aa074d:#1126 (merged 2026-10-11 01:02Z) is slice 1 only; about 68 inlinestarts_with("pkg:<type>/")checks remain on origin/main and no open PR covers them, and the claimer has posted nothing here in more than 48h. The issue stays open and can be claimed again.Generated by Claude Code