enabled: true touches: [crates/generation/src/bin/real_model_run.rs, crates/generation/src/bin/absolute_real_model_run.rs, crates/generation/src/bin/margin_real_model_run.rs, crates/generation/src/bin/percentage_real_model_run.rs, crates/generation/src/bin/float_real_model_run.rs, crates/generation/src/bin/stacking_real_model_run.rs, crates/generation/src/bin/relpos_real_model_run.rs, crates/generation/src/admit.rs] depends-on: [] #
Rewrite the winner import line before it lands inside the layout crate #
All seven *_real_model_run binaries — bin/real_model_run.rs, bin/absolute_real_model_run.rs, bin/margin_real_model_run.rs, bin/percentage_real_model_run.rs, bin/float_real_model_run.rs, bin/stacking_real_model_run.rs and bin/relpos_real_model_run.rs — commit a winning candidate the same way: read the winner text back, unchanged, from sources_dir.join(format!("{}.rs", winner.name)), and write it straight into generated_dir.join(".rs") behind a one-line header, with fs::write(generated_dir.join(...), format!("{header}{winner_source}")). Checked directly against each binary: all seven have this identical block, and none of the seven does anything to the source text first. The track that raised this only named four of the seven, having compared width, margin, percentage and absolute against their committed form; checking the other three the same way shows the identical gap, not a difference.
crates/generation/src/prompt.rs always tells a candidate to write use layout::::{...} — checked directly, build, build_margin_collapse, build_percentage_resolution and build_absolute_positioning each put that exact line in the prompt they build — because a candidate compiles first inside its own standalone crate (candidate_crate::write / write_for), where layout is a normal path dependency (any probe/model_/Cargo.toml shows this). Once a winner is copied into crates/layout/src/generated/.rs, though, it lives inside the layout crate itself, where the same items are reached as use crate::::{...} instead. Confirmed against every seam a *_real_model_run binary has ever committed: generated/width.rs, generated/margin.rs, generated/percentage.rs and generated/absolute.rs each open with use crate::::..., never use layout::.
generated/float.rs, generated/stacking.rs and generated/relpos.rs use the same use crate:: form too, even though all three carry the provenance model claude-code:default rather than a rig gateway model id. prompt::build_floats, build_stacking_order and build_relative_positioning each put the same use layout::::{...} line in their own prompt text, the same as the other four seams, so the only explanation is that whoever committed float.rs, stacking.rs and relpos.rs made the same one-line edit by hand the width/margin/percentage/absolute seams needed, before this gap was ever written down anywhere. touches above covers all seven binaries for this reason.
Fix: a small, shared function — a natural home is crates/generation/src/admit.rs, alongside the rest of what turns an admitted report into a committed file (record_for and its per-seam siblings, write, beats_committed) — that takes the winner source text and returns it with every use layout:: import line rewritten to use crate::. A plain, line-oriented replace of the literal prefix use layout:: with use crate:: is enough for every case seen so far: it matches exactly the one difference (besides the header comment line) between what a *_real_model_run binary would write today and what every one of generated/width.rs, generated/margin.rs, generated/percentage.rs, generated/absolute.rs, generated/float.rs, generated/stacking.rs and generated/relpos.rs actually has committed. Call it from all seven binaries, in place of writing winner_source unrewritten, right before the fs::write(generated_dir.join(...), format!("{header}{winner_source}")) line each already has.
Unit test, placed alongside the existing tests in admit.rs: feed the function a source string that opens with use layout::width::{Direction, WidthInputs, WidthOutputs}; and confirm the returned text opens with use crate::width::{Direction, WidthInputs, WidthOutputs}; and nothing else changed; feed it a second string with no use layout:: line at all and confirm it comes back byte for byte unchanged (a no-op case). A third case worth covering: a source with more than one use layout:: line (a candidate that also imports a helper from another layout module) should get every one of them rewritten, not just the first.
Acceptance: cargo test --workspace must pass. Beyond the unit test, confirm the fix against a real run once, by hand: any *_real_model_run binary that admits a winner should produce a generated/.rs whose imports open with use crate::, never use layout:: — these binaries already skip themselves cleanly with a message when no model endpoint is reachable, so this check only applies on a run where a winner is actually admitted, and can wait for the next such run rather than forcing one.