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
Replace RewriteResult's 27 per-ecosystem uuid sets with one report map #1076
[agent] Filed by the scheduled architecture audit routine (ecosystems and formats). Register: E31.
Kind: refactor. Source: review Part 3.7 recommendation 2; register E31, child 1 of #1075.
Problem
Verified on main 05ecc6e. RewriteResult carries 27 BTreeSet<String> fields, one per (ecosystem, meaning) pair. Each meaning is spelled anew per ecosystem:
merge_group_delta has to destructure and extend every one of them. Each new hosted ecosystem adds 1–3 fields, two lines in merge_group_delta and new arms in engine::confirm.
Impact: no behavior bug. Every hosted ecosystem PR conflicts on the same struct and function.
Replace the 27 fields with reports: BTreeMap<(Rewriter, Report), BTreeSet<String>>, behind three methods: report(rw, kind, uuid), has(rw, kind, uuid) -> bool and uuids(rw, kind) -> impl Iterator.
merge_group_delta merges reports in one loop.
Every .confirmed_x_uuids.insert(u) becomes .report(Rewriter::X, Report::Confirmed, u), and every .contains(u) becomes .has(…). confirm() keeps its exact order of rules.
Deleted: the 27 fields, their doc comments (moved onto the enum variants) and the 27-line destructure/extend in merge_group_delta.
Size and scope
Files: about 330 reference sites in redirect/{mod,gradle,vlt,sbt,pipenv,pdm,poetry,bun_binary,requirements,scala_guidance}.rs, redirect/upstream/gradle.rs, formats/pnpm/hosted.rs, hosted/engine.rs, vex/discover/gradle.rs, the CLI scan/hosted.rs, and the test files that assert on the sets.
Size: about 400–600 changed lines, almost all one-line substitutions.
RewriteResult has no *_uuids field; rg '_uuids\b' crates/socket-patch-core/src/patch/redirect/mod.rs finds no struct field.
merge_group_delta no longer names any ecosystem.
The CLI uses only the accessors.
cargo test -p socket-patch-core is green, including group_equivalence_tests, python_lock_equivalence_tests, pnpm_equivalence_tests, platform_wheel_tests, tests/redirect_golden.rs and tests/redirect_sbt_golden.rs, with no golden changes.
cargo test -p socket-patch-cli is green.
A unit test that rewrite_groups_parallel and rewrite_groups_serial produce equal reports for a mixed npm + PyPI + Cargo fixture.
[agent] Filed by the scheduled architecture audit routine (ecosystems and formats). Register: E31.
Kind: refactor. Source: review Part 3.7 recommendation 2; register E31, child 1 of #1075.
Problem
Verified on main
05ecc6e.RewriteResultcarries 27BTreeSet<String>fields, one per (ecosystem, meaning) pair. Each meaning is spelled anew per ecosystem:confirmed_{bun_binary,cargo,golang,pipenv,pdm,yarn_berry,python_lock,hatch,requirements,vlt,gradle,sbt}_uuidsrefused_{pipenv,pdm,pnpm,bun,yarn_classic,python_lock,vlt,gradle,sbt}_uuidsyarn_berry_uuids,python_lock_uuids,hatch_uuids,gradle_uuidsvlt_foreign_uuids,bundled_skipped_uuidsThey are read and written across 12 production files, including the CLI (
scan/hosted.rs#L1215,#L1245-L1246,#L1339) andvex/discover/gradle.rs.merge_group_deltahas to destructure and extend every one of them. Each new hosted ecosystem adds 1–3 fields, two lines inmerge_group_deltaand new arms inengine::confirm.Impact: no behavior bug. Every hosted ecosystem PR conflicts on the same struct and function.
Proposed change
enum Rewriter { NpmLock, Pnpm, YarnClassic, YarnBerry, Bun, BunBinary, Vlt, Requirements, Hatch, PythonLock, Pipenv, Pdm, Cargo, Golang, Gradle, Sbt, Bundled }andenum Report { Owned, Confirmed, Refused, Foreign }.reports: BTreeMap<(Rewriter, Report), BTreeSet<String>>, behind three methods:report(rw, kind, uuid),has(rw, kind, uuid) -> boolanduuids(rw, kind) -> impl Iterator.merge_group_deltamergesreportsin one loop..confirmed_x_uuids.insert(u)becomes.report(Rewriter::X, Report::Confirmed, u), and every.contains(u)becomes.has(…).confirm()keeps its exact order of rules.merge_group_delta.Size and scope
redirect/{mod,gradle,vlt,sbt,pipenv,pdm,poetry,bun_binary,requirements,scala_guidance}.rs,redirect/upstream/gradle.rs,formats/pnpm/hosted.rs,hosted/engine.rs,vex/discover/gradle.rs, the CLIscan/hosted.rs, and the test files that assert on the sets.confirm()(Tracking: hosted rewriters behind one HostedRewriter trait with a per-dependency outcome #1075 step 2), and any trait (step 3).Acceptance criteria
RewriteResulthas no*_uuidsfield;rg '_uuids\b' crates/socket-patch-core/src/patch/redirect/mod.rsfinds no struct field.merge_group_deltano longer names any ecosystem.cargo test -p socket-patch-coreis green, includinggroup_equivalence_tests,python_lock_equivalence_tests,pnpm_equivalence_tests,platform_wheel_tests,tests/redirect_golden.rsandtests/redirect_sbt_golden.rs, with no golden changes.cargo test -p socket-patch-cliis green.rewrite_groups_parallelandrewrite_groups_serialproduce equalreportsfor a mixed npm + PyPI + Cargo fixture.Dependencies
confirm(), so rebase after Decide whether a hosted patch is pinned through lockfile discovery alone #1058 if that lands first.