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
Tracking: hosted rewriters behind one HostedRewriter trait with a per-dependency outcome #1075
[agent] Filed by the scheduled architecture audit routine (ecosystems and formats). Register: E31.
Kind: tracking. Source: review §2.1 and Part 3.7 recommendation 2; register E31.
Problem
Verified on main 05ecc6e. Hosted mode has no rewriter abstraction. Each rewriter is a free function fn(&BTreeMap<String,String>, &[DepOverride], &mut RewriteResult), and each one reports which patches it pinned by writing to its own field of a shared struct.
RewriteResult now holds 27 per-ecosystem uuid sets (20 at the review): for example confirmed_cargo_uuids, refused_pdm_uuids, yarn_berry_uuids, vlt_foreign_uuids, gradle_uuids, confirmed_sbt_uuids and refused_sbt_uuids. There are four meanings, spelled ad hoc per ecosystem:
owned: this rewriter decides the uuid (yarn_berry_, python_lock_, hatch_, gradle_);
engine::confirm is 225 lines. It is an ordered chain of 25 ProbeStep outcomes keyed on purl prefixes, pdm_drives(files), vlt_drives, binary_bun, sbt::maven_confirmation and those sets. Precedence is encoded only by the order of the ifs (vlt before binary bun, pdm before hatch, sbt before Gradle).
The CLI reads four of the sets directly (scan/hosted.rs#L1215, #L1245-L1246, #L1339). vex/discover/gradle.rs and upstream/gradle.rs also reach into the Gradle sets.
rewriter_groups is a hand-wired Vec<Box<dyn Fn>> of 11 groups. Each rewriter filters its own deps with string compares (ecosystem == "…": 12 in redirect/mod.rs, 15 in hosted/engine.rs).
Adding an ecosystem to hosted mode still means editing these parallel tables:
formats::registry::REGISTRY;
upstream::format_of and restore_pass;
engine::file_ecosystem;
memory::select::classify;
roots::UNSUPPORTED_MARKERS;
rewriter_groups;
the RewriteResult fields, merge_group_delta and confirm().
The sbt support added in #690 shows the cost: two new sets, new fields in merge_group_delta, and a three-way sbt/Gradle/pom precedence block inside confirm().
Symptoms
Precedence bugs between rewriters that share an ecosystem are decided by the order of the ifs in confirm(). Examples are the pdm/hatch ordering comment and vlt beside bun.lockb, both fixed after the fact.
2. Move the driver rules (pdm_drives, vlt_drives, binary_bun, sbt::maven_confirmation) into one driving_rewriter(ecosystem, files) table, and reduce confirm() to "driver's report, else needles". Behavior-preserving; guarded by the existing confirm tests and group_equivalence_tests.
[agent] Filed by the scheduled architecture audit routine (ecosystems and formats). Register: E31.
Kind: tracking. Source: review §2.1 and Part 3.7 recommendation 2; register E31.
Problem
Verified on main
05ecc6e. Hosted mode has no rewriter abstraction. Each rewriter is a free functionfn(&BTreeMap<String,String>, &[DepOverride], &mut RewriteResult), and each one reports which patches it pinned by writing to its own field of a shared struct.RewriteResultnow holds 27 per-ecosystem uuid sets (20 at the review): for exampleconfirmed_cargo_uuids,refused_pdm_uuids,yarn_berry_uuids,vlt_foreign_uuids,gradle_uuids,confirmed_sbt_uuidsandrefused_sbt_uuids. There are four meanings, spelled ad hoc per ecosystem:yarn_berry_,python_lock_,hatch_,gradle_);vlt_foreign_, plusbundled_skipped_.merge_group_deltadestructures and extends every field by hand.engine::confirmis 225 lines. It is an ordered chain of 25ProbeStepoutcomes keyed on purl prefixes,pdm_drives(files),vlt_drives,binary_bun,sbt::maven_confirmationand those sets. Precedence is encoded only by the order of theifs (vlt before binary bun, pdm before hatch, sbt before Gradle).scan/hosted.rs#L1215,#L1245-L1246,#L1339).vex/discover/gradle.rsandupstream/gradle.rsalso reach into the Gradle sets.rewriter_groupsis a hand-wiredVec<Box<dyn Fn>>of 11 groups. Each rewriter filters its own deps with string compares (ecosystem == "…": 12 inredirect/mod.rs, 15 inhosted/engine.rs).Adding an ecosystem to hosted mode still means editing these parallel tables:
formats::registry::REGISTRY;upstream::format_ofandrestore_pass;engine::file_ecosystem;memory::select::classify;roots::UNSUPPORTED_MARKERS;rewriter_groups;RewriteResultfields,merge_group_deltaandconfirm().The sbt support added in #690 shows the cost: two new sets, new fields in
merge_group_delta, and a three-way sbt/Gradle/pom precedence block insideconfirm().Symptoms
ifs inconfirm(). Examples are the pdm/hatch ordering comment and vlt besidebun.lockb, both fixed after the fact.confirm()but keepsconfirm()itself.Impact: every hosted ecosystem change touches the same three hot spots, which serializes concurrent hosted PRs on
mod.rsandengine.rs.Target design
confirm()becomes: if the driving rewriter for the candidate's ecosystem reported a status, use it, otherwise use the needle probe.Outcomeaccessors, never per-ecosystem fields.Checklist (each item one PR)
reportsmap keyed by(Rewriter, Report), behind accessors. Mechanical, with no behavior change;merge_group_deltabecomes one loop.pdm_drives,vlt_drives,binary_bun,sbt::maven_confirmation) into onedriving_rewriter(ecosystem, files)table, and reduceconfirm()to "driver's report, else needles". Behavior-preserving; guarded by the existingconfirmtests andgroup_equivalence_tests.trait HostedRewriterand port the rewriters group by group (JS, Python, then one per remaining ecosystem).rewriter_groupsbecomes a registry. This lands after the Move patch/redirect/mod.rs's inline test modules into sibling test files #1011 / Tracking: split patch/redirect/mod.rs into per-ecosystem modules and sibling test files #1010 file split, so each port touches one file.engine::file_ecosystem,memory::select::classifyandupstream::format_offrom the registry, deleting the hand tables.ecosystem == "…"filters: the registry hands each rewriter its own deps.Dependencies
confirm()), so land Decide whether a hosted patch is pinned through lockfile discovery alone #1058 first or rebase on it.