Repository navigation
fix(managed): preserve negative zero in CIL operands - #2437
Merged
Merged
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Owner
|
@greptileai review |
Contributor
|
3 tasks done
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.
Summary
Preserve negative zero in managed CIL floating-point operands so that changing a method from returning
+0to returning-0is reported as a CIL change.Problem and expected behavior
Both
ldc.r4andldc.r8usedString(value), which turns-0into"0". Consequently the instruction anchors and normalized IL hashes were identical for different constants, and member comparison reportedunchangedwith anexact-il-signaturematch. Signed zero must remain observable in the decoded constant and comparisons.No linked issue: this was reproduced directly against base commit
4773c152bwhile reviewing the static managed decoder.Change and scope
Use one floating-point operand formatter at the decoder boundary. It emits
"-0"for negative zero and preserves the existing formatting for other values. Anchors, normalized hashes, and member comparison consume that representation without downstream special cases.Add PE-fixture regressions for both operand widths covering inspection, changed comparisons, distinct normalized hashes, and unchanged comparisons of repeated negative-zero methods.
Contract and boundary impact
ManagedMemberInstructionDecoderfloating-point operand decoding."-0", and a sign-only change is reported aschangedwith dimensioncil.Expected effects:
Evidence and regression coverage
ldc.r4andldc.r8regressions inmanagedMemberComparisonFromMetadata.test.ts, using actual PE bytes and the production inspector/comparator.status: "unchanged",dimensions: [], andbasis: "exact-il-signature".{"operand":"-0","status":"changed","dimensions":["cil"],"sameInputStatus":"unchanged"}Remaining proof gaps: the complete suite/coverage and a stdio MCP session were not run. The compiled CLI and production inspection/comparison boundaries were exercised on Windows.
Observed, derived, and inferred claims remain distinguishable.
Artifact identity, source provenance, and failed attempts remain preserved.
Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.
Validation performed
Windows, Node 24.18.0, npm 11.16.0, locked dependencies:
npm run check— passed (typecheck, build, format, lint/module boundaries, knip, metadata, architecture guards; lint reports 0 errors and 986 warnings).npm run test:focused -- src/dotnet/ManagedCilDecoding.test.ts tests/boundary/providers/managed/managedMemberComparisonFromMetadata.test.ts tests/boundary/providers/managed/managedMemberComparison.test.ts tests/boundary/providers/managed/managedMemberComparisonPartialBodies.test.ts— 58 tests passed across 4 files.npm run verify:test-discovery— all 1004 test files discovered exactly once.node scripts/rea.mjs inspect-managed-members <negative-zero.dll> --jsonandcompare-managed-members <positive-zero.dll> <negative-zero.dll> --json— passed for both widths; same-input negative-zero controls also remained unchanged.git diff --check— passed.Compatibility, safety, and release
Before merge
type(scope): outcome.