Skip to content

ILVerify: soft comparison ignoring IL byte offset drift#19553

Open
techiedesu wants to merge 2 commits intodotnet:mainfrom
techiedesu:ilverify-soft-comparison
Open

ILVerify: soft comparison ignoring IL byte offset drift#19553
techiedesu wants to merge 2 commits intodotnet:mainfrom
techiedesu:ilverify-soft-comparison

Conversation

@techiedesu
Copy link
Copy Markdown

Description

Implements soft comparison for ILVerify baseline checks, as discussed in #18090.

IL byte offsets ([offset 0x...]) in ILVerify output shift whenever code above the error site changes, even though the verification error itself is semantically identical. This causes spurious CI failures on unrelated PRs.

Changes

  • tests/ILVerify/ilverify.ps1: Added Remove-IlverifyOffsets function and a two-level comparison: exact match is tried first; if it fails, a soft comparison (ignoring IL offsets and trailing whitespace) is used as a fallback. Soft match = success with a warning to update baselines. Also cleaned up a misleading comment on the $ignore_errors variable.
  • tests/ILVerify/ilverify.Tests.ps1: New Pester test file — 17 tests covering Normalize-IlverifyOutputLine, Remove-IlverifyOffsets, and end-to-end soft comparison scenarios.
  • DEVGUIDE.md: Documented the soft comparison behavior and the /run ilverify PR comment command.
  • .github/skills/ilverify-failure/SKILL.md: Added section on offset-only differences.

What this does NOT change

The full pseudocode in #18090 also proposed making "baseline does not exist" a success. This PR intentionally leaves that behavior unchanged to keep the scope minimal and the risk low — it can be addressed separately if desired.

Fixes #18090

Checklist

  • Test cases added
  • Performance benchmarks added in case of performance changes
  • Release notes entry updated

This PR only changes CI tooling and documentation — no compiler/FSharp.Core sources were modified. NO_RELEASE_NOTES label is appropriate.


🤖 This PR was researched and implemented with assistance from Claude Code.

Add offset-tolerant fallback to ILVerify baseline comparison so that
changes which only shift IL byte offsets no longer fail CI.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

✅ No release notes required

@techiedesu
Copy link
Copy Markdown
Author

@dotnet-policy-service agree

Invoke-Expression $fn.Extent.Text
}

Describe "Normalize-IlverifyOutputLine" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!
This definitely sets the bar higher for future powershell code changes in this repo 👍

@github-project-automation github-project-automation bot moved this from New to In Progress in F# Compiler and Tooling Apr 9, 2026
@T-Gro T-Gro enabled auto-merge (squash) April 9, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

ILVerify check improvements

2 participants