Add an xunit compile-back gate over the fixture green set#610
Merged
Conversation
The compile-back oracle (decompile -> recompile -> compare IL) only ran as a console exploration mode in the harness. Wire it into CI as a durable regression guard. Expose CompileBack.Evaluate: a non-printing, structured-result entry point that shares all of the skeleton-emission and opcode-comparison machinery with the existing console Run, so the two paths cannot drift. The test project links the single CompileBack.cs source file (rather than taking a project reference on the harness Exe, which would pull in a second entry point) and adds the Roslyn package it needs. CompileBackGateTests asserts two properties over CfgSampleClass: - no method newly recompiles to a different opcode stream beyond the documented KnownDiffs docket (catches a fix in one method silently degrading another); - previously-fixed methods (CheckedAdd #604, UnsignedShift #606, Shadowed #607) stay opcode-exact. Shrink KnownDiffs as docket entries are fixed; StaleFieldRead remains a tracked defect (issue #605). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
What
Promotes the compile-back oracle (decompile → recompile → compare IL) from a
console-only harness mode into a durable CI regression gate.
Why
Compile-back is the only rail that verifies semantic fidelity — that decompiled
C#, recompiled, produces the same IL. A body that parses, binds, and reads
plausibly but recompiles to a different opcode stream changed the program, the
worst failure class, invisible to
--compile-checkand--grade-source. Untilnow it only ran when someone manually invoked
--compile-back; nothing stopped aregression from landing.
How
CompileBack.Evaluate: a non-printing, structured-result entry point thatshares all of the skeleton-emission and opcode-comparison machinery with the
existing console
Run, so the two paths cannot drift.Runis untouched.CompileBack.cssource file (rather thana project reference on the harness Exe, which would pull in a second entry point)
and adds the Roslyn package it needs.
CompileBackGateTestsasserts two properties overCfgSampleClass:NoNewOpcodeDiffsBeyondKnownDocket— fails if a method newly recompiles to adifferent opcode stream beyond the documented
KnownDiffsdocket. Catches a fixin one method silently degrading another.
PinnedFixesStayOpcodeExact—CheckedAdd(Add the compile-back oracle and fix dropped overflow checks #604),UnsignedShift(Drop the redundant width mask on a shift count #606), andShadowed(Qualify shadowed instance field loads with this. #607) must stay opcode-exact.KnownDiffsis the open docket and shrinks as fixes land. StaleFieldRead stays atracked defect (#605).
Verification
main.ILInspector.Decompiler.Testssuite green (428 passing).Part of the compile-back oracle docket (#604). Related: #605.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com