Registry Mirror
Skip to content

Conversation

@siegfriedpammer

@siegfriedpammer siegfriedpammer commented Aug 29, 2026 •

Copy link
Copy Markdown
Member

Problem

Two things stood between wanting a decompdiff run and having one, and both were manual work that is easy to get wrong.

Preparing the sides. Comparing two commits meant creating a worktree for each by hand first. That is most of the effort of running the tool, and a checkout carrying a stale Release build is reused silently — the dll timestamp in the header line was the only thing that said so.

Getting a corpus. Neither tool had a way to obtain one. nugetfuzz-all.ps1 walks the catalog in publish order, which suits a crash sweep but makes a poor readability corpus, so the alternative was picking package ids by hand.

Solution

--old / --new also take a commit-ish — branch, tag, sha, FETCH_HEAD — resolved against the repository the tool is run from and checked out into a worktree under ~/.cache/decompdiff/<repo>/<commit>:

dotnet run decompdiff.cs -- --old master --new fix/my-branch -o report @corpus.txt

git fetch origin pull/4071/head
dotnet run decompdiff.cs -- --old origin/master --new FETCH_HEAD -o report @corpus.txt
  • Paths keep priority over refs, so an existing directory never changes meaning.
  • The worktrees are kept, keyed by commit: the Release build inside one is what a rerun would otherwise repeat. A second run of the same pair went from ~10 minutes to 2.4s here.
  • A mistyped ref previously fell through to an unhandled ArgumentException; bad specs now print the message and exit 1.

nuget-top.ps1 downloads the most-downloaded packages with their dependency closures and writes the corpus list:

./nuget-top.ps1 -Count 200

The ids come from an empty search query, which orders by download count. The downloading is nugetfuzz --download-only (new flag), so version resolution, TFM matching and the dependency walk behave exactly as in a sweep and only the decompiling is skipped.

It writes a list of lib directories rather than one root on purpose: a package already restored on the machine is used from the machine-wide NuGet cache instead of being copied into ours, and a corpus pointed at a single directory would silently omit those.

Corpus entries can come from an @file, the spelling nugetfuzz already uses for its package list — one entry per line, # comments allowed, dlls or directories. Passing the list as $(cat ...) is a bourne shell construct that does not work on Windows, so the shell is left out of it:

dotnet run decompdiff.cs -- --old master --new my-branch -o report @crawl/top-200.corpus.txt
  • At least one test covering the code changed

TestTools is in no solution and not built by CI, so there is no test project to extend. Verified by running: sha pair, branch-name pair, FETCH_HEAD against a PR, the worktree-reuse path, the bad-ref path, and the whole loop end to end — nuget-top.ps1 -Count 8 into a decompdiff run that reported 8 assemblies with per-package changed-type counts.

Written by Claude Code (claude-opus-5) on behalf of @siegfriedpammer; runs reproduced locally.

Comparing two commits meant preparing a worktree for each by hand before the
tool could be called, which is most of the work of running it and easy to get
wrong: a checkout carrying a stale Release build is reused silently, and the
timestamp in the header line was the only thing that said so.

--old and --new now also take anything git can resolve to a commit, checked
out into a worktree under ~/.cache/decompdiff keyed by that commit. The
worktrees are kept because the Release build inside one is what a rerun would
otherwise repeat: a second run of the same pair drops from minutes to seconds.
Paths keep priority over refs, so an existing directory never changes meaning.

Assisted-by: Claude:claude-opus-5[1m]:Claude Code
Both tools need a corpus of real assemblies and neither had a way to get
one: nugetfuzz-all.ps1 walks the catalog in publish order, which is fine for
a crash sweep but makes a poor readability corpus, and the alternative was
picking package ids by hand.

The ids come from an empty search query, which orders by download count.
Downloading them reuses nugetfuzz, which already resolves versions, matches
target frameworks and walks the dependency closure into the same cache
decompdiff reads; --download-only stops it before it decompiles, since the
sweep is the expensive part and a corpus only needs the files.

The result is a list of lib directories rather than a single root, because a
package already restored on this machine is used from the machine-wide NuGet
cache instead of being copied into ours, and a corpus that silently omitted
those would misrepresent what was tested.

Assisted-by: Claude:claude-opus-5[1m]:Claude Code
Handing the corpus over as `$(cat list)` is a bourne shell construct, so the
one invocation the tools print and the README documents did not work on
Windows. nugetfuzz already reads its package list from an @file for the same
reason; decompdiff now takes its corpus entries the same way, leaving the
shell out of it entirely.

Assisted-by: Claude:claude-opus-5[1m]:Claude Code
@siegfriedpammer
siegfriedpammer merged commit e13e953 into master Aug 29, 2026
15 checks passed
@siegfriedpammer
siegfriedpammer deleted the feature/decompdiff-git-refs branch August 30, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant