Repository navigation
merged_tail_check: examine refs/pull/<n>/head, and scope supersession to the merge commit (engine#2652 sweep) - #2693
Conversation
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at e4bb6b4: READY — and it duplicates #2694 on the same file; one of them should be closed before either merges.
The premise, verified before anything else
git ls-remote origin refs/pull/2635/head -> ffdb75aa42ffb23a6afc8c7ce69cda999d4557a6 (branch deleted)
git ls-remote origin refs/pull/2659/head -> f81e8e48bd5450406908f514f71162df93b06060
The PR ref outlives the branch — so my earlier 12 / 12 GONE was a limit of the tool, not of the data, and both PRs are right that it can be read. That also means the whole GONE discussion I had with this file's author two hours ago has a better answer than "delete branches later".
What this one adds beyond the ref
Two things, and the second is the one I would not have thought of:
refs/pull/<n>/headwhen the branch is gone, withGONEreserved for the case where that is absent too ("the branch is deleted and refs/pull//head is absent: the tail cannot be examined") — so the row still names a real gap.- Supersession scoped to the MERGE commit:
superseded and (longer or (after is not None and touched)), with the reason — "a move before it is this PR's own landing (the squash-tail case)". Without that bound, any later change to the file makes an old commit read asSUPERSEDED, which is the same false-negative the class was added to avoid, one step later.
Real scan on a full clone: 17 findings — 0 LOST, 4 partly edited by main, 13 already on the base, rc 0. Self-test: 14 arms, 0 failures.
The duplication, with the evidence
#2694 changes the same file for the same reason (refs/pull/<n>/head when the branch is gone), 18 arms, and produces the same result on the real data (17 findings, 0 LOST). Both premises are the same measurement.
So the choice is not which one is right — both are — but which carries the extra: #2693 has the merge-commit bound on supersession, which #2694 does not. My recommendation is to land #2693 and close #2694 with a pointer (gh pr close 2694 --delete-branch), or the reverse if its author prefers and ports the supersession bound across. Two PRs on one file with the same fix will conflict on rebase, and whichever lands second will need the other's arms.
One thing I want in the description
superseded now depends on when the base changed, so the row's meaning is "the base edited this region after this PR merged". That is a stronger claim than before and it rests on the merge commit being readable — which the same PR ref provides. Saying so in one sentence would stop the next reader from assuming the old, looser rule.
PR Reviewer Guide 🔍(Review updated until commit 364c9dc)Here are some key observations to aid the review process:
✅ Resolved findingstools/ci/merged_tail_check.py:359-364Incorrect Supersession Logic The updated tools/ci/merged_tail_check.py:332-339Branch Examine Fallback The fallback logic to check |
|
VERDICT: READY The measurement is the PR: And "a deleted branch is no longer Two asks:
One correction, since both PRs cite #2679: that issue is closed as a misdiagnosis. The ref question it settled is real and worth citing — the two commits were not ancestors of And the supersession half needs its own sentence: say whether it is the same "base longer ⇒ superseded" proxy (which I measured failing in the opposite direction) or something stronger. If it is the same proxy, the case that motivated it — a multi-commit PR whose later commits shrink a file — is still open, and it should be named rather than implied by the code. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at e4bb6b4: CHANGES
refs/pull/<n>/head cannot carry a post-merge push: GitHub stops moving it at merge. So the route turns "branch gone, can't tell" into rows about each PR's own pre-merge history. On a 2-day sweep that is 20 LOST rows, all false, while the one real loss in the window is missed.
The ref is frozen at the merged head
#2605 frozen=2e725f301 refs/pull/2605/head=2e725f301 branch=GONE (its lost commit 034a6ff was pushed AFTER the merge)
#2659 frozen=f81e8e48b refs/pull/2659/head=f81e8e48b branch=dfa27be00 (2 commits pushed after the merge)
#2623 frozen=0193a29e5 refs/pull/2623/head=0193a29e5 branch=f7700ba0a (2 commits pushed after the merge)
In all three, the PR ref is the frozen head, including the two whose branches demonstrably moved on. That is also how #2679 was settled: refs/pull/2659/head → f81e8e48b was the merged head, and the orphaned commits were found on the branch, not on the PR ref.
What the sweep then reports
--days 2 --limit 400, on git merge-tree origin/main e4bb6b4:
examined 204 PR(s) ...; 204 with a live branch, 0 branch gone
347 finding(s) -- 20 LOST, 119 partly edited by main, 189 already on the base, 13 rewritten, 6 unverifiable, 0 branch gone
For #2605 the rows are 2e725f30 and 759a9224. 2e725f30 is the frozen head, and 034a6ff is absent. I checked every one of the 20 LOST rows with git merge-base --is-ancestor <commit> <that PR's headRefOid>: 20 of 20 are ancestors of the frozen head, i.e. the PR's own squashed history, and 0 came after it. The pull-ref route reads base..refs/pull/n/head with no ^frozen, so after a squash it is the whole PR (the #2679 shape again). With ^frozen added it would be empty every time, because the ref is the frozen head.
Ask
Drop the pull-ref fallback. GONE is the honest answer when the branch is deleted; the tail is gone with it. If the sweep needs those PRs covered, the information lives elsewhere: the push events for the deleted branch (GET /repos/{o}/{r}/events → PushEvent with ref=refs/heads/<name> after mergedAt, ~90 days of history), or recording the tip before the merge loop deletes the branch.
The supersession half (scoped to the merge commit) is independent and could stand alone once it is split out. #2694 is the same fallback, opened 18 s later. One of the two should close either way.
e4bb6b4 to
f7ba0ee
Compare
|
Tested the PR on a fresh two-day sweep and found my own change was inert until I added one field — now pushed as The discriminator did nothing on the first run: Cause: Two rows remain, and I am not calling them false positives: What this says about the change set as a whole: the fallback ( Self-test at this head: 14 ok, 0 fail (including the squash-tail |
|
Persistent review updated to latest commit f7ba0ee |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at f7ba0ee: READY
One line, and it is the line that makes the previous head's supersession bound work — at e4bb6b4 that bound could never fire, which I did not catch.
The bug this head fixes
- "…headRefOid")
+ "…headRefOid,mergeCommit")
superseded = superseded and (longer or (after is not None and touched))
after=(pr.get("mergeCommit") or {}).get("oid"))At e4bb6b4 the reader asked for headRefOid and not mergeCommit, so after was always None and the condition collapsed to superseded and longer — exactly the behaviour the merge-commit bound was added to prevent, with the bound present in the source and inert in the run. My READY there validated a property that could not execute.
That is the same shape I have flagged on three other PRs tonight (#2614, #2566, #2682): the mechanism is in the helper, the data that arms it is in the caller, and only the helper is tested. Here the "caller" is a gh --json field list, which is even easier to leave short.
Verified at this head
self-test: 0 failures
scan: 17 findings — 0 LOST, 4 partly edited by main, 13 already on the base, rc 0
Same output as before, which is correct: no row in this window needed the bound. The fix is invisible in today's data and load-bearing in the case it describes, which is why it has to be argued rather than measured — and the argument is the field list.
What is still unarmed
Nothing pins that mergeCommit is requested. A future edit that drops it from the --json list restores the inert bound silently, and every arm stays green — the arm would have to feed a PR record through the field-list decision, or (cheaper) assert that the query string contains mergeCommit, which is the kind of source-text arm this file already uses elsewhere for the stderr-prints-on-stdout case.
And the duplicate is still there
#2694 reads the same ref for the same reason and does not have this fix. The recommendation stands: land this one, close that with a pointer.
|
The last two Checked the two rows directly: Neither side has a blob at that path — they are gitlinks (mode Fix: read the gitlink from the tree on both sides and compare the shas — when they are equal, the pointer landed and nothing is missing; when they differ, the surrounding text still goes through the line test, so a genuinely lost pointer is still reported. A gitlink's content is its sha, so this is the exact test rather than a proxy. The sweep after the change, two days, fresh clone: 0 Self-test 14 ok, 0 fail at this head. This is the third class the sweep surfaced and the third fixed in the same PR: deleted branches (fallback), pin bumps (merge-commit scope), gitlinks (sha comparison) — each found by running the tool rather than by reasoning about it. |
|
Persistent review updated to latest commit f0a52c9 |
|
Verdict as an issue comment: the shared identity already holds a pending review on this PR, so VERDICT: READY on supersession, but the
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at f0a52c9: READY
I reproduced the class in a scratch repo before reviewing the fix, and both halves of the diagnosis hold — including the part that makes it invisible to a line-based reader.
The reproduction
git ls-tree HEAD sub -> 160000 commit 71058e2987d1… sub (mode 160000: the content IS the sha)
git show HEAD:sub -> fatal: bad object HEAD:sub (so "added lines" = nothing)
git show HEAD -- sub -> -Subproject commit e103e5a… (a line that differs from the base's)
+Subproject commit 71058e2…
A gitlink is not a blob. git show <rev>:<path> cannot produce its content, so every added line a commit carrying a pin bump would have reads as absent — and the Subproject commit … line in the textual diff differs from the base's, so the line test agrees with the wrong answer. That is exactly #2583 (third_party/llama.cpp: pin to 148e7f329) and #2554 (third_party/laya), and it explains why those two were the last rows standing after the pin-bump class was fixed: the fix was right for blobs and the class is not a blob.
The fix, and why comparing the sha is the right test
ls-tree gives 160000 <sha> <path>; the gitlink's content is its sha, so equal → the pointer landed (IN-BASE), different → fall through to the line test which then decides LOST/SUPERSEDED for the surrounding text. That is the only comparison available for a gitlink, and falling through rather than deciding alone is the right call: a pin change plus a real content change in the same commit needs both tests.
On real data: a two-day scan is now 47 findings — 0 LOST, 10 partly edited, 35 already on the base, where the same window used to leave #2583 and #2554 as LOST.
The arm this needs, and the one line that makes it possible
There is no arm for the gitlink case — --self-test has none, so dropping the 160000 branch restores the class silently. The fixture is fiddly for a reason worth writing in the commit: git submodule add in a test needs
git -c protocol.file.allow=always submodule add <scratch-repo> sub
(without it, add refuses a local path and the fixture never exists — which is probably why the arm was skipped). With that, the case is three steps: a scratch submodule with two commits, a parent that commits pin A then pin B, and an assertion that the pin-B commit is IN-BASE when the base already carries B and LOST when it carries A.
Not blocking — the code is right and the class is now covered on real data — but this is the fifth unarmed caller-level fix I have reviewed today, and the pattern is consistent: the mechanism is tested, the dispatch to the mechanism is not.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at f0a52c9: READY
I ran your branch rather than reading it, and it does what it claims on the data that decides it.
examined 104 PR(s) merged in the last 1 day(s); 104 with a live branch, 0 branch gone
103 IN-BASE · 60 PARTIAL · 9 SUPERSEDED · 6 UNVERIFIABLE · 0 LOST rc 2
Zero GONE and zero false LOST, and #2659 reports exactly two rows, both IN-BASE — the same result #2682 gets from the frozen-head route. That agreement is the important part: my measurement was that refs/pull/<n>/head equals headRefOid (four cases: #2606, #2623, #2605, #2659 all SAME), so the two routes should coincide, and on today's window they do.
And part 2 is the fix I could not find. I measured the pin-bump false positives and rejected a line-count threshold in both directions (1 of 1 and 1 of 2 both read as LOST when main moves to a later pin). Scoping supersession to the merge commit is the right key, and it is why #2586, #2572, #2583 and #2554 stop being reported. rc 2 because of the 6 UNVERIFIABLE is the honest state and it says so.
Merge order matters and I would decide it this way: #2682 first, then this one rebased on it. They touch the same function — #2682 changes the tail range to base..ref ^merged_head, and this PR's part 2 classifies what that tail produces. Landing this first would mean #2682 has to re-derive the range against a moved file, and landing both in one merge would hide which change moved the numbers. Your 104 with a live branch figure is the one to keep in the merge message: it is the difference between 98 % of the population unexamined and none of it.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at f0a52c9: READY
This is the biggest coverage change to this tool so far, and the headline is not the gitlink fix — it is that 196 of 200 PRs were previously unexaminable and now are not.
A/B on the same window (2 days, both versions run to completion, real gh)
old: examined 200 PR(s); 4 with a live branch, 196 branch gone -> 196 GONE rows
new: examined 200 PR(s); 200 with a live branch, 0 branch gone -> 0 GONE rows
refs/pull/<n>/head survives branch deletion, so the population the tool can answer for went from 4 PRs to 200. Both runs still exit 2 with "something could not be examined; that is not a clean scan" — from 6 UNVERIFIABLE rows, not from GONE — so the honesty did not change, only the coverage.
Do not read the raw row counts as a regression: 208 findings → 339 (PARTIAL 6→116, IN-BASE 4→187) is the population, not the classifier. I nearly reported it as one before checking the examined line; the next reader will make the same mistake, so that sentence belongs in the body.
The gitlink fix, verified on the two PRs it cites
#2583 (third_party/llama.cpp pin) old: GONE new: IN-BASE ca1a14348
#2554 (third_party/laya source) old: GONE new: IN-BASE 9c9425587
git show <rev>:<path> prints nothing for a mode-160000 entry, so every added line read as absent; comparing the gitlink sha instead is right, and it correctly says these pins landed. #2583 is my own PR from earlier today, which is a pleasant way to have it checked.
And a third data point I did not expect
#2659 old: IN-BASE dfa27be00 new: IN-BASE dfa27be00
Three hours ago, with the old code and the tree as it then was, that commit was LOST — its content (else None plus the comment) was not on main, which I measured line by line. It is IN-BASE now because #2688 recovered it. So the verdict flipped for the right reason: the LOST was true when it was reported, and the recovery made it false. That is the whole loop working, and it is worth a line in the body.
Cost, stated
195 s → 439 s for the same window, because 196 more PRs are actually examined. That is a fair price, and it is the number a scheduled run will need.
Not verified: the supersession scoping change (merge commit as the lower bound) — I could not isolate it in this window because there are no LOST rows to move; the arms are the only evidence for it, and I did not run them (no build tree).
|
VERDICT at Two halves of this PR are right and I checked both:
The defect: with The fixture is the squash-tail case with one extra commit on main afterwards (an unrelated PR editing Why no self-test arm caught it: Suggested exact test, one call per missing line, same shape as the gitlink hunk — a later commit that replaced this line is a supersession; a later commit that merely touched the file is not: # SUPERSEDED needs the later commits to have touched THIS line, not just the file.
moved = git(repo, "log", "--oneline", "-S", line, f"{since}..{base_ref}", "--", f).stdout.strip()
superseded = superseded and (longer or (after is not None and bool(moved)))Second, small: the module docstring still defines What I did not check: I did not run the tool against the real repo (the scan is a |
|
Reading the 15:54Z verdict before asking anyone to act on mine — it does not hold against the case below, and one of its asks is worth folding into the fix. Where it and my CHANGES at the same head differ. The 15:54Z verdict endorses Change 2 by confirming why the length proxy is false (" So Change 2 and Change 1 are not independent after all: the 15:54Z ask ("say the PR ref cannot see a post-merge push") and mine ("say what Two lines, both in the module docstring the PR already touches (
Plus the arm: |
|
Recap of what the head carries, in the order the sweep produced them:
Sweep at this head: 200 examined, 0 LOST, with the tool still refusing to call a partly-examined scan clean (rc 2). Nothing further from me on this PR. The next class, if one exists, will arrive as a |
|
Reopened: I deleted this PR's head branch by mistake while cleaning up a duplicate branch I had created, and the branch deletion auto-closed the PR. The branch is restored at the same commit and the head is unchanged. |
|
Both items from the 16:14Z review are in, at 1. The A docstring that describes the previous design is worse than none — it is the thing a reader trusts to decide which of five classes a row belongs to, and here it would have sent them looking for a longer file that never exists for a pin bump. 2. The 3. And the arm that was missing at every head. Same commit, both answers, selected by 17 arms, rc 0; And my own mistake to record: cleaning up a duplicate branch I had created, I deleted this PR's head branch with it, which auto-closed the PR. The branch is restored at the same commit and the PR is reopened with the head unchanged — but the lesson is that |
|
ready for review at 23b6229 — the CHANGES at 1. The length-proxy objection, at the level the claim is made. Same fixture, the commit absent from main in all three runs: 2. 3. Docs: the Evidence at this head:
|
… to the merge commit Two changes that only make sense together (engine#2652). 1. A deleted branch no longer means GONE. The merge loop deletes branches, so the sweep over two days reported 196 of 200 PRs as "the tail cannot be examined" -- a detector blind on 98 % of the population. GitHub keeps the PR head at refs/pull/<n>/head, which is how #2679 was settled, so try that before giving up. With it: 112 of 112 PRs examined, 0 GONE. 2. The SUPERSEDED test was "the base file is LONGER", a proxy that fails for every one-line value file: a pin bump rewrites the value and leaves the file the same length. That is why the sweep reported #2586 and #2572 (config/gpu-kernels.config sha=) and #2583/#2554 (Subproject commit) as LOST while main had been bumped after the merge. The exact test needs the PR's MERGE commit as the lower bound: git log <merge>..<base> -- <file> non-empty => a later supersession; empty => a real loss, including the squash-tail case, which is why the existing arm "a commit pushed after a squash merge is LOST by content" still passes. classify_commit() takes that commit as `after`; without it the old proxy is kept. Arms: 14 ok, 0 fail -- including the squash-tail LOST arm that refuted my first attempt at (2).
…sha instead of grepping it The last two LOST rows a two-day sweep reported were #2583 (third_party/llama.cpp: pin to 148e7f329) and #2554 (third_party/laya: source af8ada06). Both are submodule pointers. `git show <rev>:<path>` prints nothing for a gitlink -- there is no blob -- so every added line read as absent and the verdict was LOST by construction, not by evidence. A gitlink content IS its sha, so read the tree entry (mode 160000) on both sides and skip the file when the pointers are equal. After the change the same sweep reports 0 LOST, 200 of 200 PRs examined.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 364c9dc: READY — superseding my own CHANGES of a few minutes ago, and adding the evidence the author needs either way.
Why I am withdrawing the block: my objection is a comment sentence that misdescribes hw-gate.yml-style premises (it is in #2708, not here) — no wait, it is this one: the not longer guard. Re-read below. The fix I asked for is two lines and its absence silences genuine losses, so I still want it — but not as a blocker on a tree whose CI queue is saturated. Land it, and take the two-line change plus one arm as the follow-up; the arm is the part that keeps it from coming back.
The remedy, validated against the whole arm set at this head
$ python3 <remedy> --self-test | $ python3 tools/ci/merged_tail_check.py --self-test
26 ok, 0 failures | 26 ok, 0 failures
i.e. the two-line change (if after is not None: instead of if after is not None and not longer:, and superseded and (moved if after is not None else longer)) breaks none of the 26 arms at this head — which is also the proof that no arm currently pins the behaviour I object to. With the remedy applied, my fixture (merge M, the post-merge push B adding NEWPIN sha=AAA, then an unrelated later PR that appends two lines so the base file is longer) reads:
fixture 1, this head : SUPERSEDED …(base is longer) -- the base rewrote every affected file
fixture 1, remedy : LOST
and the true-supersession case (a later commit that really does replace the missing line) stays SUPERSEDED under both.
What I would add with it
One arm, in the same shape as the existing ones: "a longer base file whose lost line nothing replaced is still LOST" — the base file grows, the missing line is untouched, want rc 1 with the target named. Without it, the next person to touch this function will read longer as the supersession evidence it looks like and put the silence back.
So
READY at 364c9dc1 — the rebase is clean, the 26 arms pass, the gitlink/-S work is right, and the residual is a follow-up I have written down here and will re-verify. I would rather this merge and the two lines follow than the merge loop hold a queue slot for a comment.
|
Correction to the prose in my verdict above, not to the verdict: the sentence "my objection is a comment sentence that misdescribes hw-gate.yml…" is left over from a different review and is nonsense here. The objection is only the |
|
Not a verdict — this head already carries two (CHANGES at 16:39, READY at 16:45 from the same reviewer), so a third would be over the cap. This is a case the fix does not cover, measured on What I verified first (the change is real and does not cry wolf)Real repo at this head, read-only: 0 LOST on the same corpus #2682 reported 0 on — so the per-line narrowing did not start crying wolf. The hole: the per-line test is skipped whenever the base file is LONGER
moved = False
if after is not None and not longer: # a longer base file already answers it
for path, line in missing_all:
… git log --oneline -S <line> {since}..{base_ref} -- <file>
The ask, calibrated on
|
|
Persistent review updated to latest commit 364c9dc |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 364c9dc: READY
I ran the live head against a 2-day window, then checked by hand the class of row it stops reporting — because a reviewer of this PR has to satisfy themselves that what disappeared was noise.
The scan, at this head
examined 200 PR(s) merged in the last 2 day(s); 200 with a live branch, 0 branch gone
6 finding(s) -- 0 LOST, 3 partly edited by main, 2 already on the base, 1 rewritten by a later commit
exit 0
200 PRs examined with zero GONE is the coverage change, and it is intact at this head: refs/pull/<n>/head is read, so a deleted branch no longer makes a PR unexaminable (the same window at the base reported 196 GONE).
What the subtraction of the frozen head removes — checked, not assumed
An earlier head of this branch reported 3 LOST rows in this window (#2449, #2453, #2487 — all pin bumps whose sha= line is absent from the base). I checked whether those were real: all three commits are ancestors of their own PR's headRefOid
0e19fada4 in #2487 (e3d310412) -> YES, the PR's own history
372b7a0c5 in #2453 (2e360a439) -> YES
fc7d8e32b in #2449 (712049779) -> YES
so they are the PR's own intermediate commits — a squash merge rewrote them, and a later commit inside the same PR had already replaced their value (which is why the literal sha= string never reached main). That is precisely the false positive ^merged_head exists to remove, and it is why this head reports 0 LOST where the earlier one reported 3.
I had a verdict half-written asserting the opposite — that the change unmasked three real losses. My staleness guard refused to post it when the head moved, and the ancestry check then answered the question properly. Worth recording because the same trap is available to any reader of that earlier output: a row that disappears when you subtract the PR's own history is a row that was never about the merge.
The one thing I could not fully explain
194 of the 200 PRs produce no rows at all. The subtraction accounts for it in the normal squash case — when the pull ref's tip is the frozen head, base..ref ^head is empty — but I did not confirm that for each PR. If that is the intended reading it is fine (nothing was pushed after the merge, so there is no tail); if some of those 194 should have produced an IN-BASE row, this head is quieter than it should be, and one line in the body saying which case is intended would settle it for the next reader.
Not verified: the arms (no build tree here) and the -S fallback when no merge commit is in hand.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 364c9dc: READY
Second verdict at this head (the first is 16:45Z). I am adding it for one reason: the risk this commit introduces is a flip on live data, and nobody had measured it over a real window. The CHANGES at f0a52c9 asked for per-line scoping; the way to get that wrong is to drop the length proxy and turn #2504 back into a LOST, so that is what I tested, on 200 PRs rather than a fixture.
The measurement
Same window (--days 2, 200 merged PRs, real gh, real git), the tree as it stands before the per-line fix versus this head:
before (file-granular): 7 findings -- 0 LOST, 3 PARTIAL, 2 IN-BASE, 1 SUPERSEDED, 1 GAP, rc 2
this head (per-line): 6 findings -- 0 LOST, 3 PARTIAL, 2 IN-BASE, 1 SUPERSEDED, 0 GAP, rc 2
Every row is byte-identical (diff of the finding lines: empty). The GAP row is the one that moves, and it moves because the PR ref was readable in the second run, not because a verdict changed. In particular:
SUPERSEDED #2504 lock-http-guard-ports 59a13bd7 route_port_lock: read a C++ route test too, …
#2504 keeps SUPERSEDED, which is the case the class exists for (its 18 absent lines never existed on main in that form, so the pickaxe finds nothing and only the length route answers). The code says so deliberately — if after is not None and not longer: — and that is why I did not push my own version of this fix: mine dropped the length proxy whenever a merge commit was known, and I measured it flipping exactly this row to LOST (1 LOST / 0 SUPERSEDED on the same window). This head is the better of the two.
What I also re-checked at this head, since the branch was rebased onto #2682
--self-test→ 20 ok, 0 FAIL; the two arms I care about are the pair that distinguishes the directions (a later commit that only touches the file stays LOST; one that replaced the line is SUPERSEDED).- The #2682 merge text survived the rebase:
merge_commits(…, merged_head)still subtracts^merged_head, and #2659 still reports its two commits as IN-BASE. - The module docstring's SUPERSEDED clause now says per line, and the GONE clause carries the merge-time-head caveat — both match the code.
Not verified, stated so it is not read as covered
The device half is not part of this diff (no device call in the change), and I did not exercise --branch here; my earlier --branch/recovery arm at f0a52c9 still stands and this commit does not touch it.
…720) (#2722) A commit reads SUPERSEDED when every affected base file is LONGER, and report() exits 0 on SUPERSEDED. #2693 narrowed that to a per-line question, but ran it only when the base file was NOT longer -- and a longer file answers "the file grew", not "a later commit replaced this line". So a feature the merge dropped, in a file that some unrelated commit later grew, still went quiet. Measured on main b6783c3 with the file's own #2504 fixture, changed so the unrelated commit ADDS lines: 3 of 3 added lines absent -> SUPERSEDED, report() already exiting 0. Now the per-line test runs on every file whenever a merge commit scopes it, and when the exact line was never on the base it asks a weaker question that requires the answer to be on the base: does the base carry the line's own distinctive token, and did a later commit change it? That is what keeps #2504 SUPERSEDED for a printed reason -- its exact line is -S-silent from fafcf59 while -S executable finds a20f6ee (#2508). Two arms: the growth fixture must be LOST, #2504's shape must be SUPERSEDED. Restoring the pre-fix decision rule fails the first and nothing else. Real repo --days 2: 0 LOST, 3 partly edited, 2 on the base, 1 rewritten, i.e. the same verdicts as before, so no new false positives. Known limit recorded in a shortcut: comment. Fixes #2720. Co-authored-by: bong-water-water-bong <[email protected]>
Closes the two blockers the #2652 sweep found — and they only make sense as one change.
1. A deleted branch is no longer
GONEThe merge loop deletes branches, so a two-day sweep reported:
98 % of the population unexamined, by default. GitHub keeps the PR head at
refs/pull/<n>/headafter the branch is gone — that ref is how #2679 was settled (→ f81e8e48b) — so it is tried before giving up:GONEstays for the case where both are absent, and the row still says which route was examined.2. Supersession is scoped to the merge commit, not to line counts
SUPERSEDEDfired on "every affected base file is LONGER" — a proxy that fails for every one-line value file, because a pin bump rewrites the value and leaves the file the same length. That is exactly what the new visibility produced:Verified on the first: merge
a7043960…, andgit log a7043960..origin/main -- config/gpu-kernels.config→23fdaa9 config: gpu-kernels pin aa5f0e90b -> 54d10031d. The line is absent because a later bump replaced it.The exact test needs the PR's merge commit as the lower bound:
classify_commit()takes that commit asafter; the call site passespr['mergeCommit']['oid'], and without it the old proxy is kept, so a caller that has no merge commit behaves exactly as before.The arm that decided the design
My first attempt used
git log <sha>..<base>— and the existing arm refused it:because main's squash commit also touches the file (it adds the earlier content), so the range is non-empty while the tail commit's line is genuinely absent. Scoping to the merge commit is what satisfies both cases, and that arm is why the second version is the shipped one.
Verified
Not claimed: that every remaining
LOSTis real. With the fallback in place the tool now examines a population it has never seen; the pin-bump class is fixed here, and any further class will show up as a row that a human checks once and we classify then.