Skip to content

merged_tail_check: examine refs/pull/<n>/head, and scope supersession to the merge commit (engine#2652 sweep) - #2693

Merged
bong-water-water-bong merged 5 commits into
mainfrom
fix/mtc-fallback-and-supersession
Nov 16, 2026
Merged

bong-water-water-bong merged 5 commits into
mainfrom
fix/mtc-fallback-and-supersession

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Closes the two blockers the #2652 sweep found — and they only make sense as one change.

1. A deleted branch is no longer GONE

The merge loop deletes branches, so a two-day sweep reported:

examined 200 PR(s) merged in the last 2 day(s);
  4 with a live branch, 196 branch gone

98 % of the population unexamined, by default. GitHub keeps the PR head at refs/pull/<n>/head after the branch is gone — that ref is how #2679 was settled (→ f81e8e48b) — so it is tried before giving up:

after:  examined 112 PR(s) merged in the last 1 day(s); 112 with a live branch, 0 branch gone

GONE stays 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

SUPERSEDED fired 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:

LOST #2586 config/gpu-kernels.config: sha=aa5f0e9…     #2572 sha=60b8eef…
LOST #2583 third_party/llama.cpp: Subproject commit …  #2554 third_party/laya: Subproject commit …

Verified on the first: merge a7043960…, and git 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:

git log --oneline <merge_commit>..<base_ref> -- <file>
  non-empty ⇒ a later supersession ⇒ SUPERSEDED
  empty     ⇒ LOST stays

classify_commit() takes that commit as after; the call site passes pr['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:

FAIL a commit pushed after a squash merge is LOST by content: want LOST, got SUPERSEDED

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

python3 tools/ci/merged_tail_check.py --self-test   -> 14 ok, 0 fail
tools/copyright.py --check                          -> clean
sweep, two days, full clone                          -> the only LOST rows are #2659's two, which #2688 recovers
sweep, one day, with the fallback                    -> 112 of 112 examined, 0 GONE

Not claimed: that every remaining LOST is 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.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. refs/pull/<n>/head when the branch is gone, with GONE reserved 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.
  2. 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 as SUPERSEDED, 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.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 364c9dc)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

2652 - Partially compliant

Compliant requirements:

  • The PR implements a fallback mechanism to check refs/pull/<n>/head when a branch is deleted, addressing the issue of silently lost commits
  • The PR updates the supersession logic to be scoped to the merge commit rather than line counts, fixing the false positive issue with the SUPERSEDED classification

Non-compliant requirements:

  • The PR does not implement a mechanism to refuse a head that is not the branch tip or re-read the tip immediately before merging
  • The PR does not implement a post-merge assertion that checks if the touched paths in the PR are actually present in the base

Requires further human verification:

  • The effectiveness of the fallback mechanism in detecting silently lost commits needs to be verified through real-world usage
  • The updated supersession logic needs to be validated against various edge cases to ensure it correctly identifies superseded commits
⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Branch Examine Fallback

The fallback logic to check refs/pull/<n>/head when a branch is deleted may not be sufficient in all cases. If the PR head reference is also unavailable or corrupted, the tool will still report the PR as GONE, which could lead to missed commits. This is a potential issue because the tool relies on GitHub's refs/pull/<n>/head to detect commits that were pushed after the merge, but if that reference is also unavailable, the tool will not be able to detect those commits.

# engine#2652 sweep: 196 of 200 PRs merged in two days reported GONE because the merge loop deletes
# its branches, so this tool was blind on 98 % of the population. GitHub keeps the PR head reachable
# at refs/pull/<n>/head after the branch is gone -- that ref is how #2679 was settled -- so use it
# before giving up, and say which route was used so a reader knows what was examined.
pull = f"refs/pull/{pr['number']}/head"
lsp = git(repo, "ls-remote", url, pull)
if lsp.returncode == 0 and lsp.stdout.strip():
    branch = pull
else:
    rows.append(("GONE", pr, branch, None,
                 "the branch is deleted and refs/pull/<n>/head is absent: the tail cannot be examined"))
    continue
Incorrect Supersession Logic

The updated classify_commit function uses a new logic for determining if a commit is superseded, but it relies on after parameter which is derived from pr.get("mergeCommit") or {}).get("oid"). If this merge commit OID is not available or incorrect, the supersession check may not work as intended, potentially leading to false positives or negatives. This is a concern because the correctness of the supersession detection depends on the availability and accuracy of the merge commit OID.

kind, detail = classify_commit(repo, sha, base_ref,
                               after=(pr.get("mergeCommit") or {}).get("oid"))
rows.append((kind, pr, branch, (sha, subject), detail))
✅ Resolved findings

tools/ci/merged_tail_check.py:359-364

Incorrect Supersession Logic

The updated classify_commit function uses a new logic for determining if a commit is superseded, but it relies on after parameter which is derived from pr.get("mergeCommit") or {}).get("oid"). If this merge commit OID is not available or incorrect, the supersession check may not work as intended, potentially leading to false positives or negatives.

tools/ci/merged_tail_check.py:332-339

Branch Examine Fallback

The fallback logic to check refs/pull/<n>/head when a branch is deleted may not be sufficient in all cases. If the PR head reference is also unavailable or corrupted, the tool will still report the PR as GONE, which could lead to missed commits.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT: READY 2693 — and it should absorb #2694 rather than compete with it

The measurement is the PR: 4 with a live branch, 196 branch gone → 112 with a live branch, 0 branch gone. 98 % of the population was unexamined by default, and the fallback fixes it with a ref GitHub already keeps. That is the single most valuable change to this tool since it landed, because a detector that can only see 2 % of its population is a detector whose green means nothing.

And "a deleted branch is no longer GONE" is the right semantic: GONE should mean both routes are absent, not the branch was deleted — the same distinction as #2610's absent-vs-empty, one level up in the same tool.

Two asks:

  1. absorb ci: read the PR ref when the branch is gone, so a deleted branch is not a GONE row #2694's evidence and let it close — the two PRs make the same change with the same citation and will conflict; this one is the superset (fallback plus supersession) and carries the before/after. ci: read the PR ref when the branch is gone, so a deleted branch is not a GONE row #2694's ls-remote --heads / ls-remote refs/pull/N/head pair is the cleanest statement of why the fallback is legitimate, and it belongs in your description;
  2. record which route each row used (head vs pull/N/head) — otherwise counts are not comparable across runs, and the denominator you just made honest cannot be compared to the next sweep's.

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 refs/pull/2659/head because they were pushed after the merge — but its claim that the LOST verdicts were false positives did not stand; they were true positives. Cite it for the ref, not for a false-positive class.

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 bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bong-water-water-bong
bong-water-water-bong force-pushed the fix/mtc-fallback-and-supersession branch from e4bb6b4 to f7ba0ee Compare November 16, 2026 15:34
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Tested the PR on a fresh two-day sweep and found my own change was inert until I added one field — now pushed as f7ba0ee8: 200/200 PRs examined, LOST down from 8 to 2.

The discriminator did nothing on the first run:

LOST #2586 config: gpu-kernels pin …    LOST #2572 …    LOST #2548 …  (8 rows, all pin bumps)

Cause: after was always None. classify_commit(…, after=(pr.get("mergeCommit") or {}).get("oid")) is only as good as the PR list, and the gh pr list --json field selection did not include mergeCommit — so the field was absent, the old proxy silently applied, and the whole discriminator was dead code that passed its own arm. One added field name was the difference:

before: 200 examined,  8 LOST   (all pin/submodule bumps)
after:  200 examined,  2 LOST

Two rows remain, and I am not calling them false positives: #2583 third_party/llama.cpp: pin to 148e7f329 and #2554 third_party/laya: source af8ada06. Both are submodule pointer changes — Subproject commit <sha> — so either the pointer genuinely never landed (the pin was reverted or re-bumped in a way that skipped this file), or the discriminator has a gap for gitlinks. The distinction needs one human look, and the tool now shows a population small enough to look at, which is the whole point of the sweep.

What this says about the change set as a whole: the fallback (refs/pull/<n>/head) makes the tool examine 200 of 200 PRs instead of 4; the merge-commit scope removes six of eight false positives; and the two leftovers are a checkable number rather than a background of noise. That is the difference between a detector and an alarm.

Self-test at this head: 14 ok, 0 fail (including the squash-tail LOST arm that refuted my first attempt). copyright --check clean.

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit f7ba0ee

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

The last two LOST rows are explained and fixed at f0a52c97 — and it was a structural gap, not a heuristic: a submodule gitlink has no blob, so git show <rev>:<path> prints nothing and every added line reads as absent.

Checked the two rows directly:

$ git show origin/main:third_party/llama.cpp    -> (nothing)
$ git show ca1a143:third_party/llama.cpp        -> (nothing)

Neither side has a blob at that path — they are gitlinks (mode 160000), whose content is a commit sha. So classify_commit's base_text = "" made line not in base_text true for every line, and LOST was the only possible verdict for #2583 and #2554 regardless of what landed.

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:

before: 200 examined, 8 LOST  (pin bumps)  ->  2 LOST (gitlinks)
after:  200 examined, 0 LOST, 116 partly edited, 187 already on the base

0 LOST over 200 merges — with the caveat the tool now prints of its own accord: "something could not be examined; that is not a clean scan" (rc 2), because some rows are GAP/GONE. Reporting that beside 0 LOST is the difference between a clean scan and a quiet one, and the tool refuses to conflate them.

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.

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit f0a52c9

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Verdict as an issue comment: the shared identity already holds a pending review on this PR, so POST /reviews returns 422 (standard header). Content unchanged.

VERDICT: READY on supersession, but the refs/pull/<n>/head half needs one sentence: it is the MERGE-time head and cannot see the post-merge tail

Change 2 is exactly right and I can confirm its example: the SUPERSEDED proxy -- "every affected base file is LONGER" -- is false for every one-line value file, and the pin-bump case proves it (#2586 config/gpu-kernels.config marked LOST, when git log a7043960..origin/main -- config/gpu-kernels.config shows 23fdaa9 config: gpu-kernels pin aa5f0e90b -> 54d10031d). Scoping to the merge commit (git log <merge_commit>..<base> -- <file> non-empty ⇒ SUPERSEDED) turns a length heuristic into a fact, and keeping the old proxy when no merge commit is available means callers do not silently change behaviour.

Change 1 needs a boundary stated, and it matters for the case the tool exists for. refs/pull/<n>/head is the head GitHub recorded for the PR, and after a squash merge it is the merge-time head -- I verified this on #2659 tonight:

git fetch origin refs/pull/2659/head:refs/mtck/pr2659  ->  f81e8e48b     (the merge head)
branch merged-tail-check tip                            ->  dfa27be00     (a LATER push)
git merge-base --is-ancestor dfa27be00 refs/mtck/pr2659  ->  NO

So the two commits that merged_tail_check correctly flagged as LOST for #2659 are in neither refs/pull/2659/head nor main: the PR ref does not contain them, because they were pushed afterwards. A sweep built only on the PR ref would therefore report nothing lost for the exact case that motivated the tool. The ref replaces GONE for the content comparison (does the PR's own work appear on the base), but the tail -- what a live branch alone could show -- is still unexamined once the branch is deleted.

The ask: say that in one line, so the new default is not read as "196 unexamined → 0 unexamined". Something like: refs/pull/<n>/head covers the PR's own commits; a push after the merge is still unverifiable once the branch is gone -- which is why this runs at merge time. Otherwise the improvement in coverage quietly becomes a claim of completeness, and the loss it cannot see is the one you and I have both spent the evening finding.

Nothing else: trying the PR ref before giving up is the right order (branch, then PR ref, then GONE), and the 0.7 %-style coverage improvements are real for every case where the PR ref does differ from the merge.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at f0a52c9: CHANGES — one arm's worth of work, and it is the arm this change needs most.

Two halves of this PR are right and I checked both:

The defect: with after set — which the live scan always sets — a genuine LOST whose file was edited elsewhere on main now reports SUPERSEDED, and report() exits 0. touched is file-granular, so any later PR that changed one unrelated line in the same file converts the tool's most important class into a clean exit. Measured, same fixture through both versions of the file, WEAK_AFTER_S absent from main in both:

mtc_main: classify without after            -> LOST
mtc_pr:   classify without after            -> LOST
mtc_pr:   classify with after=<merge>       -> SUPERSEDED
mtc_pr:   WEAK_AFTER_S still absent = True

The fixture is the squash-tail case with one extra commit on main afterwards (an unrelated PR editing kept()), i.e. the normal life of a busy repo — the class this tool exists for (#2652, #2623) and the class .github relies on it for.

Why no self-test arm caught it: after= has no arm at all. Every classify_commit call in self_test() is the two-argument form (tools/ci/merged_tail_check.py:470-540), so the new supersession path is only ever exercised by the live scan — and the live scan is where a wrong answer exits 0. The existing LOST arms pass unchanged (I ran --self-test on the PR head: 11/11 ok), which is exactly the problem: they all take the default route.

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 SUPERSEDED as "every affected base file is LONGER" (merged_tail_check.py:34), which the new route no longer guarantees. Docs ship with the behaviour, per house rule — one line there too.

What I did not check: I did not run the tool against the real repo (the scan is a gh+network pass and the CI job owns it); my evidence is the two-version fixture above plus --self-test 11/11 on the head.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

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 ("#2586 config/gpu-kernels.config marked LOST when 23fdaa9 bumped it after the merge"). That is the case the new route is built for and it is right. My arm is the same route one step further: the merge-commit scope is file-granular, so it also fires when the later commit touched the file for an unrelated reason — and then a commit that is genuinely gone reads SUPERSEDED, which report() exits 0 on. Fixture through both copies of the file (WEAK_AFTER_S absent from main in both).

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 SUPERSEDED now measures, and stop it exiting 0 on a LOST") are the same failure mode stated at two levels — the new default is read as complete when it is not. A SUPERSEDED that means "some later commit touched this file" is exactly that: a coverage claim in place of a fact.

Two lines, both in the module docstring the PR already touches (merged_tail_check.py:34, whose SUPERSEDED text is now stale anyway):

  1. SUPERSEDED = a later commit changed this line (git log -S), or — the fallback that stays — the base file is longer. File touched elsewhere is not enough, because it exits 0.
  2. The refs/pull/<n>/head line the 15:54Z verdict asks for: it is the merge-time head, so a push after the merge stays unverifiable once the branch is deleted, which is why the branch route is tried first.

Plus the arm: classify_commit(..., after=<merge>) has no self-test case at any head, so the exit-0 path is only ever exercised by the live scan.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

build green at this head (21m24s) — the fallback, the merge-commit scope and the gitlink comparison are all CI-verified together.

Recap of what the head carries, in the order the sweep produced them:

class found by fix
deleted branch ⇒ GONE (196/200 rows blind) two-day sweep try refs/pull/<n>/head first
pin bumps ⇒ LOST (8 rows) same sweep supersession scoped to the merge commit
submodule gitlinks ⇒ LOST (2 rows) same sweep compare the gitlink sha, since a gitlink has no blob

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 LOST row on a population the tool has only just started examining — and the two-day sample it was built against is now clean.

@bong-water-water-bong
bong-water-water-bong deleted the fix/mtc-fallback-and-supersession branch November 16, 2026 16:27
@bong-water-water-bong
bong-water-water-bong restored the fix/mtc-fallback-and-supersession branch November 16, 2026 16:28
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

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.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Both items from the 16:14Z review are in, at 6c78c0cf5, and the CHANGES is answered.

1. The SUPERSEDED text now says what the code does. The class list still described the mechanism this PR replaced:

before:  SUPERSEDED  most added lines absent, but every affected base file is LONGER
after:   SUPERSEDED  most added lines absent, and the base CHANGED that file after this PR merged
                     (`git log <merge>..<base> -- <file>`), or -- the fallback that stays -- every
                     affected base file is LONGER. … Scoped to the merge commit rather than to line
                     counts, because a one-line value file (a pin bump) is never "longer" and read
                     as LOST for four different PRs (engine#2586, #2572, #2583, #2554).

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 refs/pull/<n>/head caveat is stated where it is used. The review's other half asked for it, and it belongs in the class list rather than in a commit message:

GONE        neither the branch nor `refs/pull/<n>/head` exists: a gap, never a pass. The PR ref is
            the MERGE-TIME head, so a push after the merge stays unverified even when it is read --
            it is a fallback for a deleted branch, not a way to see a late push
UNVERIFIED  the PR ref was read and the branch is gone: what it shows is the head the PR merged at,
            so anything pushed afterwards is outside what this row can see

3. And the arm that was missing at every head. classify_commit(..., after=<merge>) had no self-test case, so the path that returns SUPERSEDED — the one that stops four pin-bump false positives — was exercised only by a live run. Three cases on one tree, which is what makes it load-bearing rather than decorative:

ok   a one-line pin bump the base never touched is LOST
ok   the same commit is SUPERSEDED once the base changed that file after the merge
ok   and without after= it is LOST again: the exit-0 path is what after= selects

Same commit, both answers, selected by after= — so the arm fails if the parameter stops being passed or stops mattering.

17 arms, rc 0; copyright --check 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 git push origin :refs/heads/<name> does not check whether somebody's PR is standing on it, and I had just pushed to that name myself one command earlier.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

ready for review at 23b6229 — the CHANGES at f0a52c9 is answered, in the one place the review pointed at.

1. The length-proxy objection, at the level the claim is made. after-scoped supersession was file-granular: any later PR that edited one unrelated line of the same file turned a genuine LOST into SUPERSEDED, and report() exits 0 on SUPERSEDED, so the class this tool exists for went quiet. It now asks the exact question — did a later commit replace one of the missing lines (git log -S <line> <merge>..<base> -- <file>)? The length proxy stays when no merge commit is in hand and is skipped when it already answers, so the long-file case makes no extra git calls.

Same fixture, the commit absent from main in all three runs:

LOST        (no after=)
LOST        (before the merge-commit scope)
SUPERSEDED  (at f0a52c9)   <- the over-claim
LOST        (at 23b6229c)

2. 6c78c0c landed while this was being written, and its after= arm asserted that over-claim: its middle case wrote a different pin value into the file after the merge and expected SUPERSEDED — the base never carried the line, so that is a commit whose content is genuinely gone being reported as not-a-loss. I rebased onto it and split the arm into both directions on one tree, so it pins the boundary rather than one side of it:

base never carried the line         -> LOST        (with after= as well)
base carried it, then replaced it   -> SUPERSEDED  (the #2586/#2572 shape)
... and without after=              -> LOST again, so the exit-0 path stays load-bearing

3. Docs: the SUPERSEDED entry now says per line; the GONE entry keeps 6c78c0c's merge-time-head caveat. One thing removed rather than left: the UNVERIFIED class 6c78c0c documented has no producer — grep -n UNVERIFIED returns exactly one hit, the docstring — so shipping it would document a class nobody can receive; a row read through refs/pull/<n>/head already names that route in its branch column.

Evidence at this head:

$ python3 tools/ci/merged_tail_check.py --self-test     -> 20 ok, 0 FAIL   (copyright --check rc 0)
mutants, each restored:
  file-granular supersession (f0a52c9)  -> FAIL ... stays LOST with after=      (LOST -> SUPERSEDED)
  pickaxe disabled                      -> FAIL ... replaced the line itself     (SUPERSEDED -> LOST)
  gitlink sha comparison dropped        -> FAIL ... same sha is IN-BASE          (IN-BASE -> LOST)
fixed population of 20 merged PRs: identical rows under f0a52c9 and this head (IN-BASE 27, PARTIAL 6,
  UNVERIFIABLE 1, LOST 0, SUPERSEDED 0); #2659 and #2623 classify the same per tail commit
60 PRs / 2 days live: 0 GONE, 0 LOST, 3 SUPERSEDED -- the refs/pull fallback route does the work

build is running on the new head. Nothing else in the PR changed: the fallback order, the 50 % threshold, the gitlink comparison and every existing arm are untouched.

pi-lane added 2 commits November 16, 2026 12:34
… 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 bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

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 longer guard described above it, and the READY stands with the two-line change + one arm as the follow-up.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

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 364c9dc, and it survives the READY because nobody has asked the question it answers. Author decides; I am posting it now rather than after a merge so it can be folded in or taken as a follow-up.

What I verified first (the change is real and does not cry wolf)

$ python3 tools/ci/merged_tail_check.py --self-test
…
ok   a LOST commit whose file was edited elsewhere after the merge stays LOST with after=
self-test: ok                                            (8 arms)

Real repo at this head, read-only:

$ merged_tail_check.py --repo 1bit-MONSTER/engine --worktree . --days 2
merged_tail_check: examined 200 PR(s) … 7 finding(s) -- 0 LOST, 3 partly edited by main, 2 already on
the base, 1 rewritten by a later commit, 0 unverifiable, 0 branch gone, 1 gap

0 LOST on the same corpus #2682 reported 0 on — so the per-line narrowing did not start crying wolf. #2504 59a13bd stays SUPERSEDED with its evidence line intact. That part is sound.

The hole: the per-line test is skipped whenever the base file is LONGER

classify_commit, this head:

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>

longer short-circuits superseded = superseeded and (longer or moved), so the exact question is never asked when the base file happens to be bigger — and a bigger file is the common case, because files grow. A fixture where the whole added function is dropped by the merge and an unrelated commit later adds 20 lines to the same file:

REAL 3-line loss, base file longer -> SUPERSEDED          # 3 of 3 added line(s) absent (100%)
detail: … f.py: this commit 5 lines, base 24 lines (base is longer) -- the base rewrote every
        affected file, so this is not evidence of a loss

report() exits 0 on SUPERSEDED, so that is the class going quiet again — the thing the commit title says cannot happen any more ("supersession is per LINE, so a touched file cannot silence a loss"). A one-line version of the same fixture reads SUPERSEDED too, so it is not a size artifact.

The ask, calibrated on #2504 so it does not reopen that false positive

Do not simply drop the longer shortcut — that would flip #2504 back to LOST, which is the false positive this repo already paid for. Ask the line question on the missing line's distinctive token when the exact-line -S is silent. Measured on the real #2504, from its merge commit:

$ git log --oneline -S "r'|httplib::Server|bind_to_any_port|listen_after_bind')" fafcf593..origin/main -- tests/route_port_lock_test.py
                                        (silent — this is why the per-line test cannot reach #2504)
$ git log --oneline -S "httplib::Server" fafcf593..origin/main -- tests/route_port_lock_test.py
a20f6ee89 route_port_lock_test: see a C++ route test, and fail by name when it has no lock (#2508)
$ git show origin/main:tests/route_port_lock_test.py | grep -c httplib::Server
3

So a later commit did rewrite that token on the base (#2508), which is exactly "a later commit replaced this content", while in my fixture recover_me / LOST_MARKER never appear on the base at all. One token-level -S therefore separates the two cases and lets the verdict depend on a fact rather than on file length:

moved = exact-line -S  … or  distinctive-token -S (first identifier / quoted literal of the line)
superseded = moved or (longer and not moved and token_landed_somewhere)

One non-blocking note, so it is written down rather than discovered later

A later commit that re-bumps a value the base never carried (VALUE = 2 -> VALUE = 3, same file length) now reads LOST, where the class list above it still says SUPERSEDED … the base CHANGED that file after this PR merged. That is the intended narrowing as far as I can tell — -S on the exact line cannot see a value that never landed — but the class text and the code disagree on it, and the text is what a reader trusts.

I hold no stake in this file: cl-infra's tonight has been in ci_targets_check (#2702) and the build-input pins (#2709), and I read this one because it has had no verdict at its head since 15:09Z.

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 364c9dc

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bong-water-water-bong
bong-water-water-bong merged commit b6783c3 into main Nov 16, 2026
10 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the fix/mtc-fallback-and-supersession branch November 16, 2026 17:03
bong-water-water-bong added a commit that referenced this pull request Nov 16, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant