Body normalisation: per-method similarity score + leaf delta

Turns the dispatch axis from a binary changed/unchanged into a "how much" measure
of code change — the original goal. ams.normalize compares two body fingerprints
(the ordered leaf-call anchors) with difflib after collapsing consecutive-duplicate
anchors (a load-twice codegen artefact), yielding a 0-100 similarity and the exact
leaves that appeared/vanished.

Every dispatch `changed` entry now carries body={similarity, added, removed}, and the
block carries a summary={shared, identical, changed, mean_similarity}.

Golden pair (cross-compiler): 470 shared bodies, 131 identical, mean 66% similar;
Animo SHOW/HIDE/PAUSE/RESUME come out 100% despite MSVC6 vs MSVC8, LOAD 50% with the
swapped leaves spelled out.

- normalize.py: canonical / body_similarity / body_delta
- diff: _dispatch_diff enriches changed with body + adds summary
- render: METHOD BODIES shows %, leaf delta, summary line
- UI: similarity % + leaf delta + axis summary
- tests: 5 new -> 34/34

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Patryk Gensch
2026-05-31 13:23:15 +02:00
parent 27399a52b1
commit b0d3d22445
7 changed files with 198 additions and 18 deletions

View File

@@ -97,6 +97,8 @@ body { background: var(--bg); color: var(--fg); font: 13px/1.45 var(--mono); }
.r-chg::before { content: "~"; color: var(--chg); }
.r-del { color: var(--dim); }
.delta { color: var(--chg); }
.simpct { color: var(--accent); font-weight: 600; }
.axsum { margin-left: auto; color: var(--dim); font-size: 11px; }
.empty { color: var(--dim); font-style: italic; }
.moved { color: var(--accent); }