Repository navigation
fix(regen): normalize emitted artifact at production — fix batch-2 self-host gate (follow-up to #6957) - #6958
Merged
Conversation
… self-host gate Follow-up to #6957. That PR fixed the batch-1 regen_verify gate by normalizing both sides inside verify_stage0_matches (the Rust comparer), but left the required batch-2 gate self_host_realized_comparison_staleness_gate_holds red on main: it byte-compares the same emit-fresh tree (target/v2-emit-fresh-realize/src/*) and cannot re-normalize on its side, so a comparison-side patch cannot reach it. Proven on the #6957 merge run: batch 2 returned Bool(false). Root cause is one normalization gap, so the fix belongs at one place — the produced artifact, not each comparer. rustfmt_generated_crate now pushes every GENERATED_STAGE0_FILES file through standalone rustfmt via stdin (no path-header, no module recursion, fail-closed on rustfmt's non-zero exit) after cargo fmt --all silently skips the non-building faithful-full- regen crate. Both comparers revert to plain byte compare over the already- normalized artifact — one authority, every consumer (Rust verify AND .dag self-host) sees canonical form. Proven by execution on this branch: regen_stage0 --verify reports regen_divergence_count=0, and emit-fresh reproduces all 98 generated files byte-identical to the committed seed (the exact inputs the .dag gate compares). New test normalize_generated_source_erases_rustfmt_reversible_formatting_but_preserves_content carries a green (formatting-only difference vanishes) plus a RED control (x+2 content drift survives normalization). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 20, 2026
briansrls
added a commit
that referenced
this pull request
Jul 21, 2026
Branch merge left regen behind main; restore so self-host gate matches #6958. No strip-scope change. Co-authored-by: Cursor <cursoragent@cursor.com>
4 of 6 tasks
briansrls
added a commit
that referenced
this pull request
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
mainis red on the required gateself_host_realized_comparison_staleness_gate_holds(batch 2 of the self-host fixed-point job) since the #6957 merge — proven on that run:✗ FAIL [batch 2] self_host_realized_comparison_staleness_gate_holds (returned Bool(false)).#6957 greened the batch-1 Rust
regen_verifygate by re-normalizing both sides insideverify_stage0_matches. But batch-2 is a separate.dagcomparer (self_host_realized_comparison) that byte-compares the same emit-fresh tree (target/v2-emit-fresh-realize/src/*) and cannot re-normalize on its side. A comparison-side patch structurally cannot reach it — two forked comparers over one artifact (§3).Root cause (one gap → one authority)
rustfmt_generated_craterunscargo fmt --allon the faithful-full-regen crate, which has non-building modules, so cargo fmt silently skips the emitted files (they surface as cargo errors by design), leaving them as raw emit. The committed seed is rustfmt-normalized. #6848 shifted theglobal_bare_callableregion into a rustfmt-reversible shape (match-arm block wrapping), so raw-fresh differs from the normalized seed by formatting alone → false red.Fix
Normalize at production, not per-comparer.
rustfmt_generated_cratenow pushes everyGENERATED_STAGE0_FILESfile through standalone rustfmt via stdin (no path-header, no module recursion, fail-closed on rustfmt's non-zero exit — an unparseable emit is a hard located error, never a silent skip). Both comparers (verify_stage0_matches,changed_registered_outputs) revert to plain byte compare over the already-normalized artifact.One normalization authority → every consumer (Rust verify and
.dagself-host) sees canonical form.Proven by execution (this branch)
regen_stage0 --verify→regen_divergence_count=0, exit 0 (batch 1).regen_stage0 --emit-freshreproduces all 98 generated files byte-identical to the committed seed — the exact inputs the.daggate byte-compares (batch 2).normalize_generated_source_erases_rustfmt_reversible_formatting_but_preserves_content: green (formatting-only difference vanishes) + RED control (anx+2content drift survives normalization).The committed seed is the rustfmt fixed point and is correct — a reseed to the raw shape would trade regen-red for fmt-red (§7: a byte-identical fixed point is explicitly not the goal).
🤖 Generated with Claude Code