You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lab: corpus diff folds "same message moved ≤3 lines" pairs #4
gndx emmylua corpus diff reports some pairs as removed-and-added when they are really one hit that moved a line or two. The message is the same and the line differs by ≤3. They flip from run to run, for example gitsigns compat.lua 144↔152, nvim lsp/util.lua 1830↔1831, snacks diff.lua 283↔284 (the root cause is #9). They bury the real changes.
Want
Fold such pairs into a separate "moved" section, or just a count, with a flag to show them. The --summary totals should leave them out of added/removed.
Category: enhancement Summary:gndx emmylua corpus diff folds a hit that only moved by ≤3 lines into a separate "moved" count instead of reporting it as one removed line plus one added line
Where: the gndx emmylua lab in neospector (myvi). Pure logic is in the myemmylab module (myemmylab.diff, myemmylab.hits, myemmylab.message_key), the command is in myemmylabcli (corpus diff), and the ONest tests are in myemmylabtree.
Current behavior: myemmylab.hits keys every diagnostic as file:line code message_key and counts them. myemmylab.diff compares the two runs' counts per key, so a hit that the engine reports one line lower in B (for example gitsigns compat.lua 144↔152, nvim lsp/util.lua 1830↔1831, snacks diff.lua 283↔284) shows up twice: as -1 …:1830 … and +1 …:1831 …. It is also counted under its code as +1 and −1. These pairs flip from run to run (cause tracked in #9) and bury the real changes.
Desired behavior:
Within one tree, a removed unit and an added unit are a moved pair when file, code and message key are equal and the two lines are at most MOVE_WINDOW (= 3) apart. Expose the window as a constant on the module.
Pairing is per unit of count: 2 removed and 1 added on nearby lines make 1 moved pair, and 1 removal stays a change. When several pairings are possible, pair each removal with the nearest addition, with ties broken deterministically (for example the lower line). The same input must always give the same output.
Moved pairs are left out of Diff.lines and out of Diff.by_code. Diff.totals stays the raw diagnostic count on each side.
Diff gains the moved pairs (or their count plus a list) so the CLI can report them. With --against, moved pairs are not tagged and are not counted in against.
corpus diff prints one line, corpus diff: N moved hit(s) (≤3 lines) folded, next to the totals line (also with --summary), and a new --moved flag lists the folded pairs (tree: file:A->B code message).
Refusals (problems) and the exit codes (0 = compared, 2 = not comparable) do not change.
Key interfaces:
myemmylab.Diff: new field holding the moved pairs. Keep lines, by_code, totals, problems and against meaning what they mean today, minus the folded units.
myemmylab.MOVE_WINDOW: the 3-line window.
corpus diff's cmdmeta: the new --moved boolean, documented like --summary.
Acceptance criteria:
A new ONest case in myemmylabtree shows the old behaviour fails first: a hit at line 1830 in A and at 1831 in B gives no lines and no by_code entry, and one moved pair.
A move of exactly 3 lines folds; a move of 4 does not.
A different message key, code or file on the nearby line does not fold.
2 removed + 1 added nearby → 1 moved pair and a -1 line.
Two runs of diff on the same input give identical output (deterministic pairing).
With a reference run, folded pairs are absent from against counts.
gndx spector tree passes, and gndx spector check emmylua is clean.
A real gndx emmylua corpus diff <old> <new> --summary on two existing corpus labels prints the moved line (record the numbers in the issue).
Activity
gndx emmylua, Lua-side gates) #17mareklangiewicz commentedon Nov 17, 2026
Agent Brief
Category: enhancement
Summary:
gndx emmylua corpus difffolds a hit that only moved by ≤3 lines into a separate "moved" count instead of reporting it as one removed line plus one added lineWhere: the
gndx emmylualab in neospector (myvi). Pure logic is in themyemmylabmodule (myemmylab.diff,myemmylab.hits,myemmylab.message_key), the command is inmyemmylabcli(corpus diff), and the ONest tests are inmyemmylabtree.Current behavior:
myemmylab.hitskeys every diagnostic asfile:line code message_keyand counts them.myemmylab.diffcompares the two runs' counts per key, so a hit that the engine reports one line lower in B (for example gitsignscompat.lua144↔152, nvimlsp/util.lua1830↔1831, snacksdiff.lua283↔284) shows up twice: as-1 …:1830 …and+1 …:1831 …. It is also counted under its code as +1 and −1. These pairs flip from run to run (cause tracked in #9) and bury the real changes.Desired behavior:
MOVE_WINDOW(= 3) apart. Expose the window as a constant on the module.Diff.linesand out ofDiff.by_code.Diff.totalsstays the raw diagnostic count on each side.Diffgains the moved pairs (or their count plus a list) so the CLI can report them. With--against, moved pairs are not tagged and are not counted inagainst.corpus diffprints one line,corpus diff: N moved hit(s) (≤3 lines) folded, next to the totals line (also with--summary), and a new--movedflag lists the folded pairs (tree: file:A->B code message).problems) and the exit codes (0 = compared, 2 = not comparable) do not change.Key interfaces:
myemmylab.Diff: new field holding the moved pairs. Keeplines,by_code,totals,problemsandagainstmeaning what they mean today, minus the folded units.myemmylab.MOVE_WINDOW: the 3-line window.corpus diff's cmdmeta: the new--movedboolean, documented like--summary.Acceptance criteria:
myemmylabtreeshows the old behaviour fails first: a hit at line 1830 in A and at 1831 in B gives nolinesand noby_codeentry, and one moved pair.-1line.diffon the same input give identical output (deterministic pairing).againstcounts.gndx spector treepasses, andgndx spector check emmyluais clean.gndx emmylua corpus diff <old> <new> --summaryon two existing corpus labels prints the moved line (record the numbers in the issue).Out of scope:
gndx emmylua triage(Lab:gndx emmylua triage: label each new hit fork-only / upstream-too / pre-merge-too #2), which will build on this.mareklangiewicz commentedon Nov 17, 2026
Done in myvi 197bc96 (neospector
myemmylab.diff+corpus diff --moved). Not pushed yet.myemmylab.MOVE_WINDOW = 3;Diff.moved= sortedtree: file:A->B code message, left out oflines,by_codeandagainst;totalsstay raw.emmylab/diff/moves(6 cases, all red on the old code first).gndx spector tree1088/1088,gndx spector check emmyluaCLEAN.Real run,
gndx emmylua corpus diff fix3-9629b372 fix4-c6fd72f0:assign-type-mismatch +2 -2+1 -1,1 moved hit(s) (≤3 lines) folded(snackspicker/source/diff.lua:284->283)compat.lua144↔152 is 8 lines apart, so it stays a change. Widening the window for it would be a separate decision.up-2c400ee2 fix4-c6fd72f0: 7 folded, but that pair is refused anyway (upstream crashed on 5 trees).