Skip to content

corpus diff: extra legs and message-insensitive pairing to classify a merge against upstream #53

Closed

Description

@mareklangiewicz

Lab issue (neospector lua/myemmylab*.lua). Part of #17.

Classifying a merge's corpus diff needs more legs than corpus diff A B --against v0251. On 2026-11-18 (fcc0416 merge) the useful split came from comparing five runs per hit (0.25.1, upstream before, upstream after, old fork, merge), matched by file+line+code ignoring the message (message rewording otherwise shows as +/- pairs):

Message-insensitive pairing took "207 merge-only lines" down to 79 real ones. The earlier session's version was ad-hoc and lost; this session's is below (labels hard-coded).

Ask: corpus diff grows extra legs, e.g. --also=LABEL,LABEL printing each leg's count per line, and --by-line (file:line:code, message ignored).

nomsg.py (2026-11-18)
import json, os, sys, collections
ROOT=os.path.expanduser('~/.cache/gndx/emmylua-corpus'); LAZY=os.path.expanduser('~/.local/share/nvim/lazy/')
RUNS=['v0251-1118','up-41366714-1118','up-fcc04166-1118','fork-50b21557-1118','merge-8581c78a-1118']
def load(run,tree):
    try: data=json.load(open(os.path.join(ROOT,run,tree+'.json')))
    except Exception: return None
    if not isinstance(data,list): return None
    c=collections.Counter(); m={}
    for f in data:
        for d in f['diagnostics']:
            k=(f['file'].replace(LAZY,''),d['range']['start']['line']+1,d['code']); c[k]+=1; m[k]=d['message']
    return c,m
tot=collections.Counter()
for tree in sys.argv[1:]:
    rs=[load(r,tree) for r in RUNS]
    if rs[3] is None or rs[4] is None or rs[2] is None: continue
    fork,merge,up=rs[3][0],rs[4][0],rs[2][0]
    for k in sorted(merge):
        if merge[k]>fork.get(k,0) and up.get(k,0)<merge[k]:
            cols=[str(r[0].get(k,0)) if r else '-' for r in rs]
            print(' '.join(f'{c:>2}' for c in cols), f'{k[0]}:{k[1]} {k[2]} {rs[4][1][k][:120]}')
            tot[k[2]]+=1
print(sum(tot.values()), dict(tot))

Activity

  1. mareklangiewicz commented on Nov 18, 2026

    @mareklangiewicz
    OwnerAuthor

    Done in myvi c46ff59 (not pushed). corpus diff A B --also=L1,L2,… --by-line: each changed line ends with [L1=n L2=m …], or - where a leg didn't finish the tree. --by-line pairs hits by file:line and code. Live on fork-50b21557-1118 → merge-8581c78a-1118, with v0251, up-41366714 and up-fcc04166 as legs: 1558 → 1315 changed lines. + lines that up-fcc04166 lacks: 138 → 76 (the issue's looser script: 207 → 79).
    Not done: the lost/upnew/new/crash buckets themselves. With the legs on each line they're a grep. The line shows B's change, not B's count, so "up < merge" isn't exact yet; I can add A→B counts if you want that.

  2. mareklangiewicz commented on Nov 18, 2026

    @mareklangiewicz
    OwnerAuthor

    Pushed (myvi c559c9c includes the follow-up simplify pass; fork e8581ad for #54). Closing: the ask is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions