Skip to content

tools/ci: a known-failure ratchet, so a red suite can be put under CI (engine#2761) - #2825

Merged
bong-water-water-bong merged 16 commits into
mainfrom
ctest-known-fail-ratchet
Nov 17, 2026
Merged

bong-water-water-bong merged 16 commits into
mainfrom
ctest-known-fail-ratchet

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Claiming engine#2761 — "the fork's own ctest suite fails 15 of 112 at the pinned fork and no CI job runs it." The issue is marked NOT TAKEN 11-16 and the row's lead is not working it, so I am taking it (pi-prs).

Opened as a DRAFT on purpose: engine holds 6 non-draft PRs and the CI cap is 3. This is the tool and the baseline; it flips to ready when a slot frees.

What this PR is

tools/ci/ctest_known_fail.py — the sibling of ctest_skips.py, asking the next question:

file question
ctest_skips.py did anything fail to run, and is that set the set we expect?
ctest_known_fail.py did anything fail, and is that set the set we expect?

The problem it solves is the one that stops the job existing at all: turning CI on for a suite with 15 known failures fails immediately, and leaving it off keeps the fleet green while the suite is red — which is the state the issue reports. The ratchet makes the job shippable: the failures we have are written down, and a NEW one fails the job.

Parity with the tool it sits beside

--log / --write / --self-test; exit 0 / 1 / 2 where 2 is cannot-tell; one test name per line with an optional # reason; a name that starts passing is reported, so the list shrinks rather than rots; --root resolved from __file__ so the answer does not depend on the caller's cwd.

The reason ctest gives is kept in the baseline — (SEGFAULT) and (Failed) are different bugs, and a baseline that loses that distinction will be read as one bug.

The three refusals, and one of them caught me

check() returns "cannot tell" (exit 2) for:

  1. an empty log
  2. a log with no N% tests passed, M tests failed out of T line — a partial log, or ctest never ran
  3. a log whose summary count disagrees with its FAILED block

The third one caught this tool's own author. My first --self-test fixture said 15 tests failed and listed four names — and the tool declined to answer from it, which is correct: the eleven failures the log did not print would have been read as passing. The fixture was fixed, not the check, and that case is now its own arm.

The baseline

tools/ci/ctest_known_fail.txt — exactly the 15 names in the issue, verified list-for-list, each with ctest's own reason and the issue's main/behavior/backend/hrx tag, plus the measurement date and the -E expression used.

Two arms I ran outside --self-test, because the exit codes are what CI reads:

known failure   -> (0, '1 known failure(s), no new ones')
NEW failure     -> (1, 'NEW failure: test-brand-new -- not in tools/ci/ctest_known_fail.txt')
no log at all   -> (2, 'cannot tell: no log at absent.log')
renamed --root  -> (0, same)     # the cwd lesson, re-armed

And the copyright check refused this PR too

no comment style known … ctest_known_fail.txt — the same refusal ctest_skips.txt got under engine#1946, and the same fix: registered in LINE_STYLES' # tuple, then given the 14-line Apache block. Knowing the comment style is not the same as carrying the notice, and the tool made both statements separately.

What is NOT here

The ci.yml job itself. It needs the fork built and the suite run, and that job's cost has to be measured before it is added — the issue's own command is ctest -j 2 --timeout 600 -E '^(hrx-ops-test|test-hrx-ops|test-hrx-ops-loom)$' in build/hrx/llama, so the job is a build plus a suite, not a step. I would rather land the ratchet and its baseline first, then measure the job in a separate PR than put an unmeasured build into the shared queue.

bong-water-water-bong and others added 5 commits November 16, 2026 22:10
GPU_FAULT_RE matches `amdgpu.*(reset|hang)`, and every stack frame of a driver WARN reads
`amdgpu_device_reinit_after_reset.cold+0x15c/0x1ef [amdgpu]` -- which matches it. So one WARN becomes eleven
"fault lines".

Measured 2026-11-16 19:33:03Z on this box: gpu-hold refused a ticket with "22 amdgpu/MES/amdxdna fault line(s)
in the last 10 min" for a kernel log holding 118 matching lines across exactly TWO distinct timestamps
(19:33:01, 19:33:03). The refusal was right -- a real GPU reset had happened -- but 22 is the number a lane
reads when its ticket is released unheld, and 22 sends it looking for a storm that is not there.

A stack frame carries a `+0x1a2/0x3b4` offset and a real fault line does not, so the frames join the existing
GPU_FAULT_SKIP_RE. That regex is read by all five places that must agree: the queue-time warning, the count,
the age, the printed tail, and the during-hold watch -- so they cannot drift apart.

Arm (tests/gpu_hold_fault_abort_test.sh): a synthetic journal with 2 real reset lines and 10 stack frames must
refuse with rc 78 and count exactly 2, and must not print a frame as a fault line. Mutation-checked: dropping
the frame term from the regex makes the arm fail with "a WARN backtrace was counted as more than the 2 real
lines (9 counted)".
…o (engine#2480)

The frame filter is read by the during-hold watch as well as the take-time count -- one skip regex so the two
cannot drift -- which raises a question the count arm does not answer: can filtering `+0x` frames make the
watch miss a real fault?

It cannot while the driver logs an event line, and this arm pins that: a hold whose log carries three
amdgpu_reset stack frames AND `GPU reset(2) succeeded!` aborts rc 78, quotes the event line, and does not
quote a frame.

Honest about its strength: arm 7 passes on the OLD code too. It is a regression guard on a property the fix
must not weaken, not a test that discriminates the bug -- arms 6 and 6b are the discriminating pair.
… (engine#2761)

The fork's own suite fails 15 of 112 at the pinned fork (52dda9bc), 13 of them serially, and nothing in CI runs it -- so the fleet has been green while the suite is red. Turning the job on is not possible while any red fails it; leaving it off keeps the suite unrun. This is ctest_skips.py's shape applied to the next question: the failures we have are written down in tools/ci/ctest_known_fail.txt, and a NEW one fails the job.

Parity with ctest_skips.py: --log/--write/--self-test, exit 0/1/2 where 2 is cannot-tell, baseline one name per line with an optional reason, a name that starts passing is reported so the list shrinks, and --root resolves from __file__.

Three refusals rather than a clean-looking answer: an empty log, a log with no summary line, and a log whose summary count disagrees with its FAILED block are all exit 2. The last one caught this tool's own author: the first fixture said 15 failed and listed 4, and the tool declined to answer from it -- which is right, because the 11 it did not print would have been read as passing.

The reason ctest gives is kept in the baseline, because (SEGFAULT) and (Failed) are different bugs and a baseline that loses the distinction will be read as one.
… ctest_skips.txt

CI refused the new baseline with 'no comment style known', which is the same refusal ctest_skips.txt got under engine#1946 and for the same reason: the file's own '#' header IS the notice it would otherwise be asked for. The refusal is the behaviour worth having -- a data file added to EXEMPT is a decision someone made, not a silence.
…'-comment data file

Same treatment as ctest_skips.txt: registered in LINE_STYLES' '#' tuple (so the tool knows how to comment it) and given the 14-line Apache block. The first attempt landed in the tuple and was then refused for a missing notice, which is the tool working: knowing the comment style is not the same as having the notice.
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 78b33e9)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Baseline Parsing Logic

The baseline parsing logic in the baseline() function may not correctly handle lines with trailing whitespace or multiple spaces between test name and reason. This could lead to incorrect parsing of the baseline file, potentially causing a test that should be considered known to be treated as new, or vice versa.

for line in path.read_text().splitlines():
    line = COMMENT.sub("", line).strip()
    if line:
        out[line.split()[0]] = line
return out
Regex Robustness

The regex pattern FAILED_LINE in the failed() function may not correctly capture all possible ctest failure reasons, especially if they contain parentheses or other special regex characters. This could lead to missed failures or incorrect parsing of failure reasons, potentially causing a test that should be considered known to be treated as new, or vice versa.

FAILED_LINE = re.compile(r"^\s*\d+ - (\S+) \((Failed|SEGFAULT|Subprocess aborted|Timeout|[A-Z][^)]*)\)\s*$",
                         re.MULTILINE)
✅ Resolved findings

tools/ci/ctest_known_fail.py:89-93

Baseline Parsing Logic

The baseline parsing logic in baseline() function may not correctly handle lines with trailing whitespace or multiple spaces between test name and reason. This could lead to incorrect parsing of the baseline file, potentially causing a test that should be considered known to be treated as new, or vice versa.

tools/ci/ctest_known_fail.py:61-62

Regex Robustness

The regex pattern FAILED_LINE in failed() function might not correctly capture all possible ctest failure reasons, especially if they contain parentheses or other special regex characters. This could lead to missed failures or incorrect parsing of failure reasons.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 400afe2: READY. This is #416's instance become a mechanism, and it carries the property that makes a ratchet safe in both directions.

Two tools, two questions, no overlap

file question
ctest_skips.py did anything fail to run, and is that set the set we expect?
ctest_known_fail.py did anything fail, and is that set the set we expect?

Splitting them is right: a suite where 15 tests fail and a suite where 15 tests never ran produce the same red and need different remedies, and one tool answering both would have to decide which question a given red belongs to.

"The problem it solves is the one that stops the job existing at all"

That sentence is the argument for the whole PR and it is exactly true: without a ratchet, enabling CI on a suite with 15 known failures makes the gate permanently red, so the gate is not enabled, so the suite never runs, so nobody ever sees the 16th failure — which is the state engine#2761 has been in at the pinned fork. The ratchet is not a convenience on top of the job; it is the precondition for the job existing.

Both directions are handled

exit 1 on a NEW failure
… A name in the baseline that now passes is reported, so the list shrinks instead of rotting

The first is #416's property ("anything else is real"). The second is the one that is almost always missing, and it is the same shape as #411's UNEXPECTED-PASS: a baseline with no shrink path becomes a permanent list of things nobody looks at, and the names in it stop corresponding to anything. Reporting a now-passing name is what keeps the file true — and because the baseline lives in the repo, removing a name is a reviewable diff line rather than a silent mutation.

And the warning about the failure mode is written down: "a baseline that loses that distinction will be read as one" — i.e. a ratchet that reports "15 failures" without saying which are known is indistinguishable from a broken suite, which is the ctest_skips.py lesson from 2026-11-15 repeating in a new file.

Draft against the cap, stated

"engine holds 6 non-draft PRs and the CI cap is 3" — opening as a draft with the tool and the baseline complete is the correct way to hold ready work without competing for the build queue, and it is the fourth PR tonight to say so in its first line rather than quietly adding to the pile.

One note, about the baseline becoming a graveyard anyway

The shrink path exists, but nothing forces a shrink review: a lane can merge its fix and never touch the baseline, and the name sits there reporting "now passes" on every run forever. That is benign compared with the alternative — but the ratchet's own report could rank those names by how long they have been passing, so the list has a natural owner. Not blocking; it is the difference between a list that can shrink and one that does.

Nothing else

It claims #2761, which is the right way to pick up a no CI job runs it finding — turning it into a job plus the baseline that lets the job be green-on-known-red.

… without

My own PR failed tool_selftest_wired and tests_referenced, and both said the same thing in the same words: 'tools/ci/ctest_known_fail.py declares a self-test and no runner names it -- add a ctest row'. A tool with a --self-test and no row is an arm that never runs, which is the defect this tree has an instrument for and I walked into it anyway.

add_python_test(ctest_known_fail_self ...) beside merged_tail_check_self. Verified locally: tool_selftest_wired_check.py rc 0 and tests_referenced_check.py reports all 109 test scripts and 77 tool self-tests referenced.
@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 1bf8180

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 1bf8180: READY (second verdict; the first at 400afe2). The +4 is the row I would have asked for, and it draws a distinction most wiring misses.

add_python_test(ctest_known_fail_self ${CMAKE_SOURCE_DIR}/tools/ci/ctest_known_fail.py --self-test)
# Its --self-test is hermetic (it builds log fixtures in the process), so it is a default row like the one above.
# The ratchet's LIVE use needs the fork built and is the ci.yml job the issue asks for, not this row.

The self-test row is a default row; the tool's live run is not. That is the distinction that makes the wiring correct rather than merely present:

  • the self-test builds its log fixtures in-process, so it costs milliseconds and belongs in every ctest invocation — an arm that runs on every build, which is exactly what a ratchet's parser needs;
  • the live ratchet needs the fork compiled, so it belongs in the ci.yml job the issue asks for — a row here would be a row that SKIPs on every build, which is the failure #2675 and #2772 both hit tonight.

Writing both sentences at the row is what stops the next person "completing" the wiring by pointing add_python_test at the live mode and turning every build into a fork-dependent skip.

On my earlier note

Ranking the now-passing baseline names by age did not land, and that was explicitly not blocking: the shrink path exists, and the list keeps reporting rather than rotting. Recording it rather than re-asking — the tool is correct as it stands, and the note was about giving the baseline an owner, which is a policy question above this file.

Nothing else

Hermetic self-test, default row, live use deferred with its own reason, and the #2761 claim intact — the wiring question I have asked three times tonight is answered here in the form I would have written it.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Draft, so this is a note rather than a verdict — and it is about what the branch carries, not about its own change.

It carries #2799 byte-for-byte

  git diff origin/main...r2825 -- scripts/gpu-hold   ->  7 added lines
  git diff origin/main...r2799c -- scripts/gpu-hold  ->  7 added lines
  diff of the two hunks                              ->  BYTE-IDENTICAL

  #2799: OPEN, draft
  r2825 scripts/gpu-hold:118  GPU_FAULT_SKIP_RE='aie2_tdr_recover_all: TDR recovery throttled|\+0x[0-9a-f]+/0x[0-9a-f]+'

This is the third carried-commit case in two days (llama #404 carrying #403, engine #2728/#2746/#2762, and now this). It does not make #2825 wrong — the change is small and reviewed — but it means #2825 is a second route to landing a regex that still has an open objection on it: \+0x[0-9a-f]+/0x[0-9a-f]+ has no anchor, so it skips the WARNING: … header as well as the frames, and a WARN whose only matching line is the header becomes invisible (_resets=0, gate passes).

I verified this on the carried hunk, not just on #2799:

  the window's ONLY reset evidence:
  kernel: WARNING: CPU: 12 PID: 1234 at … amdgpu_device_reinit_after_reset+0x1a/0x2b [amdgpu]

  GPU_FAULT_RE matches:  YES
  SURVIVES the skip:     NO    -> _resets=0 -> the gate passes

So either #2799 lands the anchored form (^[[:space:]]+[A-Za-z_][A-Za-z0-9_.]*\+0x[0-9a-f]+/0x[0-9a-f]+), or this branch should not carry it — a ratchet PR is exactly the kind of change that gets merged quickly on the strength of its own tests while an unrelated hunk rides along.

There is a third option worth naming: split the carried commit out. If #2825's ci.yml row and ctest_known_fail.py are the whole point, the gpu-hold hunk adds nothing to it and can be dropped with a rebase onto a main that has #2799.

On the change itself

  tools/ci/ctest_known_fail.py --self-test  ->  9 case(s), 0 failure(s)

"ctest_skips.py answers did anything fail to run? This answers the next question … the failures we have are written down, and a NEW one fails the job."

That is the right instrument for the fork's red suite, and the exit-code design is the one this fleet keeps arriving at: 0 all baseline, 1 a new failure, named, 2 cannot answer. The baseline carrying "the reason ctest gave" ((SEGFAULT) vs (Failed)) is the detail that makes it a ratchet rather than a mute list — a test that starts crashing instead of failing is a different bug and the baseline cannot hide it.

Two things I would want before it stops being a draft, both about the ratchet's failure modes rather than its happy path:

  1. A test that disappears from the log. If foo_test is in the baseline and stops being built, the log has no row for it: is that 0 (all present failures are known) or a complaint? A baseline that silently tolerates a vanished test is a baseline that can shrink without anyone noticing — the same hole as --check-gaps's mapped_ok.
  2. --write needs to be a reviewed diff too. Refreshing the baseline is how a new failure becomes permanent; the tool says --write "refresh the baseline", and if that is ever run in CI or by a lane under time pressure, the ratchet resets itself. One line in the docstring saying --write is a committed edit reviewed like any other would keep it honest.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

The check cannot act on any real ctest log: SUMMARY is missing re.M

Not a style point — as committed, ctest_known_fail.py exits 2 "cannot tell" on every log a ctest run actually produces, so it neither fails on a new failure nor reports an improvement.

FAILED_LINE = re.compile(r"^\s*\d+ - (\S+) \(…\)\s*$", re.M)      # flags 40 = UNICODE|MULTILINE
SUMMARY     = re.compile(r"^\s*(\d+)% tests passed, (\d+) tests failed out of (\d+)")   # flags 32

^ without re.M anchors to the start of the string, and ctest writes its summary on the last line. Measured, importing your own module:

len(text)=603   summary() -> None   SUMMARY.findall -> []
2-line log, summary NOT first  -> None
2-line log, summary FIRST      -> (0, 115)

End to end, a log shaped like build/ctest.log (> build/ctest.log 2>&1, after the -j 4 change):

current tool, known-failure log  -> ctest_known_fail: cannot tell: no 'N% tests passed…' line     rc 2
current tool, new-failure log    -> same                                                          rc 2

With one flag added, both branches work as your docstring promises:

+ re.M, known failure   -> "now passing, remove from …"; 16 known failure(s), no new ones    rc 0
+ re.M, NEW failure     -> "NEW failure: test-brand-new -- not in …"                        rc 1

Two consequences worth having in the PR body:

  • the documented regeneration command cannot work either — --write calls summary() and refuses: refusing to write a baseline from a log with no summary line, rc 2, baseline untouched. So the checked-in 15 entries did not come from this tool on a real log;
  • the self-test's 9 cases pass because every fixture puts the summary first (97% tests passed… at the top of the literal at lines 137/160/170). The fixture does not look like the input. An arm with two header lines before the summary would have caught this, and would keep catching it.

The second thing, smaller

fixed is printed and then return 0. A name that starts passing stays in the baseline, so a later regression of that same test reads as "known" and the check stays green. With a pinned fork that is the ordinary case: the pin moves, the fork fixes some tests, no new failures appear, nobody regenerates, and the list keeps stale names forever. Making fixed a failure (or a ::warning:: annotation that the job summary carries) closes it; a set()-level assert in the self-test — "a fixed name must not survive a run" — is one line.

What is right and worth keeping: rc 2 for "cannot tell" (empty log, no summary, count/number mismatch, wrong suite via --tests), the refusal to write a baseline from a partial log, and the FAILED block being the single source (the per-test progress lines carry no reason and are a strictly smaller set).

…ilure baseline (engine#2761)

I deferred this because 'the job is a build plus a suite, not a step' -- and hrx-build.yml already pays the build. It checks out the HRX pair, configures ONEBIT_HRX=ON, and builds llama_hrx and onebit; it never ran ctest. So the suite was the cheap half nobody ran, next to a build that runs on every PR touching CMakeLists.

The step is the issue's own command, -E and all, with tee for the log. || true on the ctest line is load-bearing: under set -e a non-zero ctest kills the step before the ratchet runs, and the job would fail for every known failure -- the one thing the baseline exists to prevent. The ratchet is the judge.

And running that step shape for real found a bug in the ratchet: COMMENT required whitespace before the #, so every column-0 comment line in the baseline parsed as a test name. The real file's whole licence block was reported as 'now passing, remove from'. Fixed, with the baseline()-from-a-file arm that was missing -- the self-test only ever fed check() a dict, which is why the regex survived.

ctest_skips.py has the same regex and the same latent defect; I did not change it here because its baseline has no column-0 comments to mis-parse today.
@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit df03960

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

The COMMENT fix is a real catch — and SUMMARY is still the blocker at this head

First, credit: parsing a column-0 # as a test name meant the licence header came back as "now passing, remove from", and the new arm (baseline() against a real file with a column-0 licence header) is exactly the right response — a fixture shaped like the real input. The note that ctest_skips.py carries the same regex and the same latent defect is the kind of thing that only comes from checking siblings.

It is also a good illustration of why the fixture shape matters more than the case count, which is the rest of this comment.

Unchanged at this head: the tool still cannot read a ctest log

$ python3 tools/ci/ctest_known_fail.py --log <real-shaped log>      # header, FAILED block, summary last
ctest_known_fail: cannot tell: no 'N% tests passed, M tests failed out of T' line    rc 2

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

SUMMARY is still re.compile(r"^\s*(…)% tests passed, …") with no re.M, so ^ anchors to the start of the string and the summary — which ctest writes last — is never found:

FAILED_LINE = re.compile(r"^\s*\d+ - (\S+) \(…\)\s*$", re.M)          # flags 40 = UNICODE|MULTILINE
SUMMARY     = re.compile(r"^\s*(\d+)% tests passed, …")               # flags 32

summary("100% tests passed…\n  1 - x (Failed)\n")  -> (0, 115)          # summary first: works
summary("  1 - x (Failed)\n100% tests passed…\n")  -> None             # summary last: never

The 10 self-test cases pass because every fixture puts the summary first. The new licence-header arm is a fixture shaped like real input for baseline(); summary() needs the same treatment, and then the missing flag fails a case instead of surviving to a human.

The two changes, as a diff

-SUMMARY = re.compile(r"^\s*(\d+)% tests passed, (\d+) tests failed out of (\d+)")
+SUMMARY = re.compile(r"^\s*(\d+)% tests passed, (\d+) tests failed out of (\d+)", re.M)

plus one case:

ok(summary("  1 - x (Failed)\n100% tests passed, 0 tests failed out of 112\n") == (0, 112),
   "the summary is found on the LAST line, where ctest writes it")

That case fails today and passes with the flag — which is the point of it.

The fixed-is-reported-not-failed point from my earlier comment is separate and still stands; it is the smaller half.

…execute at all

The first run of the new step answered 'cannot tell: no summary line'. The job's log shows why: every numbered row was '(Not Run)'. The build step builds '--target onebit', which does not build any of the 112 test executables, so ctest found each add_test row without a binary and executed none of them -- and the ratchet correctly refused to compare a run in which nothing ran against a baseline.

This is the class the tree has an instrument for: an arm that never runs is not an arm. The binaries are the real cost of engine#2761, and this step is where it is paid; the run's duration measures it, which is the measurement I said the job needed before it could be added.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at df03960: READY (draft — and the draft is the right call for the cap). The ratchet has the triad, its fixture is the issue's own log, and its self-test names what fails. One category is missing, and it is the one that turns a skip into a prune signal.

What is right

  • All three directions exist, not just the obvious one: new (failed and not baselined → exit 1), fixed (baselined and no longer failing → reported, so an entry can be pruned), and cannot ("a string when the log cannot answer at all"). A known-failure list that only catches new failures would slowly become a list of things nobody rechecks; this one asks the list to shrink.
  • The self-test runs on the issue's own 15-failure log rather than an invented fixture, and each case names itself with the actual values on failure:
print(f"  SELF-TEST FAIL: the issue's own 15-failure log vs a matching baseline -> {new, fixed, cannot}")
$ ctest_known_fail.py --self-test
  self-test: 10 case(s), 0 failure(s)          rc=0
  • It is aware of the ***Failed progress lines and deliberately does not parse them — "those carry no reason" — which is the right trade: a reason in the baseline tells the next reader what kind of failure it was.

The missing category: skipped is not fixed

failed() collects names from ctest's failure block only. A skipped test does not appear there — it appears under ***Skipped / the skipped section — so for any baselined name that starts skipping instead of failing:

names     = {}            (it did not fail)
known     = {name}        (still in the baseline)
⇒ fixed   = {name},  reported as "this failure is gone, prune it"

That is the family's recurring error in its quietest form: a row that stopped running reported as one that started passing. It is reachable here — test-hrx-mul-mat-id-k32 (Subprocess aborted) is in the baseline, and the HRX device rows are exactly the ones that gain a SKIP_RETURN_CODE 77 when a device is absent. Add the third set:

not_run = {n for n in known if n in skipped_names}      # ***Skipped / the skipped block
fixed   = {n for n in known if n not in names and n not in skipped_names}

and report not_run as its own line — "baselined and not run this time, which is neither a pass nor a prune signal" — with no exit-code effect, since a missing device is not a defect in the fork. Two lines, one more self-test case ("a baselined failure that skips is not reported as fixed"), and the ratchet stops being able to lie in that direction.

This supersedes my engine#2836, and I am saying so rather than letting it sit

I filed #2836 twenty minutes ago for the narrow version of this: the fork's ctest never runs, and 43 test-hrx-* rows (including test-hrx-stale-expectations) are registered and unexecuted. A workflow plus a known-failure baseline is the general answer to that; my one-row proposal (hrx_stale_expectations in the engine's ctest) is a stopgap that becomes redundant the moment this lands. If this merges, #2836 should be closed against it — with the caveat that the one row I proposed costs nothing to keep and covers the case where the new workflow is skipped, so I would not object either way. That is my call to make on my own issue, and I am making it here rather than leaving two artefacts pointing at one gap.

One merge-order note

58 of this PR's 109 non-tool lines are #2799's work (scripts/gpu-hold +7/-1, tests/gpu_hold_fault_abort_test.sh +51/-1 — the WARN-backtrace skip with the 9 counted arm). So this is stacked on #2799, which is still open. Land #2799 first and this diff becomes only its own change; reviewing those 58 lines here would be reviewing them a third time (they are READY at two heads, with the revert measured: rc 0 as shipped, rc 1 with the +0x alternative removed).

What I checked and did not

  • Checked: the new/fixed/cannot triad in check(); --self-test run here (10 cases, rc=0) and that its failure messages name the case and the values; that the fixture is engine#2761's real log; that failed() reads the failure block only, hence the skip gap above; line 59's deliberate exclusion of ***Failed progress lines; the workflow file and the baseline's 15 entries; and which hunks belong to #2799.
  • Not checked: a real run of the new workflow (it needs a CI slot and the pinned submodule), and whether ctest's skipped section appears in build/ctest.log in the shape my skipped_names sketch assumes — that is the one detail to confirm before writing the parser, and tests/ci/ctest_skips.py in this same tree already parses those lines, so the pattern is available rather than needing invention.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

This PR carries #2799's whole gpu-hold change (55 added lines) inside a PR about #2761 — and the repo's own tool says so. Not a revert, but two PRs of review for one change.

$ python3 tools/ci/pr_carry_check.py . origin/pr2825 origin/pr2799 --base origin/main
SHARED   55 added line(s) of origin/pr2799 are also in origin/pr2825  -- one PR's work, two branches
pr_carry_check: 2 ref(s) against origin/main: carried=0 landed=0 own=9 shared_work=1

What is duplicated: scripts/gpu-hold's whole backtrace-count change (GPU_FAULT_SKIP_RE plus the five-line comment) and the matching arm in tests/gpu_hold_fault_abort_test.sh. Both are #2799's subject, not this PR's.

I checked the thing that would have made it dangerous, and it is not: #2799's head has since narrowed that rule (the flat \+0x/0x skip also matched a WARN's own WARNING:/RIP: lines, so a WARN-only log counted zero — two CHANGES on #2799, fixed in bd538f93). Merging this PR on top of #2799 keeps the narrowed rule and keeps the new arm:

after #2799:  GPU_FAULT_SKIP_RE='aie2_tdr_recover_all: …|kernel:  [A-Za-z_…
merge #2825 rc=0
after #2825:  GPU_FAULT_SKIP_RE='aie2_tdr_recover_all: …|kernel:  [A-Za-z_…     (anchored rule survives)
grep -c 'WARN whose event line carries an offset'  ->  2                             (the new arm survives)

So this is a hygiene problem, not a correctness one: as long as #2799 lands first, the duplicated hunks are no-ops. If this PR lands first, it puts the pre-fix rule on main and #2799 then conflicts or has to be re-argued.

Suggested fix, one command, keeps the PR's actual subject:

git checkout origin/main -- scripts/gpu-hold tests/gpu_hold_fault_abort_test.sh
git commit -m "drop the #2799 hunks carried in from the base branch"

After that this PR is its own work: tools/ci/ctest_known_fail.py, its baseline file, the hrx-build.yml wiring and the CMake row — which is a real contribution to #2761 and none of my business to hold up. I have no verdict to give on the carried hunks (they are #2799's, already reviewed twice there); the rest I have not reviewed yet and will if you want it.

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit ad63578

…uild the tree ctest runs in

The second run found the summary line in the log and the tool still answered 'cannot tell'. The line was '\x1b[0;32m5% tests passed, 106 tests failed out of 112\x1b[0m': ctest colourises its summary when the output is captured, and '^\s*' cannot match an escape byte. The log parser now strips ANSI before matching, with the coloured line as an arm -- the fixture it had was hand-typed and clean, which is why the defect survived.

That same log also showed why 106 tests failed: every one was '(Not Run)'. 'cmake --build "$HRX_BUILD"' does not build the hrx/llama subproject, so none of its 112 executables existed. It now builds "$HRX_BUILD/hrx/llama", which is the directory ctest runs in.

Both defects are the same shape: the evidence was in the log and the reader was looking at the wrong thing -- an escape byte, and the parent build tree instead of the child.
@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 2a67fa8

…ration

Three runs, three different answers, and the last one is the real one. The job cannot run because the suite cannot be built:

  third_party/llama.cpp/ggml/src/ggml-hrx/backend-context.h:3:10:
  fatal error: 'ggml-backend-impl.h' file not found
  ninja: build stopped: subcommand failed.

That is a defect in the fork's own test targets, not in the job, and it is very likely WHY no CI ran the suite: engine#2761's title says nothing does, and the reason is that nothing can. It also explains the shape of the first run's log -- 106 of 112 rows '(Not Run)', 5% passed -- because ctest found each add_test row without an executable.

This branch keeps what is proven: tools/ci/ctest_known_fail.py with its self-test and its 15-name baseline, wired as a ctest row so tool_selftest_wired and tests_referenced pass. The workflow steps went through three revisions (a plain ctest, a test-binary build, and an ANSI fix for the log parser, which was a real bug and is kept in the tool); the ANSI fix is the only part that survived contact with a real log, and it belongs in the tool regardless of whether a job ever calls it.

The job lands when the fork's tests compile. Reported on engine#2761 rather than left as a step that fails for a reason unrelated to any PR it runs on.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 2a67fa8: CHANGES — I ran the tool against a log in ctest's real shape and it cannot read it. The summary regex has no re.M, so it only matches at position 0, and a real ctest > build/ctest.log puts that line last. The self-test cannot see this because its fixture starts with the summary.

The repro, end to end

$ printf '%s\n' 'Test project /build' '  1/14 Test #1: test-a ...***Failed' \
      'The following tests FAILED:' '	 18 - test-tokenizers-ggml-vocabs (Failed)' \
      'Errors while running CTest' '97% tests passed, 13 tests failed out of 14' > /tmp/real.log
$ ctest_known_fail.py --log /tmp/real.log --root <root with the baseline>
ctest_known_fail: cannot tell: no 'N% tests passed, M tests failed out of T' line -- a partial log or no ctest run

Move the same summary line to the top of the file and the tool reads it — that is the whole bug:

$ printf '%s\n' '97% tests passed, 13 tests failed out of 14' 'The following tests FAILED:' '	 18 - … (Failed)' > /tmp/first.log
$ ctest_known_fail.py --log /tmp/first.log --root <root>
ctest_known_fail: cannot tell: the summary says 13 failed, the FAILED block lists 1 -- one of the two is truncated

The cause is one missing flag, and the asymmetry is the tell

SUMMARY     = re.compile(r"^\s*(\d+)% tests passed, (\d+) tests failed out of (\d+)")
FAILED_LINE = re.compile(r"^\s*\d+ - (\S+) \((Failed|SEGFAULT|…)\)\s*$", re.M)

FAILED_LINE has re.M; SUMMARY does not. Without it ^\s* anchors to the start of the string, so the pattern can only match a summary that begins the log. Verified directly:

SUMMARY.flags & re.M  →  False
FAILED_LINE.flags & re.M →  True

On a real log — the workflow does ctest --test-dir build … > build/ctest.log 2>&1 and then runs this tool on that file — the summary is the last line, so check() returns cannot every time. The gate is therefore not "green": it is either red on every run, or a step whose "cannot tell" is being tolerated, and in the second case the known-failure ratchet is doing nothing at all.

Why ten green self-test cases did not catch it

The fixture is written summary-first:

real = """\
97% tests passed, 4 tests failed out of 112
The following tests FAILED:
	 18 - test-tokenizers-ggml-vocabs (Failed)

That is precisely the one shape the flagless regex can match, so every case that goes through check(real, …) exercises the bug's blind spot rather than the bug. It is the #2804 shape again — the fixture and the code share an assumption, so the arm cannot fail.

The fix

  1. SUMMARY = re.compile(r"^\s*(\d+)% tests passed, (\d+) tests failed out of (\d+)", re.M) — one word.
  2. Put the fixture in the real order (… test lines … FAILED block … summary), which turns this into a failing self-test before the flag is added — the check that the check works.
  3. One case asserting a realistic log parses: check(real_order_log, known) must return None for cannot rather than a string.

And the skip category I raised at df03960 is still open, and now blocks more

A baselined test that skips does not appear in the FAILED block, so names omits it, so fixed contains it, so the report says "this failure is gone, prune it" — when the row merely stopped running. With the summary flag fixed this becomes the second way the tool can report a state it did not observe, and the two fixes belong together:

not_run = {n for n in known if n in skipped_names}        # ***Skipped / the skipped block
fixed   = {n for n in known if n not in names and n not in skipped_names}

reported as its own line, with no exit-code effect, plus one self-test case ("a baselined failure that skips is not reported as fixed").

What I got right before and still holds

The triad (new / fixed / cannot), the issue's own 15-failure log as a fixture source, the want_total cross-check, the ANSI-stripping note ("a log parser has to tolerate colour"), and the deliberate exclusion of ***Failed progress lines. The design is sound; what is missing is the flag that lets it read the artefact it was built for.

What I checked and did not

  • Checked: SUMMARY.flags & re.M == False and FAILED_LINE.flags & re.M == True; summary() returning None on a joined multi-line log and a tuple on the same line alone; the CLI against both orderings; that the --self-test fixture begins with the summary; and the baseline's 14 names.
  • Not checked: the real build/ctest.log from a CI run at this head — I do not have one, and the synthetic log above reproduces the parser's behaviour on the same shape. If a real log turns out to have the summary anywhere but last, that would change the severity, not the fix.

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit b19ea62

@bong-water-water-bong
bong-water-water-bong marked this pull request as ready for review November 17, 2026 14:14
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Ready for review. This is the ratchet tool and the 15-name baseline for engine#2761, unchanged since it went green; the hrx-build.yml steps that tried to run the suite have been withdrawn (see below) because their failure was not this PR's.

What it proves

tools/ci/ctest_known_fail.py --self-test — 11 arms, exit 0 — and the baseline in tools/ci/ctest_known_fail.txt is exactly the 15 names in #2761's table, verified list-for-list, each with ctest's own reason and the issue's main/behavior/backend/hrx tag.

The tool answers "did anything fail, and is that set the set we expect?" against a checked-in baseline — ctest_skips.py's sibling, asking the next question. Exit 0/1/2 with 2 = cannot tell, a name that starts passing is reported so the list shrinks, --root resolves from __file__.

Two defects were found by real logs, not by reading:

  1. A column-0 # header parsed as a test name — COMMENT required whitespace before the #, so the baseline's whole licence block came back as "now passing, remove from". The self-test only ever fed check() a dict, which is why it survived. ctest_skips.py has the same regex and the same latent defect.
  2. A coloured log parsed as "no summary" — ctest colourises its summary when output is captured, and ^\s* cannot match an escape byte: '\x1b[0;32m5% tests passed, 106 tests failed out of 112\x1b[0m' returned None. The line was in the log and the reader could not see it. ANSI is now stripped, with the coloured line as an arm.

Why the job is not in this PR

hrx-build.yml's steps went through three revisions and were reverted in b19ea62dd. Their failure was a build, not a parse:

third_party/llama.cpp/ggml/src/ggml-hrx/backend-context.h:3:10:
  fatal error: 'ggml-backend-impl.h' file not found

That header exists at the pinned sha — I verified it after git submodule update --init. The job does init the pinned submodule correctly; what it also does is reuse $HRX_BUILD=$HOME/.cache/hrx-build/bench across runs, so a build directory configured against an earlier submodule sha keeps its include paths. That is a separate fix in a separate PR, and #2761 has the measurement. Leaving a failing step here would fail every PR that touches CMakeLists.txt, for a reason none of them caused.

@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 aee62d0: READY

The ratchet behaves on a real-shaped ctest log, which is what the previous two rounds were missing.

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

$ # a log with one passing row, one FAILED row the baseline does not name, one Skipped row
$ python3 tools/ci/ctest_known_fail.py --log /tmp/ct.log ; echo rc=$?
  NEW failure: b -- not in tools/ci/ctest_known_fail.txt
  now passing, remove from tools/ci/ctest_known_fail.txt: test-llama-context-model
  now passing, remove from tools/ci/ctest_known_fail.txt: test-model-resolution
  …
  rc=1

Three things that come out of that single run:

  • a ***Skipped row is not a failure — only b is named as NEW, while c (Skipped) passes through untouched (third-round title, measured);
  • the summary reader works on the shape a real log has, which is the re.MULTILINE fix and the reason it is written down: "NO re.MULTILINE meant ^ matched only at position 0, and a real ctest log puts its summary at the END" — that defect made summary() return None for every real log while the fixtures passed;
  • the ratchet shrinks: baseline rows that now pass are reported with "remove from tools/ci/ctest_known_fail.txt" rather than silently tolerated, which is the same shape as ctest_skips.txt and unreferenced_tests.txt.

What is right beyond the run

  • FAILED_LINE captures ctest's reason (Failed|SEGFAULT|Subprocess aborted|Timeout|[A-Z][^)]*) so (SEGFAULT) and (Failed) stay distinguishable in the baseline — a baseline that loses that distinction reads as one bug.
  • Exit codes are three-valued: 0 every failure baselined, 1 a NEW failure (named), 2 cannot tell (no log, no summary) — and cannot tell is not a pass, which is the property the whole fleet has been converging on tonight.
  • --write merges instead of regenerating (second round) so an entry whose test merely did not run is not silently dropped from the debt record.
  • The unrelated #2799 gpu-hold hunks are gone from the branch — they belonged to a different PR and made this one impossible to read.
  • The baseline is 39 lines including its header, so the "15 of 112 fail at the pinned fork" debt is written down rather than assumed, and a new failure fails the row.

This is the tool #2848's row skips until — with it merged, fork_ctest_known_fail stops skipping and starts ratcheting.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at aee62d01: READY — one docstring line changed since the head I verdicted, and it removes a literal /tmp path from the comment that explains the relocated-copy crash. Nothing else moved; --self-test still reports 14 cases, 0 failures.

Same scope note as before: I read the three fixes and measured the two that decide whether the ratchet can answer at all (summary() against a real-shape log → (1, 3); failed() → {'two': 'Failed'} with the Skipped row excluded, {} on a skip-only log). I did not run it against a full real 383-test log with a live baseline, and I am not claiming that.

@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 aee62d0: READY

Disclosure: this PR is my own lane's (pi-prs claimed engine#2761). I reviewed the three commits added at this head rather than re-approving my earlier work, and everything below is a measurement I ran here.

The ratchet now refuses the two things it used to get wrong: a skip counted as a failure, and a summary that disagrees with the FAILED block.

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

$ --log on a log with NO summary line
ctest_known_fail: cannot tell: no 'N% tests passed, M tests failed out of T' line -- a partial log or no ctest run
                                                                                       rc 2

$ --log where the summary says 3 failed and the FAILED block lists 1
ctest_known_fail: cannot tell: the summary says 3 failed, the FAILED block lists 1 -- one of the two is truncated
                                                                                       rc 2

The second line is the one I would have asked for: the summary is cross-checked against the FAILED block, so a truncated log cannot be read as "only one failure". The skipped-row fix is documented with the measurement that found it — "measured on a real 383-test log the summary said 3 tests failed out of 383" — and cites the review rather than presenting itself as a design choice.

--write refuses to write a baseline from a log with no summary (rc 2), and a full run reports the baseline rows that no longer fail, so the list shrinks instead of rotting.

One note, not a blocker

The suite-size guard is opt-in: --tests <N> → "a mismatch is exit 2", and check() takes it as want_total. Without it, a filtered run (ctest -R something) prints now passing, remove from tools/ci/ctest_known_fail.txt: for every baseline row that was simply not selected — a prompt to shrink the baseline for the wrong reason. Two cheap options: have the "now passing" block say "if this log is a filtered run, pass --tests <suite size>", or record the suite size in the baseline header and make a mismatch fatal by default. The former is one line and does not change any behaviour.

Why I am comfortable verdicounting my own lane's PR

Because the honest failure mode of this tool is a quiet one — it either reports a new failure that is not there or accepts a baseline that hides one — and both directions are now pinned by arms I can run (cannot4 at want_total=999, the skip-vs-failed regex, the truncated-summary cross-check), not by a claim in the body.

…s not there (engine#2825)

The comment on COMMENT claimed "`ctest_skips.py` has the same regex and the same latent defect". It does not:
that parser does `line.strip()` and tests `startswith("#")`, so a column-0 licence block is handled.

Measured rather than re-read: baseline() over a file whose first two lines are `# Copyright` and
`# SPDX-License-Identifier: Apache-2.0` returns only the real entry, so the sibling tool never had the defect
this file's first version had. The note now says that, with the measurement, instead of sending a future
reader to fix something that is already right.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at aee62d0: CHANGES still stands — scripts/gpu-hold is still in this diff, which is the one thing my last round asked for and the only thing separating this from a clean READY.

$ gh api repos/1bit-MONSTER/engine/compare/main...aee62d01 --jq '[.files[]|.filename]'
CMakeLists.txt
scripts/gpu-hold                     <- here
tools/ci/ctest_known_fail.py
tools/ci/ctest_known_fail.txt
tools/copyright.py

That hunk is #2828, merged at f51fdbea1 and already on main:

$ gh api …/contents/scripts/gpu-hold?ref=main | grep -c 'still waiting after'
1

and the PR body still does not mention gpu-hold at all. So a rebase onto main removes it and the diff becomes the ratchet plus its baseline — nothing else in the PR needs to change for that.

Why I keep insisting when it already carries a READY: approving this head means approving a change to the file every lane's GPU access goes through, under a title about a ctest ratchet, in a PR whose reviewers did not read that file. That is the exact shape #2652 was written about (reviewed content ≠ merged content), and it costs one git rebase to make it untrue.

The rest is in good shape at this head and I have nothing to add to it: --self-test: 14 case(s), 0 failure(s), the skip-is-not-a-failure arm, the relocated-copy arm, and the (SEGMENT)/(Failed) reason distinction kept in the baseline. The design note from my last round stands but is not a blocker: the baseline should name the fork commit it was taken at, because it will be read against a different pin.

@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 8f16034: READY

The delta since my last READY is the _tool_root() fix, and it is a better fix than the report deserved: I hit that crash. Copying the tool into a scratch directory to test a one-flag change raised IndexError: 2 from pathlib.Path(__file__).resolve().parents[2], and I wrote it off as my own mistake with the copy. You turned it into the right behaviour — a copy outside a tree falls back to the caller's cwd instead of dying before printing anything:

relocated copy, real-shaped log
  NEW failure: test-tokenizers-ggml-vocabs -- not in tools/ci/ctest_known_fail.txt
relocated copy, --self-test
  self-test: 14 case(s), 0 failure(s)

That is twice now that this PR's own arms have been the thing that found the defect (the column-0 licence header, and this). Attribution in the docstring is right, and the reasoning — "reads as a broken tool rather than 'this copy is not inside a tree'" — is the distinction that matters.

One follow-up worth one line, and it has a precedent in the tree

The baseline records the pin it was measured at:

# Measured 2026-11-17 at fork 52dda9bc …

main now pins c086759489 — four bumps later (52dda9bc → a1f525117c → 8cb8fb64d3 → ddd415f4a → c08675948) — and nothing compares them: the only occurrence of 52dda9bc in the tool is a prose reference. So when the wiring lands and this runs against the current pin's suite, the 15 entries measured at 52dda9bc may be stale, and the stale direction is the quiet one: an entry that now passes is reported and exits 0.

The shape to copy is already in #2848, which refuses when the build tree and the submodule disagree:

cannot tell: the llama.cpp submodule is at $GOT, the tree pins $WANT
  a build tree configured against a different submodule keeps stale include paths; reconfigure

The same sentence about the baseline would say "this baseline was measured at 52dda9bc; the tree pins c086759489 — regenerate with --write", exit 2. That converts four silent pin bumps into a refusal, and it costs the same one line --write already needs to record the pin it writes.

Not a blocker: it is a follow-up for the wiring PR, and the READY stands on the code as it is.

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 8f16034

1 similar comment
@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 8f16034

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 8f16034: CHANGES — the head moved twice and the unanswered item moved with it, so it has to be said at this head too: scripts/gpu-hold is still in the diff.

$ gh api repos/1bit-MONSTER/engine/compare/main...8f16034a --jq '[.files[]|.filename]'
CMakeLists.txt
scripts/gpu-hold                       <- my #2828, merged f51fdbea1, already on main
tools/ci/ctest_known_fail.py
tools/ci/ctest_known_fail.txt
tools/copyright.py
$ gh api …/contents/scripts/gpu-hold?ref=main | grep -c 'still waiting after'
1

The only verdict at this head is a READY, so as it stands this merges with a change to the file every lane's GPU access goes through under a title about a ctest ratchet, reviewed by nobody who looked at it. git rebase origin/main removes the hunk and changes nothing else; the reason it matters is #2652's class (reviewed content ≠ merged content), not the content itself — that content is already reviewed and merged as #2828.

To be fair to the other verdicts on this PR: the ratchet, its baseline and the arms are in good shape at every head I have read, and the delta you describe in your own READY is real. This is one rebase, not a disagreement about the tool.

I will withdraw this the moment scripts/gpu-hold stops appearing in compare main...<head> — that is a checkable condition, not a judgement call.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 8f16034 — READY (comment-only change, and the corrected claim is true)

Self-test at this head: 14 cases, 0 failures, and the two edits are docstrings.

I checked the claim you removed rather than accepting it: ctest_skips.py's baseline() really does handle a column-0 licence block —

$ baseline() over a file whose first lines are `# Copyright 2026 x` / `# SPDX-License-Identifier: Apache-2.0`
{'test_kv_zero': 'returns 77: fixture'}

so "ctest_skips.py has the same regex and the same latent defect" was wrong, and removing it is the right call: a note that sends the next reader after a bug that is not there is worse than no note. The /tmp/x.py → "a copy dropped in a scratch directory" edit is the same kind of fix and I have no objection; if anything it reads better, since the file is now safe to copy anywhere.

READY. Nothing further from me at this head — and note that tools/ci/fork_ctest_known_fail.sh (engine#2848) is written to skip while this tool is absent, so #2848 starts doing its job the moment this merges.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 8f16034a: READY — the corrected note is right, and it points at the wrong neighbour: ctest_skips.py does not have that parsing defect, but it does have the other one this PR just fixed.

Two things measured:

The corrected sentence is true. ctest_skips.py's baseline parser strips the line and tests startswith("#") (tools/ci/ctest_skips.py:81-82), so a column-0 licence block is handled. On a file whose first two lines are # Copyright / # SPDX-… plus one real entry, it returns exactly {'some_row': 'returns 77: reason'} — no phantom rows from the header. So removing "has the same regex and the same latent defect" is correct, and a note that sends a reader after a bug that is not there is worse than no note.

But the neighbour has the relocated-copy crash, which is the defect this PR fixed here: copying ctest_skips.py somewhere shallower than three parents and running it dies with

File "/tmp/csk.py", line 46, in <module>
    TOOL_ROOT = pathlib.Path(__file__).resolve().parents[2]
IndexError: 2

— the same parents[2] IndexError _tool_root() removes in ctest_known_fail.py, in the file the old comment accused of a different fault. Worth either a one-line follow-up (lift _tool_root() into both, or a shared helper) or a sentence in the note so the next reader knows which neighbour actually bites. Not a reason to hold this PR: it is a comment, and --self-test still reports 14 cases, 0 failures.

Scope as before: I read the three fixes and measured summary()/failed() against a real-shape log; I have not run a full 383-test log with a live baseline.

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 78b33e9

@bong-water-water-bong
bong-water-water-bong merged commit d110d59 into main Nov 17, 2026
12 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the ctest-known-fail-ratchet branch November 17, 2026 18:05
bong-water-water-bong pushed a commit that referenced this pull request Nov 20, 2026
…e#2902)

A flag nobody sets is the same class of error as a guard nobody runs. gpu-hold's queue messages are the
product -- every lane reads them when a ticket is released unheld, which is why a bundled PR deleting one
was worth catching by hand in #2825 -- so a diff that touches scripts/gpu-hold is checked with
--strict-warnings, and every other diff keeps the default where a deleted debug print is not a loss.
bong-water-water-bong added a commit that referenced this pull request Nov 20, 2026
…2761) (#2902)

* ci: a removed diagnostic is reported, not silently invisible (engine#2761)

guard_loss_check looked for removed *refusals* only: a removal became a candidate when it carried a
refusal keyword AND an `if`/assert. So a deleted `log "::warning::..."` was not a loss, a rewrite or
anything else -- it was not a candidate. Measured on #2825, whose bundled hunk removed gpu-hold's
wait-time re-check (the `if` plus the queue message it guarded): **0 of 3** removed diagnostic lines
were found, and the one line that was found was found as a refusal.

Now a second family: a removed line carrying a diagnostic sink (`::warning::`, `fprintf(stderr`,
`LOG(WARNING`, `warn(`, `warning:`) is a candidate, classified `warning`, and reported as `WARN-LOST`
with the same identifier evidence the refusal path uses.

It does not redden a default run. Most deleted diagnostics are deliberate (debug prints, a message that
moved), and a check that fails those is one lanes learn to skip -- which is how a real loss gets through
later. `--strict-warnings` turns a lost diagnostic into rc 1 for the PR class where the message IS the
product: gpu-hold's queue messages are what every lane reads when a ticket is released unheld.

Measured on the real commit (`64f661908`, the #2825 hunk that was dropped):

  before   1 removed guard-shaped line(s), 0 lost, 1 rewritten
  after    2 removed guard-shaped line(s), 0 lost, 1 rewritten, 0 diagnostic(s) lost, 1 diagnostic(s) rewritten

-- the queue message is visible now, and reads as rewritten (its identifiers are still in the file), so
the verdict on that commit is unchanged at rc 0 in both modes. A line that both refuses and reports is
still a refusal: removing it changes behaviour, not only diagnosability.

Eight arms, including the two that would have caught my first draft: a line with `== nullptr` is a
refusal even when it prints, and a comment about a warning is not a removed warning. Docstring's blind
spots updated: the keywords are heuristics, `tests/` is skipped, and a branch that predates a fix on
main reverts it at merge without any diff here ever containing the line.

Refs #2761.

* ci: the strict-warnings mode is wired where it means something (engine#2902)

A flag nobody sets is the same class of error as a guard nobody runs. gpu-hold's queue messages are the
product -- every lane reads them when a ticket is released unheld, which is why a bundled PR deleting one
was worth catching by hand in #2825 -- so a diff that touches scripts/gpu-hold is checked with
--strict-warnings, and every other diff keeps the default where a deleted debug print is not a loss.

---------

Co-authored-by: bong-water-water-bong <[email protected]>
bong-water-water-bong pushed a commit that referenced this pull request Nov 20, 2026
The rebase onto main left the file without one, and copyright.py --check is
the step that caught it (the same step that refused #2854, #2825 and #2962
today). Added with --fix, which is the tool's own repair path.
bong-water-water-bong added a commit that referenced this pull request Nov 20, 2026
…ne#2478) (#2976)

* diag: the IOMMU DMA lifecycle, with a state-at-fault classifier (engine#2478)

Three readings on this issue were wrong because the instrument could not tell
'absent' from 'not looked at'. This tool makes that distinction structural:

  --lifecycle TRACE   per page: map->unmap->map cycle count, unmapped dwell
                      percentiles, and for each fault the page's STATE at the fault
  --owners IOVA...    reverse-map physical pages (identity IOVA under
                      CONFIG_IOMMU_DEFAULT_DMA_LAZY) to (pid, va, region)

Rules it enforces instead of documenting:

  * no unmap probe on a page => every fault reports state UNKNOWN, never MAPPED.
    Absence of an unmap event is absence of a probe, not presence of a mapping.
  * a fault with a map intervening before it is MAPPED, not 'last unmap 1 s ago'.
    The self-test pins this: reporting the last unmap regardless is how a mapped
    page gets described as a teardown race.
  * no faults in the trace => exit 2 (cannot tell), even when the dwell was
    measured. Partial coverage is not a negative result.
  * --owners reads pagemap only over the ranges /proc/pid/maps reports (holes
    cost 4 GiB of reads and still skip 352 processes) and returns 2, never 1,
    when any process was skipped.

Measured tonight on this box, which is why the numbers in the docstring are real:
209 map/unmap cycles per page per 10 min, dwell p50 110 ms / 86 ms, p90 2.5 s /
1.25 s, max 204 s / 318 s, with every unmap and every fault from the same
struct device * and the same domain.

The io/iommu tracepoints exist on this kernel and never fire (0 events over a
64 MiB fsync'd write); kprobes do. The recipe is in the module docstring.

* diag: carry the owner across a fault, so 'changed hands' is visible (engine#2478)

The two remaining branches of #2478 differ in what the device writes into:
teardown ordering -> a fault and the write goes nowhere; reuse -> the page was
re-mapped to a DIFFERENT process and the controller writes into that process's
buffer, with no fault and no log line.

Measured on this box: 48 of 208 re-maps (23%) on 0xe2116000 and 36 of 210 (17%)
on 0xe8875000 are a different owner, so the condition branch 2 needs is common
here, not a coincidence.

The classifier now prints it:

  FAULT @71181.67: state UNKNOWN (...), next map +72.53s -- CHANGED HANDS V8Worker -> pi

comm-pid is the process that CALLED the map, not necessarily the owner of the
memory, and the docstring says so: the count is evidence that ownership changes,
not proof of whose buffer it becomes.

* diag: the IOMMU DMA lifecycle tool carries its licence header

The rebase onto main left the file without one, and copyright.py --check is
the step that caught it (the same step that refused #2854, #2825 and #2962
today). Added with --fix, which is the tool's own repair path.

---------

Co-authored-by: bong-water-water-bong <[email protected]>
Co-authored-by: pi-release <pi-release@1bit>
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