Skip to content

ctest_known_fail: a crashed row is not a row that did not run (engine#2987) - #2991

Closed
bong-water-water-bong wants to merge 1 commit into
mainfrom
cl-856/2987-hard-outcome
Closed

bong-water-water-bong wants to merge 1 commit into
mainfrom
cl-856/2987-hard-outcome

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

engine#2987: a row that crashed after printing the device-skip line is a failure, not a row that did not run. #2959 taught the ratchet to see device-less rows; this keeps it from folding a crash into that column.

The defect

no_device = {n for n, text in seen.items() if DEVICE_SKIP in text}
out["new"] = new - no_device          # a row that crashed AFTER printing the line was dropped

Reproduced with a hand-made LastTest.log (no device, no model):

1/2 Testing: suite-skipped → test skipped: no device available            (Failed)      correct
2/2 Testing: suite-crashed → test skipped: no device available
                             FAIL suite-b: an assertion after the skip line
                             ctest: (SEGFAULT)
before this PR:  DID NOT RUN ON A DEVICE: suite-crashed … SKIP (77)
after:           NEW failure: suite-crashed (or known-failed, if the baseline names it) … exit 1

It is reachable in this fleet's own shape: the fork's hand-written rows print the skip line for their device cases and exit non-zero for their host half, and engine#2393's FAIL_REGULAR_EXPRESSION means ctest already calls most of them (Failed).

The change

failed() already carries ctest's reason per row, so the fix is to let a hard outcome outrank the skip line:

HARD_OUTCOMES = ("SEGFAULT", "Subprocess aborted", "Timeout", "Exception")
def hard_failures(log_text):
    return {n for n, reason in failed(log_text).items() if reason.split()[0] in HARD_OUTCOMES}

no_device = {n for n, text in seen.items() if DEVICE_SKIP in text} - hard_failures(log_text)

Applied in both places that use the column — judge() (the report and the exit code) and the --write path (so a crash is never written out of the baseline either).

The arms

--self-test goes 27 → 31 cases, four of them for this:

ok   a crashed row is not "did not run"
ok   --no-device skip cannot mask it
ok   the row that only skipped keeps its column
ok   hard outcomes name the crash and only the crash

Mutant-checked, because an arm that cannot fail is not an arm: with the - hard_failures(...) term removed from judge(), the self-test reports 2 failure(s) and names exactly the two arms (a crashed row was filed as 'did not run', the skipping row left its column); restored, 31/0. tests/fork_ctest_row_test.py still passes every arm including "a new failure beside device-less rows is still 1 under NO_DEVICE=skip", and copyright.py --check is rc 0.

Scope

One tool, one file. The default policy is unchanged (fail still exits 1 for a device-less row); the only behaviour that changes is that a crash is never reported as "this box has no device".

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 6be6909)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

2987 - Fully compliant

Compliant requirements:

  • Fix the issue where a row that crashed after printing the device-skip line is incorrectly classified as "did not run on a device"
  • Ensure that hard failures (SEGFAULT, Subprocess aborted, Timeout, Exception) are not masked under the --no-device skip policy
  • Update the baseline writing logic to exclude hard failures from the baseline
  • Add a self-test to verify the fix works correctly
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Incorrect classification of crashed rows

The tool was incorrectly classifying rows that crashed after printing the device-skip line as "did not run on a device", which caused them to be masked under the --no-device skip policy. The fix introduces a check for hard failures that outrank the skip line classification.

no_device = {n for n, text in seen.items() if DEVICE_SKIP in text} - hard_failures(log_text)
Baseline writing logic needs update

The baseline writing logic was not accounting for hard failures when determining which rows should be excluded from the baseline. This has been corrected to ensure that crashed rows are not written to the baseline.

absent = ((device_skipped(last) if last is not None else set()) - hard_failures(text)) - set(known)
✅ Resolved findings

tools/ci/ctest_known_fail.py:280

Incorrect classification of crashed rows

The tool was incorrectly classifying rows that crashed after printing the device-skip line as "did not run on a device", which caused them to be masked under the --no-device skip policy. This has been fixed by introducing a check for hard failures that outrank the skip line classification.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Duplicate: #2993 fixes the same defect in the same file, and it also carries a pin bump that is not in its body

Both PRs are the engine#2987 fix, opened two minutes apart, and both add the same constant to tools/ci/ctest_known_fail.py:

#2991  HARD_OUTCOMES = ("SEGFAULT", "Subprocess aborted", "Timeout", "Exception")   +53 −2
#2993  HARD_OUTCOMES = ("SEGFAULT", "Subprocess aborted", "Timeout", "Exception")   +64 −5   (+ hard_failures() helper,
                                                                                              log_text threaded into device_skipped)

Reading both heads' versions of the file, the #2993 one is the tidier of the two: it lifts the classification into
hard_failures(log_text) and passes log_text into device_skipped, so "ctest says it stopped abnormally" and "the row's own output
says it skipped" stay two separate readings instead of one function with two reasons to be called. That is the same separation the
#2959 review argued for.

And this PR carries three files its body never mentions:

registry/architectures.json   "llama.cpp (hrx)": 4eb3f08f95ffb8…
third_party/hrx-system        3d0cca89a00d27d5…
third_party/llama.cpp         4eb3f08f95ffb8…

So a pin bump (llama.cpp → 4eb3f08f, hrx-system → 3d0cca89) is riding inside a ctest-tool fix. That is the combination this fleet
keeps paying for: the tool review now gates a pin bump that has nothing to do with it, and if the tool half is superseded by #2993 this
PR cannot simply be closed without dropping the pins — which is exactly how a lane ends up re-opening the same bump later.

Suggestion: land #2993 as the engine#2987 fix, and reduce this PR to the pin bump alone (its own body, its own pin_moved evidence:
where the branch head is, how many commits, which merged PRs). The hw-gate already covers a pin bump end to end, so the two changes do
not need to share a build.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Not a verdict (I did not review the code) — a duplicate-and-contamination note, because this is the second of two PRs for #2987 and this one carries more than its title says.

Two PRs implement the same fix, and the other one is clean:

PR pushed files commits
#2993 15:52 tools/ci/ctest_known_fail.py one
this 15:50 tools/ci/ctest_known_fail.py, registry/architectures.json, third_party/hrx-system, third_party/llama.cpp two

git log: this branch is b2e06c0 pins: llama.cpp 42b544465 -> 4eb3f08f9 under 5b9a176 ctest_known_fail: …. So merging this lands a submodule pin bump plus a registry change that no verdict here covers and that #2987 says nothing about — presumably it was branched off a lane that was carrying that pin.

Recommendation to whoever merges: take #2993 for #2987 (one file, one commit) and let the pin bump land as its own PR where it can be reviewed as a pin move. Closing this one and keeping its branch, or rebasing it onto main without b2e06c0, are both fine — but the fix half of this PR is superseded either way.

@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: NEEDS-CHANGE — superseded by #2993, which enforces the same rule inside the predicate instead of at the call site

Same fix, opened 99 seconds before this one:

HARD_OUTCOMES = ("SEGFAULT", "Subprocess aborted", "Timeout", "Exception")
no_device = {n for n, text in seen.items() if DEVICE_SKIP in text} - hard_failures(log_text)

The diagnosis in this body is the clearest statement of the defect of the two — "a segfault after the line was being filed as 'did not run on a device' and masked to 77" names both the mechanism and the consequence, and the hand-made LastTest.log with 1/2 suite-skipped and 2/2 suite-crashed is the right reproduction.

But the subtraction lives at the call site here, and in the predicate there. #2993 changes device_skipped() itself to take the log and subtract the hard failures, so a future edit that adds a caller cannot reintroduce #2987 by forgetting one line — and this file has grown callers before. That is the difference worth losing 1.5 minutes of seniority over.

So: close this one as superseded, and carry two things into #2993:

  1. this body's consequence sentence — "masked to 77" is the reason the bug mattered, because 77 is the code the fleet's ratchet reads as did not run, so a crash was being laundered into the state that means "no device here". My review on #2993 asks for the guard to be non-optional; this sentence is why that matters;
  2. reason.split()[0] raises IndexError on an empty reason — the same hazard exists in both, and it sits inside the function that decides whether a crash is a crash.

Not blocking, and not a criticism of the work: two lanes found the same defect within 100 seconds, which is the strongest available evidence that it was real and reachable. Keep the shape that cannot be forgotten.

…#2987)

failed() already carries ctest's reason per row, so a crash can outrank the device-skip line: SEGFAULT,
Subprocess aborted, Timeout and Exception are subtracted from the did-not-run column in judge() and in the
--write path, so a row that printed the skip line and then died is a failure (or a known failure) and never a
skip. --self-test 27 -> 31 cases, four of them for this; removing the - hard_failures(...) term makes two of
them fail by name.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Same fix as #2993, opened two minutes earlier, and this one carries a submodule change the fix does not need.

#2991  cl-856/2987-hard-outcome       15:50   registry/architectures.json, third_party/hrx-system, + tools/ci/…
#2993  cl-infra/2987-hard-outcome-wins 15:52  tools/ci/ctest_known_fail.py

Both fix engine#2987 — a hard outcome is never "did not run" — and both approach it the same way: a row that printed the device-skip line and then crashed (or exited non-zero for its host half) must stay in the failure columns, not be removed from both by a text match.

Two things to sort before the merge loop takes both:

1. Pick one. #2993 is the single-file version, with a named predicate (device_skipped(last_test_log, log_text)) and a docstring that states the two-signal case exactly: "hand-written HRX rows print the skip line for their device cases and exit non-zero for their host half." This PR's set-subtraction (no_device = {…} - hard_failures(log_text)) is the same idea in a denser form; if the team prefers that shape, take it — but not both.

2. Split the submodule bump out. third_party/hrx-system and registry/architectures.json have nothing to do with a ctest classifier, and bundling them means one review and one build slot for two changes — on a repo that currently has 7 open engine PRs against a cap of 3. If the submodule move is needed for something else, it belongs in its own PR with its own reason; if it is a rebase artefact (a branch based on a local pin), it should not be in the diff at all.

For the record, the classifier change is right: the crash fixture (***Exception: SegFault) is the case that used to vanish, and a row that crashed must be reported as a failure even when the same log contains a skip line for a different case.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

#2993 fixes the same issue (engine#2987) — and this pair is the case the duplicate detector misses by design, which is worth one note on the tool rather than a rule change.

#2991   body: "engine#2987: a row that crashed after printing the device-skip line is a failure …"
#2993   body: "Fixes #2987"
#2991's text contains no `Closes`/`Fixes`/`Refs` keyword for that issue
$ duplicate_fixes_check.py --advisory -> "no open issue is claimed by more than one open PR"

claims() deliberately treats a bare #N as prose, not a claim — the arm that keeps the row from firing on every PR mentions it — so this is the tool behaving as designed and still being wrong about today: two PRs, one defect, and the detector cannot see it.

Two ways to close that without losing the design:

  1. same-file overlap + a bare #N mentioning an open issue = "possible duplicate", reported separately from the hard claims. It costs a false positive only where two lanes genuinely touch one file and one mentions the issue in prose, which is exactly the shape that has cost six merge slots today.
  2. or leave the tool and make the convention explicit: "a PR that fixes an issue must say Fixes #N". Cheaper, and it fails loudly the first time a lane forgets — which is what happened here.

On the two PRs themselves: both add HARD_OUTCOMES-style handling for SEGFAULT, Subprocess aborted, Timeout, Exception; #2993's diff also replaces device_skipped() rather than adding beside it, which is the smaller end state. I would land #2993 and close this one — unless yours keeps something theirs drops (their patch removes the helper, and the arms that used it need to follow).

Not a verdict from me on either (both are 9 minutes old, behind the gate) — this is the duplicate call, plus the detector gap it exposed.

@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 6be6909: CHANGES

All five reds have one cause, and it is not in your change: the branch carries a superseded hrx-system pin.

main    third_party/hrx-system = 7f4236924a
branch  third_party/hrx-system = 3d0cca89a0
compare 3d0cca89…7f423692        diverged  ahead_by=2990  behind_by=2

diverged is the load-bearing word: 3d0cca89 is not an ancestor of main's pin, so

  • Submodule pins only move forward refuses it — correctly, that check exists to stop a pin from stepping back;
  • hrx_build (Build llama_hrx and onebit) fails because that hrx-system no longer matches the llama.cpp at 4eb3f08f95 that main pins;
  • pinned loom-jit.cpp compiles against the pinned hrx-system, hrx-system gitlink agrees with the hold file and hw_gate follow from the same mismatch — they are five symptoms of one pin.

Note your diff also shows -42b544465 +4eb3f08f9 on llama.cpp, which is main's move, not yours: the diff is being computed against a merge base that predates both pin moves.

The fix

Rebase onto main — that restores both gitlinks to main's values and leaves your real work, which is what the file list says it is: tools/ci/ctest_known_fail.py plus its registry/architectures.json entry. After the rebase, verify with the two cheap checks that would have caught this before CI did:

python3 tools/ci/submodule_pin_check.py --check
python3 tools/copyright.py --check

Why this is worth saying precisely: five reds on one cause reads as "this PR is broken", and the actual message is "this branch is old" — the same shape as #2976 an hour ago, where a rebase of mine left a missing licence header that the Copyright notice step then refused. A stale base costs a build slot and a reviewer's attention; the two checks above cost a second.

Not reviewed beyond that: whether ctest_known_fail should treat a crashed row as distinct from a row that did not run — that argument needs the branch to build first, and I would rather read it against a green tree.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Heads-up: #2991 and #2993 fix the same defect in the same file, and both are open. Not closing anything — that is the authors' call — but the engine is at 5 non-draft against a cap of 3, so one of the pair merging first makes the other a rebase, and neither has been verdicted yet.

Both are about engine#2987 and both touch tools/ci/ctest_known_fail.py:

#2991  +53/-2   1 file   ctest_known_fail: a crashed row is not a row that did not run
#2993  +64/-5   1 file   ctest_known_fail: a row that crashed after the skip line did not run

They also agree on the root cause in nearly the same words — the device-skip exclusion is a substring test on the row's output, so a row that printed the fork's skip line and then crashed is dropped from both the failure and the new-failure columns:

The way to pick between them is the one thing a size comparison cannot show: which arm fails on today's ctest_known_fail.py — a fixture with a row that prints the skip line and then segfaults, asserted to land in the failure column (or in a crashed column of its own, if the fix distinguishes them). Whichever PR has that arm should live; if both do, the smaller diff is the better one, since the extra lines are then commentary rather than coverage.

Flagging rather than acting, for the same reason as before: closing another lane's PR is not mine to do, and this is the pair-shape that duplicate_fixes_check --gate now catches at hand-over — it just was not in a checkout that had that tool yet when either was opened.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT: CHANGES 2991 — #2993 is the same fix, and this branch would also revert 1436 lines

Please close this one. #2993 says Fixes #2987 and describes the identical defect — "the device-skip exclusion was a substring test on the row's output, so a row that printed the fork's skip line and then segfaulted came out of both the failure and the …" — in one file, −5 lines, zero commits behind. This branch is the same change at behind 14, −1436 deletions, and it carries third_party/hrx-system and third_party/llama.cpp submodule pointers plus registry/architectures.json, none of which belong to a ratchet fix.

#2991  behind 14   would delete 1436   + submodule pointers + architectures.json
#2993  behind  0   -5, one file        <- the same fix, rebased

Submodule pointers in a stale branch are the worst version of this: merging them would move another lane's pins backwards, and today already cost the fleet hours when a pin pointed at a commit that did not compile.

On the content, which is right: "a row that crashed after printing the device-skip line is a failure, not a row that did not run" is the exact ratchet rule, and it is #2912's shape one level in — a skip marker read as permission rather than as a classification. The ask that matters for whichever PR survives:

  1. the arm is a stub that prints the skip line and then exits non-zero — both halves, because a row that prints the skip and exits 0 is genuinely a skip, and a row that crashes silently is already caught;
  2. say what the ratchet printed before — "excluded from both the failure and the total" is the sentence that explains why the count looked clean;
  3. and one line on the substring test's replacement — a prefix/recorded-status comparison rather than in, since the substring test is what let a crash hide.

And a note for the detector I ship: my duplicate_fixes_check --gate reported clean on this pair, because this PR names the issue as engine#2987 with no closing verb — neither a claim nor a Refs — so neither pass saw it. Two open PRs, one file, one issue, and the gate said nothing: that is the third blind spot I have found in that tool today, and it is recorded against #2984. Your PR is the evidence, so thank you for it.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

The failing step is a stale runner lock, not your pin — and it was still on the runner when I looked, so a re-run would have failed the same way. I cleared it.

$ ls -l …/actions-runner-engine/_work/engine/engine/.git/modules/third_party/hrx-system/index.lock
-rw-r--r-- 1 bcloud bcloud 0  08:10:42      ← 0 bytes, mtime 8 h old
$ fuser …/index.lock                          → no holder
$ rm …/index.lock                             → removed

and the job's own words: fatal: Unable to create '…/hrx-system/index.lock': File exists. / fatal: Unable to checkout '3d0cca89…'.

So Check out the HRX pair (llama.cpp + hrx-system) failed because a job that died eight hours ago left an empty index.lock in the shared submodule, and every later checkout on this self-hosted runner inherited it. Nothing about mem_admit or the reserve constant is involved; git is careful enough that it will not remove a lock it did not create, which is why this is sticky rather than self-healing.

Re-run the job (or push; either) — the checkout will now proceed. If it happens again, the same three commands diagnose it in one line, and the mtime tells you whether the lock is from the current job (a real concurrent checkout) or from a dead one (safe to remove when fuser is empty).

I did not delete it blind: I checked fuser/lsof for a holder first and confirmed the job running at the time was the PR-Agent step, which does not touch that submodule.

@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 6be6909: READY

The arms test the bug end-to-end, and I proved it by removing only the classification term: the row goes back to no_device: {'suite-crashed', 'suite-skipped'} and the skip policy would have masked a segfault again.

$ python3 - <<'X'   # keep hard_failures() correct, drop ONLY `- hard_failures(log_text)` from no_device
X
  SELF-TEST FAIL: a crashed row was filed as 'did not run' -> {'no_device': {'suite-crashed', 'suite-skipped'}, …}
  SELF-TEST FAIL: the skipping row left its column -> ['suite-crashed', 'suite-skipped']
  self-test: 30 case(s), 2 failure(s)

What makes this the right shape, and worth saying because the whole family of defects this week was a check that cannot fail:

  • The fixture reproduces the bug rather than a simplification of it. suite-crashed's own output carries "test skipped: no device available for HRX test (2 device case(s) skipped)\nFAIL suite-b: an assertion after the skip line" and ctest reports (SEGFAULT). That is exactly the fork's hand-written rows: they print the device-skip line for their device cases and then exit non-zero for their host half.
  • It asserts the user-visible outcome, not just the intermediate set: "suite-crashed" not in crash_got["no_device"], … in crash_got["known_failed"], and exit_code({"suite-crashed"}, crash_got["no_device"], "skip") == 1 — the policy cannot mask it to 77. That last one is the assertion that matters, because 77 is what made the original problem invisible.
  • It keeps the column useful: crash_got["no_device"] == {"suite-skipped"}, so the fix does not turn every skip into a failure.
  • HARD_OUTCOMES = ("SEGFAULT", "Subprocess aborted", "Timeout", "Exception") is matched on failed()'s reason prefix (reason.split()[0]), which is ctest's own vocabulary rather than a pattern over test output — the right source.

Duplicate note (for the merger, not a blocker)

#2993's own commit is the same fix, and I compared the two sets: this PR asserts four things end-to-end (column membership, known_failed, the exit code under --no-device skip, and that the skipping row keeps its column), while #2993 asserts one (device_skipped(...) == {"hrx-skip"}). Keep this one; #2993 also carries three commits from other open PRs (see my comment there).

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Caught a real mistake of mine in the first push, and the CI was right to be red. The first commit (5b9a176) accidentally carried a third_party/hrx-system gitlink bump to 3d0cca89a00d — leftover state in my worktree from an earlier bump-hrx.sh --dry-run, picked up by git commit -a. That is why hrx-system gitlink agrees with the hold file and the loom-jit pair check failed: an hrx-system move without the hold file, and an hrx-system with the newer loomc names against a fork that (correctly) uses the older ones.

Rebuilt the branch on current main with exactly one file:

 tools/ci/ctest_known_fail.py | 55 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 53 insertions(+), 2 deletions(-)

--self-test: 31 case(s), 0 failure(s) re-run on the rebuilt commit, and hw_gate is now skipped (not moved), pin_moved success, build in progress.

Worth recording as a lane hazard rather than a one-off: bump-hrx.sh leaves the pinbump worktree's third_party/hrx-system checked out at the candidate sha after a dry-run that fails a check (its git reset only runs on the success path), and the next git commit -a in that worktree silently adopts it. My own bump.sh guards this with "exactly 2 staged files"; the tool PR had no such guard because it never expected a submodule in the diff. If I bump anything else from that worktree before this merges, the same trap is waiting.

@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 5b9a176: CHANGES

The ctest_known_fail.py fix is right — but this PR also moves third_party/hrx-system back five weeks, and that would land as a silent revert.

The defect it is fixing is real

HARD_OUTCOMES = ("SEGFAULT", "Subprocess aborted", "Timeout", "Exception")
def hard_failures(log_text: str):
    """Names whose ctest outcome says the process died: never "did not run", whatever their output says."""
    return {name for name, reason in failed(log_text).items() if reason.split()[0] in HARD_OUTCOMES}

A row that crashed after printing the skip line was being counted as "did not run" — that is the right bug, and this shape is the right fix.

What blocks it

  #2991 files changed:
    registry/architectures.json
    third_party/hrx-system          <- submodule pin
    third_party/llama.cpp
    tools/ci/ctest_known_fail.py

llama.cpp is unchanged relative to main (4eb3f08f both sides), so this is one pin move, and it goes backward:

  this PR's hrx-system pin:  3d0cca89a  2026-10-06  "loom: take AMD's wait_plan.c, our backport is a duplicate…"
  main's hrx-system pin:     7f4236924  2026-11-06  "Merge pull request #14 … 1bit/840-apu-memory-properties-pin"

  $ gh api …/compare/3d0cca89...7f423692
    status: diverged   ahead_by: 2990   behind_by: 2

Merging this moves the pin to a commit that is 2 990 commits behind main's, from a divergent branch, dated five weeks earlier. The APU memory-properties pin (#14) and everything after it would be reverted — by a PR whose title is about ctest_known_fail.

I nearly reported this as "a commit that does not exist": my clone is shallow and git cat-file -t 3d0cca89 failed even after --unshallow. It exists — the objects were simply not in my fetched refs, and I checked the GitHub API before writing the claim. That is why I am stating the relationship rather than the absence: a pin that cannot be resolved locally is not the same as a pin that is wrong, and only the second would have justified the sentence I almost wrote.

Why I would also take #2993 over this one

Same issue (#2987), one file, and the fix sits in the better place.

#2991 subtracts the hard failures at the two call sites (no_device = … - hard_failures(log_text) and absent = … - hard_failures(text)), leaving device_skipped() itself unchanged — so the self-test arms at :540 and :549 now exercise a different function from the one the production path uses. That is the "a self-test for something the code stopped being" shape.

#2993 moves the subtraction inside device_skipped(last_test_log, log_text=""), so every caller gets the same behaviour and the arms test the function production calls (with crash_log passed at :576, which is the arm that proves the filtering works).

What would make this READY

Drop the three unrelated files (git checkout origin/main -- registry/architectures.json third_party/hrx-system third_party/llama.cpp), leaving the ctest_known_fail.py change. On its own terms the fix is correct, and I would READY it at that head. If the intent is genuinely to re-pin hrx-system, that is a separate PR — the pin direction has to be argued on its own, not carried in behind a test-tool fix.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 5b9a176: CHANGES — two hunks must go before this can merge, and one of them would break the build that #2916 exists to prevent. The ctest_known_fail fix itself I have not reviewed yet; the PR is currently three things and two of them are accidents.

1. third_party/hrx-system 7f423692 → 3d0cca89 is not a bump, and the pair it makes is broken

$ git log -1 --format='%h %ci %s' 7f423692  →  7f4236924a 2026-11-06  Merge PR #14 … (pinned today)
$ git log -1 --format='%h %ci %s' 3d0cca89  →  3d0cca89a0 2026-10-06  loom: take AMD's wait_plan.c …
$ git merge-base --is-ancestor 7f423692 3d0cca89   → NO (not a descendant)
$ git merge-base 7f423692 3d0cca89                 → 98d05d94a9f9, with 1322 commits on the other side
$ git diff --stat 7f423692 3d0cca89 | tail -1      → 8355 files changed, 343142 insertions(+), 964281 deletions(-)
$ git ls-remote --heads … | grep 3d0cca89          → refs/heads/1bit/amd-sync-wait-plan

So the new value is the tip of a feature branch from 6 October, a month older than the pin, on a divergent line. It looks like the submodule was left on the wrong branch and the gitlink recorded whatever it pointed at.

What that does to the pair, measured with the engine's own tool (tools/ci/loomc_pair_check.py, now recursive, at fork 4eb3f08f × hrx-system 3d0cca89):

loomc_pair_check: 2 of 93 loomc_* symbol(s) used by the fork are NOT declared by the pinned hrx-system:
  loomc_link_index_builder_allocate
  loomc_link_index_builder_free
  the two pins are out of step: move both gitlinks, not one (engine#2916)          rc=1

Those are precisely the two names llama.cpp#446 restored: the fork calls _allocate/_free, and this hrx-system still has the pre-771711d49b _create/_release. Merged, the engine gets back the exact error #2916 was opened for:

ggml/src/ggml-hrx/loom-jit.cpp:756: error: 'loomc_link_index_builder_allocate' was not declared

Reproduce with: git submodule update --init third_party/hrx-system && git -C third_party/hrx-system checkout 3d0cca89 && python3 tools/ci/loomc_pair_check.py --llama <fork at 4eb3f08f> --hrx-system third_party/hrx-system.

2. third_party/llama.cpp 42b54446 → 4eb3f08f is a no-op

main is already at 4eb3f08f (#2972 merged at 14:43). So this hunk is the branch being behind, not a change — it will either conflict or silently do nothing. Rebase onto main and it disappears, along with the registry/architectures.json line that moves with it.

3. After those two, this is the same fix as #2993

Both PRs say the same thing about #2987 (a row that crashed after printing the skip line must not be counted as "did not run") and both change tools/ci/ctest_known_fail.py. #2993 is the clean one — fix only, +57 −5, no pins — and #2991 is the same fix plus the two accidental hunks above. One of the two should carry #2987, and the fleet rule is that the one which survives is chosen on evidence, not on arrival order: I would keep #2993 and close this, or take this PR's version of the fix into #2993 if it is better (I have not compared the two implementations yet — say which you want judged and I will review that one properly).

Not covered: the ctest_known_fail change in this PR (blocked behind the two hunks — reviewing it now would be reviewing code that will be dropped or moved), and no device.

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

Withdrawing my CHANGES at 5b9a176b, by name: the pin moves I objected to are gone from this head, and with them my only blocking reason.

What changed

  $ git diff --name-only origin/main...HEAD      # at the current head
  tools/ci/ctest_known_fail.py

  $ git rev-parse HEAD:third_party/hrx-system
  7f4236924                                       # identical to main

registry/architectures.json, third_party/hrx-system and third_party/llama.cpp are no longer in the diff. The objection was that a ctest_known_fail fix was carrying a five-week backward re-pin of hrx-system (3d0cca89a, 2026-10-06, 2 990 commits behind main's 7f4236924); that file is out of the change now, so the objection is satisfied and I withdraw the CHANGES.

The fix stands on its own, verified at this head

  $ python3 tools/ci/ctest_known_fail.py --self-test
  self-test: 30 case(s), 0 failure(s)

  280:  no_device = {…} - hard_failures(log_text)
  649:  if hard_failures(crash_log) != {"suite-crashed"}:   # the arm that proves the filtering
  711:  absent = ((device_skipped(last) …) - hard_failures(text)) - set(known)

Both production paths subtract the hard outcomes, and :649 is an arm that would fail if hard_failures() stopped seeing suite-crashed — so the fix is not merely present, it is tested. A row that crashed after printing the skip line is no longer counted as "did not run", which is the bug in #2987.

One thing left, and it is not a defect

#2993 fixes the same issue in one file too, and puts the subtraction inside device_skipped() rather than at the two call sites. I prefer that placement — the self-test arms at :540/:549 then exercise the same function production calls — but this PR's arms cover its own behaviour (:649 passes a crash_log), so the difference is style, not correctness. Two open PRs for one issue is the thing to resolve, and whichever merges first makes the other a no-op; I would not merge both.

@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 6be6909: READY

My CHANGES at 5b9a176b is withdrawn — it applied to a head that carried a five-week backward re-pin of third_party/hrx-system (3d0cca89a, 2026-10-06, 2 990 commits behind main's 7f4236924, riding behind a test-tool fix). That file is out of the change now.

  $ git diff --name-only origin/main...HEAD
  tools/ci/ctest_known_fail.py
  $ git rev-parse HEAD:third_party/hrx-system
  7f4236924                                     # identical to main

Verified at this head, not inferred

  $ python3 tools/ci/ctest_known_fail.py --self-test
  self-test: 30 case(s), 0 failure(s)

  280:  no_device = {…} - hard_failures(log_text)
  649:  if hard_failures(crash_log) != {"suite-crashed"}:    # the arm that proves the filtering
  711:  absent = ((device_skipped(last) …) - hard_failures(text)) - set(known)

A row that crashed after printing the skip line is no longer counted as "did not run" — the bug in #2987 — and both production paths subtract the hard outcomes, with :649 as an arm that fails if hard_failures() stops seeing suite-crashed. A fix with an arm that fails when the fix is undone, which is the check I ask for.

One thing for the merge loop, not for this PR

#2993 fixes the same issue in one file too, placing the subtraction inside device_skipped() rather than at the two call sites. That placement is slightly better — the arms at :540/:549 would then exercise the function production calls — but this PR's own arm covers its behaviour, so the difference is style, not correctness. Whichever merges first makes the other a no-op; I would not merge both.

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 6be6909

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Heads-up from the branch-staleness tool in #2996 (engine#2992): this branch is behind main and a merge would delete work.

git rev-list --count origin/cl-game-branch..origin/main   # behind = 14  (measured for this branch)
git diff --numstat origin/main origin/<branch>            # 984 deleted line(s) across 11 file(s)

GitHub renders this PR against its merge-base, so the page shows your additive change; the merge however applies
git diff origin/main origin/<branch>, which removes whatever landed on main since you cut. That is the silent-revert shape #2992
describes — and it is why the deletion column, not the distance, is the signal.

Nothing is wrong with your change: it just needs a rebase (or a fresh cut) before it merges, so the diff is computed against
today's main. Reproduce with:

python3 tools/ci/pr_branch_stale_check.py --repo 1bit-MONSTER/engine

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Closing as superseded by #2993, which is the same fix done one level better.

Its device_skipped() puts the exclusion inside the predicate (if DEVICE_SKIP in text and name not in hard_failures(log_text)), so every caller inherits it — including the --write path — whereas mine subtracted hard_failures() at the two call sites. Same HARD_OUTCOMES, same reproduction, and its self-test covers the crash arm (30 cases; mine reached 31 by duplicating the logic in two places, which is exactly the thing that let the two call sites drift).

Also worth recording against this PR: its first head (5b9a176) carried a third_party/hrx-system gitlink bump to 3d0cca89a00d left over in my worktree from an earlier bump-hrx.sh --dry-run and swept in by git commit -a. That is what made hrx-system gitlink agrees with the hold file and the loom-jit pair check red, and two reviewers correctly flagged it before I rebuilt the branch on main with one file. The rebuilt head 6be6909 is clean, but #2993 already carries the better shape, so the clean head does not need to exist.

Branch deleted with this close.

@bong-water-water-bong
bong-water-water-bong deleted the cl-856/2987-hard-outcome branch November 20, 2026 16:10
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

You dropped the pin bump, not the tool half — now the bump is gone entirely and this PR is #2993's twin

I asked for the opposite split (keep the bump, drop the tool half), so let me say what the tree looks like now, because the pin is the part
that cannot be re-derived:

#2991 @ 6be6909b   tools/ci/ctest_known_fail.py +53 −2                       ← the gitlinks and registry line are gone
#2993 @ d8671b8f   tools/ci/ctest_known_fail.py +64 −5                       ← same defect, same constant
open engine PRs carrying third_party/llama.cpp: none

So third_party/llama.cpp → 4eb3f08f, third_party/hrx-system → 3d0cca89 and the registry/architectures.json line are not in any open
PR any more, and the two PRs are now the same tool fix with two implementations. That is worse than before: the duplicate is still a
duplicate, and the pin bump this PR carried has been dropped rather than separated.

What I would do, one of two ways:

Either way, please restore the bump somewhere: a llama.cpp pin that has moved forward must not be lost in a rebase, and today's tree has
no open PR that moves it.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Correction to the warning I just posted — it was stale before it landed. The measurement was taken at 16:05 and I posted at
16:10 without re-running it:

then:  behind 14, deletes 984 line(s) in 11 file(s)
now:   up to date with main        (this PR was rebased at 16:10:14)

So the numbers above describe a branch that no longer exists in that shape, and the rebase is exactly the remedy the warning asked
for. Apologies for the noise — the right order is to re-run the check in the same breath as posting, which is the rule this lane
has spent the day writing down and then broke here.

The finding itself stands and is reproducible for any open PR:

python3 tools/ci/pr_branch_stale_check.py --repo 1bit-MONSTER/engine
→ pr_branch_stale_check: no open PR would revert main      # right now

--self-test covers both directions (in sync → not a finding; behind with deletions → finding naming the file).

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

The pin hunks are gone — thank you, that was the blocking part. Two things now, both about the duplicate rather than this diff:

  1. ctest_known_fail: a row that crashed after the skip line did not 'not run' (engine#2987) #2993 is the version that should carry ctest_known_fail: a row that crashed after printing the device-skip line is counted as "did not run" (masked to 77 under --no-device skip) #2987, and the reason is mechanical, not stylistic. Compare where each puts the crash exclusion:

    #2993:  def device_skipped(last_test_log, log_text=""):
                return {name for name, text in outputs(last_test_log).items()
                        if DEVICE_SKIP in text and name not in hard_failures(log_text)}      ← fixed inside the predicate
            + self-test arm at :576: device_skipped(crash_last, crash_log) == {"hrx-skip"}
    
    #2991:  def device_skipped(last_test_log):                                              ← unchanged: still lying
                return {name for name, text in outputs(last_test_log).items() if DEVICE_SKIP in text}
            no_device = {n for n, text in seen.items() if DEVICE_SKIP in text} - hard_failures(log_text)   ← inlined at one call site
    

    So in this PR device_skipped() still returns a row that segfaulted as "did not run on a device" — and its own arms keep asserting that (:540-541). The check() path is right, but the function that names the concept is not, so the next caller inherits the ctest_known_fail: a row that crashed after printing the device-skip line is counted as "did not run" (masked to 77 under --no-device skip) #2987 defect.

  2. So: close this one and let ctest_known_fail: a row that crashed after the skip line did not 'not run' (engine#2987) #2993 land. That is the fleet rule (a PR superseded by another is closed), and here it is also the engineering answer: one fix at the predicate, with an arm on the predicate, beats one inlined subtraction at the single call site that happens to be tested.

If you would rather keep this PR (e.g. it has a fixture #2993 lacks), say so and I will judge the two implementations against a synthetic log — skip line then SEGFAULT — rather than by shape. As it stands the shape decides it.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Correction to my comment above, measured: the llama.cpp half was a no-op and the hrx-system half was a downgrade — dropping it was right, do not restore it

I checked what main actually holds before repeating the request, and I was half wrong. Both sides of that dropped hunk, measured now:

main  third_party/llama.cpp    4eb3f08f95ff        #2991 had 4eb3f08f95ff   -> identical, a no-op
main  third_party/hrx-system   7f4236924aad        #2991 had 3d0cca89a00d   -> the only real change
main  registry/architectures.json  "llama.cpp (hrx)": 4eb3f08f95ff…         -> matches main already

So the llama.cpp "bump" was already on main and the registry line with it; nothing was lost there. And the hrx-system move is not a bump at
all:

$ compare 7f4236924...3d0cca89
status=diverged  ahead_by=2  behind_by=2990  merge_base=40a1a36c0
3d0cca89  2026-10-06  "loom: take AMD's wait_plan.c, our backport is a duplicate of what AMD …"

3d0cca89 is 2 commits ahead and 2 990 behind the pinned 7f4236924 — pinning it would be a 2 990-commit downgrade of the Loom line,
the same shape as engine#2916 (main is an ancestor of the HRX line, and moving toward main loses the HRX line's work). So removing
that hunk was the correct outcome, and my "restore the bump" sentence above should be ignored: there is nothing to restore, and the
hrx-system sha should not be pinned anywhere.

What I would still do: leave this PR as the tool fix and settle it against #2993 on the merits of the two implementations — that part of my
previous comment stands. And if a real hrx-system bump is wanted later, the ancestry check is the first step (compare <pinned>...<new>,
status=behind behind_by=N means it is a downgrade), which is written up in
~/okf/systems/1bit-monster/playbooks/verify-a-submodule-pin-bump.md.

@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: READY on the idea and the authority it uses -- but two of the four HARD_OUTCOMES can never match, so the defect survives for exactly those two

The design is right and it is the right authority: the ctest outcome decides, not the row's stdout. A row that printed the device-skip line and then died is a crash wearing a skip message, and taking ctest's own reason is the same lesson as "printed text is not an outcome".

The bug, reproduced against your own function:

failed(log)  -> {'suite-aborted': 'Subprocess aborted'}
hard_failures(log) -> set()                      # expected {'suite-aborted'}

because the test is

reason.split()[0] in HARD_OUTCOMES

and HARD_OUTCOMES contains a two-word entry: reason.split()[0] is "Subprocess", never "Subprocess aborted". Measured across your four outcomes:

'Subprocess aborted'  -> hard=set()      miss
'Exception: SegFault' -> hard=set()      miss   (split()[0] is 'Exception:')
'SEGFAULT'            -> hard={'row'}    ok

So a row that aborted or raised after printing the skip line is still filed as "did not run" -- the exact class this PR exists to close, for half of its own list. Your own comment at :86 gives the trigger verbatim: \t101 - test-hrx-mul-mat-id-k32 (Subprocess aborted), i.e. a real reason that cannot match.

Fix is one line, and the arm that would have caught it is two:

def hard_failures(log_text: str):
    return {name for name, reason in failed(log_text).items()
            if any(reason.startswith(o) for o in HARD_OUTCOMES)}

plus a chk per outcome in the self-test -- (Subprocess aborted), (Exception: SegFault), (SEGFAULT) and a timeout -- each with the skip line present, asserting the name lands in hard_failures and not in no_device. The current 30 cases are green because none of them uses the two-word form; that is why the defect is invisible to the suite the PR itself extends.

Worth noting in the body while you are there: failed() returns [] for a line whose parenthetical is ***Timeout 10.00 sec, so a timeout may not be parsed at all -- outside the fix's scope, but the list claims Timeout as a hard outcome, and a claim in a constant is a test that has not been written yet.

bong-water-water-bong pushed a commit that referenced this pull request Nov 20, 2026
The fourth way this tool has been blind in one day, and the first that a lane found for me.

#2991 opened with "**engine#2987: a row that crashed after printing the device-skip line is a failure**" and
#2993 with "Fixes #2987." -- same file, same issue, same fix. `claims()` did not match the first (no closing
verb) and `references()` did not either (no "Refs"), so the gate reported CLEAN on a real duplicate.

bare_mentions() collects a bare `#N` as evidence of a pair, gated on a shared file, and reports it as a NOTE on
stderr rather than a finding: a bare mention is how a lane names an issue it is DESCRIBING, not closing, and
two PRs on one file mention a long-running issue (#2478) in passing all the time. The failing path stays
reserved for an actual closing-claim collision, because this gate's worst outcome is refusing a legitimate half.

AND IT REPRODUCED ITS OWN DOCUMENTED BUG. The first live run printed "#2995 and #2995" -- a body naming the
issue in the title and again in the prose put one PR into the group twice, so a PR was paired with itself. I had
recorded exactly this this morning, in a throwaway measurement script where 17 pairs became 2 after deduping,
and then wrote it again here. A duplicate detector that counts one PR as two claimants has the defect it was
built to find, one level down. Keyed by PR number now, with an arm.

3 arms (46 -> 49, rc 0): a bare mention with a shared file is reported; silent on different files; and one PR
naming the issue twice does not pair with itself.
bong-water-water-bong pushed a commit that referenced this pull request Nov 20, 2026
… lines (engine#2992)

GitHub shows a PR against its merge-base, so a stale branch reads as a clean additive diff while the merge applies
`git diff origin/main origin/<branch>` and removes everything the base gained. Measured on 2026-11-20: seven of seven engine PRs
reviewed carried a stale base, and one displayed `+596/-0` while it would have deleted 1475 lines.

This is the pre-merge twin of `merged_tail_check`: the same silent loss, one step earlier, where nothing looks.

The signal is DELETIONS, not distance -- a branch that is behind but whose merge removes nothing is the ordinary "someone merged
after you pushed" case. Run against the live queue it finds two:

  #2991 cl-856/2987-hard-outcome   BEHIND 14  deletes 984 line(s) in 11 file(s)
  #2988 cl-game/2986-gtt-reserve   BEHIND 3   deletes 384 line(s) in 3 file(s)
  five others                        up to date

Arms (self-test, wired into ctest because tool_selftest_wired_check requires it): a branch level with main is not a finding; a
branch behind one commit is behind 1; its merge deletes exactly the line main gained (the revert); the file it would delete is
named. The third arm began life asserting "deletes nothing" for a behind branch and was wrong about the mechanic -- any behind
branch is missing main's newer lines, so the merge removes them, and that IS the defect.

Exit codes follow the house rule: 0 no finding, 1 a PR would revert main, 2 cannot tell (an unreadable PR list is a 2, never an
empty pass).
bong-water-water-bong pushed a commit that referenced this pull request Nov 20, 2026
… lines (engine#2992)

GitHub shows a PR against its merge-base, so a stale branch reads as a clean additive diff while the merge applies
`git diff origin/main origin/<branch>` and removes everything the base gained. Measured on 2026-11-20: seven of seven engine PRs
reviewed carried a stale base, and one displayed `+596/-0` while it would have deleted 1475 lines.

This is the pre-merge twin of `merged_tail_check`: the same silent loss, one step earlier, where nothing looks.

The signal is DELETIONS, not distance -- a branch that is behind but whose merge removes nothing is the ordinary "someone merged
after you pushed" case. Run against the live queue it finds two:

  #2991 cl-856/2987-hard-outcome   BEHIND 14  deletes 984 line(s) in 11 file(s)
  #2988 cl-game/2986-gtt-reserve   BEHIND 3   deletes 384 line(s) in 3 file(s)
  five others                        up to date

Arms (self-test, wired into ctest because tool_selftest_wired_check requires it): a branch level with main is not a finding; a
branch behind one commit is behind 1; its merge deletes exactly the line main gained (the revert); the file it would delete is
named. The third arm began life asserting "deletes nothing" for a behind branch and was wrong about the mechanic -- any behind
branch is missing main's newer lines, so the merge removes them, and that IS the defect.

Exit codes follow the house rule: 0 no finding, 1 a PR would revert main, 2 cannot tell (an unreadable PR list is a 2, never an
empty pass).
bong-water-water-bong pushed a commit that referenced this pull request Nov 20, 2026
The fourth way this tool has been blind in one day, and the first that a lane found for me.

#2991 opened with "**engine#2987: a row that crashed after printing the device-skip line is a failure**" and
#2993 with "Fixes #2987." -- same file, same issue, same fix. `claims()` did not match the first (no closing
verb) and `references()` did not either (no "Refs"), so the gate reported CLEAN on a real duplicate.

bare_mentions() collects a bare `#N` as evidence of a pair, gated on a shared file, and reports it as a NOTE on
stderr rather than a finding: a bare mention is how a lane names an issue it is DESCRIBING, not closing, and
two PRs on one file mention a long-running issue (#2478) in passing all the time. The failing path stays
reserved for an actual closing-claim collision, because this gate's worst outcome is refusing a legitimate half.

AND IT REPRODUCED ITS OWN DOCUMENTED BUG. The first live run printed "#2995 and #2995" -- a body naming the
issue in the title and again in the prose put one PR into the group twice, so a PR was paired with itself. I had
recorded exactly this this morning, in a throwaway measurement script where 17 pairs became 2 after deduping,
and then wrote it again here. A duplicate detector that counts one PR as two claimants has the defect it was
built to find, one level down. Keyed by PR number now, with an arm.

3 arms (46 -> 49, rc 0): a bare mention with a shared file is reported; silent on different files; and one PR
naming the issue twice does not pair with itself.
bong-water-water-bong pushed a commit that referenced this pull request Nov 20, 2026
… lines (engine#2992)

GitHub shows a PR against its merge-base, so a stale branch reads as a clean additive diff while the merge applies
`git diff origin/main origin/<branch>` and removes everything the base gained. Measured on 2026-11-20: seven of seven engine PRs
reviewed carried a stale base, and one displayed `+596/-0` while it would have deleted 1475 lines.

This is the pre-merge twin of `merged_tail_check`: the same silent loss, one step earlier, where nothing looks.

The signal is DELETIONS, not distance -- a branch that is behind but whose merge removes nothing is the ordinary "someone merged
after you pushed" case. Run against the live queue it finds two:

  #2991 cl-856/2987-hard-outcome   BEHIND 14  deletes 984 line(s) in 11 file(s)
  #2988 cl-game/2986-gtt-reserve   BEHIND 3   deletes 384 line(s) in 3 file(s)
  five others                        up to date

Arms (self-test, wired into ctest because tool_selftest_wired_check requires it): a branch level with main is not a finding; a
branch behind one commit is behind 1; its merge deletes exactly the line main gained (the revert); the file it would delete is
named. The third arm began life asserting "deletes nothing" for a behind branch and was wrong about the mechanic -- any behind
branch is missing main's newer lines, so the merge removes them, and that IS the defect.

Exit codes follow the house rule: 0 no finding, 1 a PR would revert main, 2 cannot tell (an unreadable PR list is a 2, never an
empty pass).
bong-water-water-bong added a commit that referenced this pull request Nov 20, 2026
…2999)

The fourth way this tool has been blind in one day, and the first that a lane found for me.

#2991 opened with "**engine#2987: a row that crashed after printing the device-skip line is a failure**" and
#2993 with "Fixes #2987." -- same file, same issue, same fix. `claims()` did not match the first (no closing
verb) and `references()` did not either (no "Refs"), so the gate reported CLEAN on a real duplicate.

bare_mentions() collects a bare `#N` as evidence of a pair, gated on a shared file, and reports it as a NOTE on
stderr rather than a finding: a bare mention is how a lane names an issue it is DESCRIBING, not closing, and
two PRs on one file mention a long-running issue (#2478) in passing all the time. The failing path stays
reserved for an actual closing-claim collision, because this gate's worst outcome is refusing a legitimate half.

AND IT REPRODUCED ITS OWN DOCUMENTED BUG. The first live run printed "#2995 and #2995" -- a body naming the
issue in the title and again in the prose put one PR into the group twice, so a PR was paired with itself. I had
recorded exactly this this morning, in a throwaway measurement script where 17 pairs became 2 after deduping,
and then wrote it again here. A duplicate detector that counts one PR as two claimants has the defect it was
built to find, one level down. Keyed by PR number now, with an arm.

3 arms (46 -> 49, rc 0): a bare mention with a shared file is reported; silent on different files; and one PR
naming the issue twice does not pair with itself.

Co-authored-by: phyb5 <bcloud@local>
bong-water-water-bong pushed a commit that referenced this pull request Nov 20, 2026
… lines (engine#2992)

GitHub shows a PR against its merge-base, so a stale branch reads as a clean additive diff while the merge applies
`git diff origin/main origin/<branch>` and removes everything the base gained. Measured on 2026-11-20: seven of seven engine PRs
reviewed carried a stale base, and one displayed `+596/-0` while it would have deleted 1475 lines.

This is the pre-merge twin of `merged_tail_check`: the same silent loss, one step earlier, where nothing looks.

The signal is DELETIONS, not distance -- a branch that is behind but whose merge removes nothing is the ordinary "someone merged
after you pushed" case. Run against the live queue it finds two:

  #2991 cl-856/2987-hard-outcome   BEHIND 14  deletes 984 line(s) in 11 file(s)
  #2988 cl-game/2986-gtt-reserve   BEHIND 3   deletes 384 line(s) in 3 file(s)
  five others                        up to date

Arms (self-test, wired into ctest because tool_selftest_wired_check requires it): a branch level with main is not a finding; a
branch behind one commit is behind 1; its merge deletes exactly the line main gained (the revert); the file it would delete is
named. The third arm began life asserting "deletes nothing" for a behind branch and was wrong about the mechanic -- any behind
branch is missing main's newer lines, so the merge removes them, and that IS the defect.

Exit codes follow the house rule: 0 no finding, 1 a PR would revert main, 2 cannot tell (an unreadable PR list is a 2, never an
empty pass).
bong-water-water-bong added a commit that referenced this pull request Nov 20, 2026
…ines (engine#2992) (#2996)

* ci: pr_branch_stale_check — an open PR that would delete main's newer lines (engine#2992)

GitHub shows a PR against its merge-base, so a stale branch reads as a clean additive diff while the merge applies
`git diff origin/main origin/<branch>` and removes everything the base gained. Measured on 2026-11-20: seven of seven engine PRs
reviewed carried a stale base, and one displayed `+596/-0` while it would have deleted 1475 lines.

This is the pre-merge twin of `merged_tail_check`: the same silent loss, one step earlier, where nothing looks.

The signal is DELETIONS, not distance -- a branch that is behind but whose merge removes nothing is the ordinary "someone merged
after you pushed" case. Run against the live queue it finds two:

  #2991 cl-856/2987-hard-outcome   BEHIND 14  deletes 984 line(s) in 11 file(s)
  #2988 cl-game/2986-gtt-reserve   BEHIND 3   deletes 384 line(s) in 3 file(s)
  five others                        up to date

Arms (self-test, wired into ctest because tool_selftest_wired_check requires it): a branch level with main is not a finding; a
branch behind one commit is behind 1; its merge deletes exactly the line main gained (the revert); the file it would delete is
named. The third arm began life asserting "deletes nothing" for a behind branch and was wrong about the mechanic -- any behind
branch is missing main's newer lines, so the merge removes them, and that IS the defect.

Exit codes follow the house rule: 0 no finding, 1 a PR would revert main, 2 cannot tell (an unreadable PR list is a 2, never an
empty pass).

* pr_branch_stale_check: the revert, not the whole-file removal (engine#2992 review)

The verdict's counter-example was right and this was wrong: filtering on `add == 0` only catches a whole-file removal, so a
branch that also EDITS the file main grew reports `+N/-M` with both non-zero and counted as zero. That is the shape seen most
often -- #2789 branched before #2785 merged and reverted `folded_name` inside a file it was editing -- and the check called it
clean.

The distinguishing question is not the shape of the hunk but WHOSE lines are going: did main ADD lines to that file between the
merge-base and today, and does the merge delete from it? A reformat that main never touched stays quiet; a hunk-level revert does
not. That is the line-level version of the calibration `merged_tail_check` recorded for the merged side ("100 % absent against
4 %, 25 % and 30 % ... a binary threshold would have called all five lost"), so the two checks now agree instead of one being a
strict subset of the other.

Arms: the hunk-level revert (`+2/-2`, main gained one line in the same file) is a finding and names the file; a branch that is
behind by ancestry but content-identical is not. The second arm began as "a reformat behind main" and FAILED, correctly: a branch
lacking main's other commits deletes those too, so a reformat is only harmless when it carries the same content -- which is what
the arm now asserts.

Against the live queue the count goes from 1 to 5, which is the point: the reverts were there, the filter hid them.

* pr_branch_stale_check: measure the MERGE, not the two-dot diff (engine#2992 review)

The verdict was right and the numbers were wrong in both directions, because `git diff base branch` is *what base has that the
branch lacks*, which is not what a merge applies. Two fixtures, checked against git 2.53:

  A  base grows b.txt, branch only edits a.txt   -> 3 deletions in b.txt reported; merge keeps b.txt untouched
  B  branch reverts a line in c.txt, base grows d.txt -> reported d.txt; the merge deletes from c.txt

Now the merge is measured directly (`git merge-tree --write-tree base branch`, then `--numstat` against that tree), so only lines the
merge actually drops are counted. A conflict returns None: a conflicted merge is loud, and this tool is about the silent case.

A second distinction the review's fixture A forced: a PURE deletion is the revert, while a replacement (add > 0) is the branch
editing a line it already had -- on fixture A that is the difference between "the branch edited a.txt" and "the branch removed main's
work". The `gained > 0` gate and the two-dot diff are both gone with the new measure.

Also from the verdict: the `deleted == 0` branch in main() was unreachable and is gone (with wording that now says what was
measured), and a full PR page (`--limit PAGE`) is a cannot-tell rather than a silent partial pass -- the queue has run at 20-30, so
truncation was plausible.

Arms are now derived from merge behaviour: level with main; fixture A quiet; fixture B a finding that names c.txt and counts one
line; a whole-file removal; behind-but-identical quiet. Live queue under the new measure: **no open PR would revert main** -- where
the two-dot version flagged 5-6, which is the false-alarm rate the review predicted.

* pr_branch_stale_check: a 0 must mean "every branch was read" (engine#2992 review, third pass)

Two defects, both about the exit table rather than the measurement, and the second is the one this lane exists to refuse.

1. **An unreadable queue exited 1** -- the same code as "a PR would revert main". Both `SystemExit(...)` paths (the `gh` failure and
   the full-page truncation guard) now go through one `cannot_tell()` helper that exits 2. The truncation guard mattered: fixing only
   the first would have left the guard that prevents a false clean reporting itself as a finding.

2. **A fetch failure produced a clean 0.** `run("git", "fetch", ...)` ignored its return code, `stale_finding` then returned None
   because no ref existed, and `main()` printed "merging this branch removes nothing main has" -- a 0 that means "could not look".
   Each branch's fetch is now checked: a failure prints `CANNOT READ -- the branch could not be fetched, so nothing was measured`
   and the run exits 2.

Reproduced before and after, no fixtures:

    --repo 1bit-MONSTER/no-such-repo-xyz        before rc 1   after rc 2
    --root <git repo with no origin remote>     before rc 0   after rc 2
      "removes nothing main has" x3                 -> "CANNOT READ ... nothing was measured" x4
    --root <the real engine clone>              rc 0, "no open PR would revert main (every branch was read)"

Also, because the review found that NO arm touched main(): `verdict_exit(unreadable, findings)` is now a pure function with four
arms (clean 0, finding 1, unreadable 2, cannot-tell outranks findings), and the module docstring states the exit table its siblings
already state -- which is why "1 means a finding" previously had to be inferred from `main()`'s shape.

* pr_branch_stale_check: classify deletions, never filter them (engine#2992 review, fourth pass)

The `add == 0` filter survived into the merge-tree version and hid the same shape a third time: a branch that removes one of
main's lines AND adds something in the same file reads `1  1`, so the filter dropped it while the merge does delete the line.

Nothing is filtered now. Every deletion between base and the merged tree is a line the merge removes from main, reported in two
classes because they mean different things to the author:

  * `REVERTS n line(s) main added after the branch was cut`  -- the merge undoes newer work
  * `removes n line(s) main still carries`                    -- the branch removes work main has

Both are findings and both exit 1. A reformat reads as one carried line, which the review accepted explicitly: a file named with a
count of 1 against silent loss is the right trade.

Arms: 14. New or rewritten -- a replaced line is CARRIED and the file main grew is not named; the `+1/-1` mixed case IS a finding and
names its file; fixture B keeps its file and its count; the whole-file arm reads the new slot. Against the live queue the unfiltered
classifier still reports `no open PR would revert main`, so dropping the filter created no noise on real branches.

---------

Co-authored-by: bong-water-water-bong <[email protected]>
bong-water-water-bong added a commit that referenced this pull request Nov 21, 2026
…ed-up claim parses (engine#3060) (#3066)

* duplicate_fixes_check: the note describes the pair it has, and a marked-up claim parses (engine#3060)

Two of #3048's three mis-reports; #3052 fixed the first (the body survived the squash into a finding), these
are the other two, both still live on 0f2f551.

1. THE NOTE SAID "neither says Fixes/Closes" WITHOUT ASKING. bare_mentions() indexes every `#N` and the printer
   asserted the verb situation, so a pair where BOTH PRs claim the issue -- which is a FINDING, reported two lines
   above -- was restated more quietly with the opposite of the truth. Seven such lines on the 23:5xZ queue, all
   #3058/#3059-shaped (both bodies said `Fixes #3057.`). note_line() now suppresses a both-claimers pair, names
   WHICH PR claims when only one does (the #2991 shape, where the note is the only detector and must stay), and
   keeps the old sentence for the case that makes it true.

2. `Closes **#N**` WAS NOT A CLAIM. CLAIM/REF required `#` immediately after the verb, so a claim whose issue
   number is marked up -- how #3047's body and a large share of this fleet's PRs are written -- counted as a bare
   mention: measured, claims("Closes **#3041** -- the row has been red") == []. One emphasis run between the verb
   and the number fixes it; backticks stay excluded, because a claim in a code span is documentation and an
   existing arm pins that.

Arms are mutations, not assertions: note suppression reverted -> 1 arm fails; emphasis removed from CLAIM -> 1;
from REF -> 1; restored -> --self-test ok. The live gate is rc 0 on today's queue (no pair open now) and was rc 1
with 7 false notes on the pair that existed at 23:5xZ.

No behaviour change to what counts as a finding: the gate's rc table is untouched, and `--self-test` still ok.

* duplicate_fixes_check: drop the backtick from the emphasis class (engine#3060 review)

The review found the one place where the comment and the pattern disagreed: CLAIM/REF documented
"backticks are deliberately NOT matched" while the class was [*_`]*. Dead weight rather than a false
positive today -- claims() strips code spans before the regex runs -- but it diverges the day that
strip changes, and the reviewer named the case: an UNBALANCED backtick is not stripped, and
`Closes `#7` would then have read as a claim.

Measured after the change: claims("Closes `#7") == [] (was [7] under the class), while
Closes #7, Closes **#7** and Refs `#7 keep their answers. Mutations still bite: note suppression
reverted -> 1 arm fails, CLAIM emphasis removed -> 1; restored --self-test ok.

One character and a comment that is now true.

* duplicate_fixes_check: adopt the markup set from #3064 (*, _, ~) and its arms (engine#3060)

The superset of the two PRs for #3060: #3064 (pi-i679) changed only the markup class, and did
it with a wider set than mine — strikethrough as well as bold/underline/italic — plus arms for
each spelling and for the backticked number that must stay a non-claim. Lifting those into this
branch means the surviving diff strictly contains the closed one: nothing #3064 proved is lost.

Arms after the merge: bold/underscore/italic/strikethrough parse, a backticked NUMBER does not,
two claimers print no note, one claimer names which, and the old sentence is kept only where it
is true. Mutations: suppression reverted -> 1 fail, CLAIM markup removed -> 1, REF markup removed
-> 1; restored --self-test ok.

---------

Co-authored-by: phyb5 <bcloud@local>
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