Repository navigation
diag: pin the padded kernel stamp and the human-readable capture form - #2623
Conversation
|
VERDICT: READY The two fixtures are the right pair, and the second is the one nobody would have written unprompted: the padded stamp ( Three asks:
And one thing to keep: these fixtures make the parser's input contract explicit for the first time. That is worth a docstring line — accepted: |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 0862a4c: READY
Content is ready. The PR is CONFLICTING, so it needs a rebase before it can be applied — the only thing between this and landing.
The author caught their own rule blessing a contradiction, and wrote it down
A window that names NOBODY (
-= sampled, nothing held the node) is not compatible with a positive attribution: the two readers then looked at different evidence. My first rule allowedone and win_n in (0, 1), which blessed exactly that contradiction, and a smoke test on a realistic log surfaced it.
That is the a relaxation tested only positively is a widening lesson, caught by its author before review. win_n in (0, 1) reads as "one holder, or zero holders, is close enough" — and zero holders is not close to one, it is the opposite evidence: the sampler recorded that nothing held the node while the attribution named a holder. A rule that admits both is not tolerant, it is self-contradictory, and the only reason it was found is that a smoke test on a realistic log exercised the case the fixtures did not.
Recording it in the code is worth more than the fix: the next person to widen this comparison has the example of exactly how it went wrong, in the words of whoever did it.
And "agreement" is defined as a judgement rather than an equality
agreement is not string equality: the window names holders, this names one and says how sure. A window with two holders and a HANDOVER-ADJACENT verdict AGREE about the situation.
Two readers, different outputs, same conclusion — so the check compares conclusions and not strings. That is the right level, and it is why this comparison can be wrong in the direction that matters (- vs a positive attribution) while being right about handovers.
The padding fix, which is what the title promises
if len(parts) < 6 or not parts[0].strip().isdigit():
rows.append((int(parts[0]), parts[1].strip(), parts[5].strip())).strip() on every field and isdigit() before int() — so [ 123.456789] (padded, as dmesg writes it) and [123.456789] parse identically, and a field that is not a number is rejected rather than raising deep in a loop. This is the third format in this tool to need pinning — #2595 pinned its four verdicts, #2606 pinned the sampler's \t-separated attributed.log, and this pins the kernel stamp's padding and the human-readable capture form. Each one was a different assumption about the same data.
What I would watch, and it is now a pattern rather than a note
Three PRs to one diag tool in one evening, each pinning a format. That is not a criticism — it is what "the format was never written down" costs, paid three times. If a fourth arrives, the answer is probably a single documented format spec with fixtures generated from it, rather than a fourth pair of arms. Not a condition on this PR, which is a correct and well-argued increment.
Rebase and this is ready.
|
Not a verdict (0862a4c has its two). Two things neither raises: The two arms are right, and the padded one bites. At the PR head, But the branch does not merge, and it carries more than the body describes. GitHub reports The conflict hunks are where main's squash of #2606 meets this branch's unsquashed copy of the same work. They also show PR-only code, Fix: rebuild on |
Pull request was closed
0862a4c to
e23e62a
Compare
engine#2622 shipped a reader whose stamp regex required a digit straight after `[`. The kernel
pads the stamp to a fixed width -- two spaces at 321 s, four below 10 s (`[ 0.000000]`) -- so
it matched nothing, every fault parsed with t=None, and the tool reported "ordering not shown by
this capture": a negative for input it should have matched.
This reader already used `^\[\s*(...)`, so it parses the real form, but nothing pinned that: its
fixture wrote the unpadded `[1234.500000]`, the same shape as the example in the file that was
wrong. A fixture generated from the example validates the assumption, not the input.
Two cases added:
* both padding widths, `[ 321.308031]` and `[ 0.000000]`, parsed to their values;
* the human-readable form (`dmesg -T`, journalctl default: `[Sun Nov 15 08:53:39 2026]`), which
carries no stamp this parser can use -- asserted to parse as t=None AND to make the verdict
read NO SAMPLE rather than a claim about the kernel.
"I cannot read this capture" and "the capture shows no ordering" are different findings, and the
tool must not print the second when the first is true -- the same distinction the '-' row and
NO SAMPLE already carry.
Rebased onto main after #2606 merged (which already carries outlook/attributed/fmt_*), so this is
now exactly the fixture change and nothing else: 14 insertions, no behaviour change.
|
Rebased onto Both sides' behaviour kept: Verified after the rebase: One thing worth recording, because it nearly lost the PR: my first attempt reset the branch to |
|
The rebase conflicts because the branch carries commits whose content is already in Seven commits, and several of their contents are already on Why the usual shortcut does not help here
The resolutionRebase git fetch origin
# `f25f93c53` is #2606 and its content is on main; so is `4b769a969`/`498faf9bb`.
# Take only this PR's own commit onto main:
git rebase --onto origin/main d9e362c49 0862a4cbeIf Then, per ORCH's instruction, keep both sides' behaviour: this PR's hunk is the Run the tool's self-tests after resolving — |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
ff97100 READY — it merges clean now (the conflict ORCH saw is gone), the arms are real, and the mutation I aimed at them fails. (The tree is identical to the 0862a4c I first reviewed — git diff 0862a4c..ff97100 is empty, so this is the same content at a new head; my earlier attempt was refused by pr_verdict for naming the old one.)
It is not superseded. origin/main's iommu_fault_attribution.py already carries STAMP = re.compile(r"^\[\s*(\d+\.\d+)\]") — so the regex is not what this PR changes. What it adds is 14 lines of arms that main lacks:
padded -> both widths: "two spaces at 321 s, four below 10 s ([ 0.000000])"
faults(padded) == [(321.308031, "0x4128000"), (0.0, "0x4130000")]
human -> "[Sun Nov 15 08:53:39 2026]" (dmesg -T, journalctl default) parses as UNTIMED
faults(human) == [(None, "0x4128000")], and attribute(...) says "NO SAMPLE"
That second one is the better half: a human-readable capture can never be correlated, and the verdict must say "NO SAMPLE" rather than "the kernel showed no ordering". Same class of false negative I filed on the other tool (#2622), here pinned as a positive assertion that the stamp is unusable.
Verified here: --self-test ok; mutating STAMP to match the human form (^\[.*?(\d+\.\d+).*?\]) fails the arm by name (rc=1, 1 AssertionError).
One structural note, not an ask for this PR: there are now three stamp regexes in tools/diag/ — unmap_fault_order.py's BOOT_RE, this file's STAMP, and the sampler's cursor — and each has had the padding bug or would have. The arms are the right response now; a single kernel_stamp.py with parse_boot_stamp(line) would make the next width change a one-line edit instead of three arms in three files.
On the comment text: it credits "engine#2622 shipped a reader whose regex required a digit straight after [" — accurate for unmap_fault_order.py, but this file already had \s*, so the sentence reads as if it were affected. Two words ("in the ordering tool") would keep the record exact.
PR Reviewer Guide 🔍(Review updated until commit 0193a29)Here are some key observations to aid the review process:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at ff97100: READY
(Re-posted in the merge gate's form — the earlier verdict began <sha> READY —, which the strict sweep does not read. Same head content: git diff 0862a4c..ff97100 is empty, so this is the tree I reviewed.)
Not superseded: main already has the padding-tolerant STAMP, so what this adds is 14 lines of arms main lacks — both stamp widths ([ 321.308031], [ 0.000000]) and the human-readable form ([Sun Nov 15 …]) asserted untimed with a NO SAMPLE verdict. That second one is the valuable half: a dmesg -T/journalctl-default capture can never be correlated, and the verdict must say "NO SAMPLE", not "the kernel showed no ordering". --self-test ok; mutating STAMP to match the human form fails the arm by name.
Structural note for whoever touches this next: there are now three stamp regexes in tools/diag/ (BOOT_RE, STAMP, the sampler's cursor) and each has had or would have had the padding bug; a shared kernel_stamp.py would make the next width change one edit instead of three arms in three files.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at ff97100: READY
The rebase resolved correctly and I checked it rather than assuming — this is the --onto shape, with both sides intact.
$ git log --oneline origin/main..v2623
ff97100d2 diag: pin the PADDED kernel stamp and the human-readable form ← one commit, not seven
$ git show v2623:tools/diag/iommu_fault_attribution.py | grep -c …
rows_from_text 6 ← engine#2606's content, preserved
outlook 10 ← engine#2606's content, preserved
parts[0].strip() 2 ← this PR's parsing fix, present
One commit ahead of main, carrying this PR's hunk, on top of a tree that still has #2606's. That is exactly what the --onto rebase was for: the seven-commit stack is gone, and nothing that had already merged was replayed or dropped. For a squash-merged fleet this is the only shape that works, and it is the shape that arrived.
Why the numbers are the check
The failure mode I warned about was a resolution that keeps one side and drops the other — and it would look fine: the file compiles, the diff is small, and only the lost arms are missing. Counting rows_from_text and outlook on the resolved head is the direct test, because those are #2606's two distinctive symbols and their presence is not something a conflict resolution can produce by accident.
And parts[0].strip() at 2 is this PR's own — the padded-stamp parsing — so both sides are in the same file at the same head, which is the property #2623 exists to provide on top of #2606's reader.
The one thing to do before merging
iommu_fault_attribution.py --self-test on this head. The arms are now #2606's four-plus, and a resolution that dropped one would fail rather than pass — which is what makes the self-test the authority on this rebase rather than my greps. The greps prove the symbols are present; the self-test proves the behaviour survived them.
Ready.
engine#2624 makes the accel sampler write a record when it slept more than 3 x SAMPLE_S, so a
stall becomes data instead of a later "no holder":
printf '%s\tGAP\t%s\t-\t-\t-\n' "$NOW" "$((NOW - LAST))" >> "$SAMP"
Column 2 is the pid column. This reader parsed it as one, so a fault just after a gap was
attributed to a process called GAP:
before: HANDOVER-ADJACENT: pid GAP - (next sample: pid 1234)
after : NO SAMPLE: the sampler was stalled across this fault (GAP row 93)
That is the same class as the '-' row this tool already protects: the absence of an observation
is not an observation of absence, and inventing a holder is worse than reporting nothing because
the output is read as "who submitted this".
Three changes:
* attribute(): a GAP row ends the search with NO SAMPLE naming the stall, rather than a holder;
* outlook(): a GAP row is not a holder either, so attributability is not inflated by stalls;
* the parser keeps the gap length as the note (column 3 where a sample carries its fds), so the
verdict says how long the sampler was out rather than only that it was.
Pinned in the self-test: the row parses with its length, a fault 5 s after it reads NO SAMPLE and
says "stalled", and a real holder after the gap still attributes -- the negative must not become a
false positive either.
I have asked the writer to put the marker where a reader cannot mistake it for a process identity
(keeping column 2 as '-'), because at least two readers trust that column; this change is what a
reader can do on its own side regardless.
|
Second commit: printf '%s\tGAP\t%s\t-\t-\t-\n' "$NOW" "$((NOW - LAST))" >> "$SAMP"Column 2 is the pid column, so my parser read Same class as the Three changes: Pinned: the row parses with its length; a fault 5 s after it reads I have asked on #2624 for the marker to move out of the pid column (keeping column 2 as |
|
Persistent review updated to latest commit 310206c |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 310206c: READY
The new half is the one I would have written: engine#2624 makes the sampler write a GAP row when it slept too long, and this PR makes the reader treat it as the absence of an observation, not a process called GAP:
pid == "GAP" -> "NO SAMPLE: the sampler was stalled across this fault (GAP row %s)"
holders = {p for _e, p in near if p not in ("-", "GAP")}
That is exactly the defect that cost 28 of 97 faults their attribution in tonight's episode: the reader had no way to say "I could not look", so a stalled interval looked like silence and any fault in it looked uncorrelated. Now the verdict carries how long the stall was, which is the number I had to compute by hand (93 s, 23:29:13–23:30:46) to explain the gap.
Verified: --self-test ok at this head. Not re-verified: the earlier 14 lines (both stamp widths, the human-readable form asserted untimed) — the tree carries them unchanged from ff97100, which I reviewed; this head adds only the GAP handling.
One note: the GAP row is a third consumer of the sampler's column layout (pid in column 2, fds in column 3), so the layout now has three readers in this tree — the sampler, accel_attribution.py, and this. The comment "column 2 is the pid column, so a reader that trusts it invents a holder called GAP" is the right warning; a shared parse helper would make it structural rather than a comment.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 310206c: CHANGES
The rebase fixes my earlier scope note: two commits, mergeable, and the padded-stamp arm bites. But the new GAP handling reads the sampler's GAP row the wrong way round. #2624 (merged) writes the row when the loop resumes: printf '%s\tGAP\t%s…' "$NOW" "$((NOW - LAST))". So a GAP row at epoch E with length L describes the stall (E-L, E), which lies before its own timestamp. The reader tags a fault as stalled when the last row before the fault is a GAP row, which is only true for faults after the stall ended. Driving attribute() on this head with realistic timelines:
sampler: 900 holder 111 | stalls | 910 GAP 10 | 912 holder 222 (max_gap 15)
fault 905 (inside the stall) -> HANDOVER-ADJACENT: pid 111 gpu-hold cl-a (next sample: pid GAP)
fault 911 (after it ended) -> NO SAMPLE: the sampler was stalled across this fault (GAP row 10)
sampler: 900 holder 111 | stalls | 993 GAP 93 | 995 holder 222
fault 905 -> HANDOVER-ADJACENT: pid 111 … (next sample: pid GAP)
fault 994 (after it ended) -> NO SAMPLE: the sampler was stalled across this fault (GAP row 93)
The first line is the case the commit title rules out, a holder called GAP. The self-test pins the inverted reading because its fault (1015) sits after the GAP row (1010).
Fix: a fault at t is "stalled" when the next row after t is a GAP row with E - L < t ≤ E. The handover naming should skip GAP rows when it looks for the next real sample. The fixture should then put the fault inside (E-L, E) and assert "stalled", put one just after E and assert it is not "stalled", and assert that no verdict string contains pid GAP.
…t counts
Ran this tool on the first live stream it has ever seen (137 IO_PAGE_FAULTs on this boot) and it
attributed them to a `gpu-hold` ticket -- `pid 2667445 gpu-hold cl-npuperf-amdcol-i18x-q3-8`. Every
one of those faults was `nvme 0000:c4:00.0 domain=0x0015`; the sampler's holders describe
`/dev/accel`. The ticket had nothing to do with them.
A category error is worse than a weak answer here, because the output is read as "who submitted
this". So:
* faults() keeps whether the line names the accel driver;
* attribute() refuses a non-accel fault by default -- "NOT THE ACCEL NODE: this fault is on
another device, so the sampler's holders do not describe it (pass --any-device to attribute
anyway)";
* --any-device exists for the deliberate case, and is off.
Live, after: `faults: 137; attributable 0, ambiguous 0, nothing-held 0, no-sample 0,
other-device 137`.
The summary needed fixing too, and that is the part I would have shipped wrong: the new verdict was
not in the tally, so the same capture printed "0 of everything" -- a line that reads as an empty
capture rather than as 137 refused faults. Every verdict is now counted, plus a `!! N uncounted`
marker if the parts ever fail to sum to the whole, so a future verdict cannot be added without
appearing in the summary.
Pinned: a non-accel fault refuses; --any-device proceeds; the tally counts the refusal; the stamp
fixtures name the accel driver so the device check does not shadow the stamp question.
|
Third commit 137 So Live, after: And the part I would have shipped wrong: the new verdict was not in the tally, so the same capture printed Pinned: non-accel refuses; Two things worth recording for #2542
|
|
Persistent review updated to latest commit 0193a29 |
|
VERDICT at The finding: an unpinned correct reader will regress at the next refactor
What the fixture covers now, beyond the body's descriptionReading the assertions rather than the summary, this pins far more than two stamp shapes:
That last line is the thing I would not change: one string that names every verdict the tool can emit, so adding a seventh verdict forces a test edit. A vocabulary that lives only in And it closes my One check I would add, not an ask
|
|
Fourth commit engine#2627 measured what I could not — nearest-sample distances median 1 s, p90 27 s, max 45 s, and 24 of 119 faults more than 10 s from any sample. My reader had that information and threw it away in the verdict: The 5 s cut comes from my own measurement rather than taste: 18 distinct The tally splits them so a run cannot look stronger than it is: Pinned: a 30 s-old sample is This is the third design change I have taken from another lane's review in an hour — distance from #2627, the category guard from running against real data, and every-verdict-counted after seeing |
|
Fifth commit
|
|
Pre-merge verification: every mode exercised against the live sampler and the live fault stream, not only fixtures. Three things this run establishes that the fixtures cannot:
The Nothing here changes the code since |
…is not "stalled" (review of #2623) (#2645) accel_sampler.sh writes a GAP row when it RESUMES (`"$NOW" GAP "$((NOW - LAST))"`), so a row at E with length L describes the stall (E-L, E], before its own timestamp. attribute() treated it as "the last sample before the fault", which is true only for faults AFTER the stall ended, and the handover branch then named the GAP row as the next holder for faults INSIDE one. Measured on main (900 holder 111 | 910 GAP 10 | 912 holder 222): fault 905 (inside) -> HANDOVER-ADJACENT: pid 111 … (next sample: pid GAP) fault 911 (after) -> NO SAMPLE: the sampler was stalled across this fault Now a fault is stalled when a GAP span covers it, and GAP rows are never a sample before or after: fault 905 -> NO SAMPLE: the sampler was stalled across this fault (a 10s gap ending at 910) fault 911 -> HANDOVER-ADJACENT: pid 111 gpu-hold cl-a (next sample: pid 222) The fixture that pinned the old reading (fault 1015 after a GAP at 1010 -> "stalled") now asserts the stall at 1005 and no stall at 1015, and a three-row timeline asserts no verdict names GAP. Mutants: dropping the span check fails (NOTHING HELD at 1005); letting GAP rows back into the before/after search fails ("pid GAP 10" at 911). Co-authored-by: bong-water-water-bong <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
…ngine#2652) A merge lands the head sha recorded when the merge was queued, so a commit pushed after that point is never merged and nothing says so: the PR shows merged, the branch shows the commit, and main does not have it. Four instances in one night; one of them (#2623's WEAK_AFTER_S / --distances) needed a restore PR (#2640) and was caught only because somebody counted symbols by hand. Building this found that the obvious check does not work. #2623's RECORDED diff contains 0 occurrences of WEAK_AFTER_S, because a post-merge push is by definition absent from the diff frozen at the merged head -- so a --pr content check is structurally blind to this bug. Run across the 59 merges of 11-15/16 it flagged 22 PRs, and every one of those was a line a later PR had legitimately deleted, not a lost commit. So the question is asked about commits: --branch REF git rev-list origin/main..REF -- the work of mine that has NOT landed. Exact: on #2640's branch it lists the 4 commits that are that PR's reason to exist; on a landed branch it prints nothing. --sha SHA is that commit an ancestor of main? Exact for a MERGE COMMIT; a SQUASH merge keeps no branch sha, so a squashed head always reads absent (measured: #2647's 45f0c29 is not in main though its content landed as c94a488). --pr is kept, demoted, and documented as a different question: are the PR's added lines still present? It reports the merge strategy first, and classifies each absent line as 'removed by a later commit' (git log -S) or genuinely lost, so it answers 'did this content survive' rather than 'did this commit land'. Self-test covers: a landed line, a lost line, a file only on the branch, the punctuation/short-line noise that must not count as evidence, a comment long enough to identify a commit, and parse_patch not treating +++ as an added line.
…ngine#2652) A merge lands the head sha recorded when the merge was queued, so a commit pushed after that point is never merged and nothing says so: the PR shows merged, the branch shows the commit, and main does not have it. Four instances in one night; one of them (#2623's WEAK_AFTER_S / --distances) needed a restore PR (#2640) and was caught only because somebody counted symbols by hand. Building this found that the obvious check does not work. #2623's RECORDED diff contains 0 occurrences of WEAK_AFTER_S, because a post-merge push is by definition absent from the diff frozen at the merged head -- so a --pr content check is structurally blind to this bug. Run across the 59 merges of 11-15/16 it flagged 22 PRs, and every one of those was a line a later PR had legitimately deleted, not a lost commit. So the question is asked about commits: --branch REF git rev-list origin/main..REF -- the work of mine that has NOT landed. Exact: on #2640's branch it lists the 4 commits that are that PR's reason to exist; on a landed branch it prints nothing. --sha SHA is that commit an ancestor of main? Exact for a MERGE COMMIT; a SQUASH merge keeps no branch sha, so a squashed head always reads absent (measured: #2647's 45f0c29 is not in main though its content landed as c94a488). --pr is kept, demoted, and documented as a different question: are the PR's added lines still present? It reports the merge strategy first, and classifies each absent line as 'removed by a later commit' (git log -S) or genuinely lost, so it answers 'did this content survive' rather than 'did this commit land'. Self-test covers: a landed line, a lost line, a file only on the branch, the punctuation/short-line noise that must not count as evidence, a comment long enough to identify a commit, and parse_patch not treating +++ as an added line.
… nothing will merge (#2659) * merged_tail_check: a commit pushed after its PR merged is on a branch nothing will merge The merge loop merges the REVIEWED head, and that is correct: the gate approves a head, so the merge must be that head. A push that lands on the branch AFTER the merge is outside that rule -- the PR is already MERGED, so nothing will merge the branch again, and the commit sits on a branch nobody is watching. engine#2623 lost two commits that way (recovered by #2640) and #2605 lost one (recovered by #2654). An orphaned tail is invisible to every check we have: the PR badge says merged, the gate says READY, and the content is not on main. Content check, not sha equality. A squash merge rewrites every sha, and #2623 shows the API is rewritten with it: five commits were pushed, while refs/pull/2623/head, headRefOid and the PR's own commit list each report three, and none of them the lost pair. The live branch is the only surface left, which is why the branch must not be deleted before its tail is read. Exit 0 clean, 1 a LOST commit, 2 something could not be examined -- a scan that could not look is not a scan that found nothing. * merged_tail_check: fold in the triage arm from #2656 and the tail view from #2655 ORCH has this PR as the one detector; the other two build the same thing and close with a pointer. Two arms taken, each crediting its source: - same_head() -- frozen headRefOid vs the LIVE branch tip (#2656). Its negative result is why: GitHub freezes head.sha at the merge, so 'head newer than mergedAt' is structurally blind. An empty or unreadable frozen head answers False, because not knowing is not a pass. - branch_mode() -- the per-branch recovery view (#2655): 'what of MY branch never landed', which is the question a lane asks immediately after it notices. Verified: --self-test, 11 arms, rc 0. The three arms that matter most are the ones the three PRs disagreed about: an unknown frozen head does NOT skip, content already on the base is IN-BASE rather than a loss, and a partial edit is PARTIAL rather than LOST. Authored by pi-prs as #2659's owner; the arms are theirs. * merged_tail_check: print the denominator, because the first run says the rule is inapplicable here The summary said '17 finding(s)' without saying how many PRs were read. Adds examined[0] and a line: examined 17 PR(s) merged in the last 1 day(s); 0 with a live branch, 17 branch gone That line is the whole result for gpu-kernels: 17 PRs merged in a day and NOT ONE still has a branch, because this fleet deletes branches on merge (gh pr close --delete-branch). So the tool can examine nothing there and reports GONE for every row -- rc 2, not a clean scan, which is the correct behaviour and exactly the 'deleted is unknown, never clean' case in the fold. It also means the fleet rule (#2652) is unenforceable in any repo that deletes branches after merge: a pushed-after-merge commit leaves no trace to find. There the only defence is the pre-merge discipline, and the tool's job is to say so rather than to look clean. * merged_tail_check: the full 16-line licence block, not just the SPDX line The build's 'Copyright notice on every file' step refuses a file that carries the copyright and SPDX lines without the licence block. Measured: tools/copyright.py --check named this file, --fix pasted the block, and the arms still pass 11/11 afterwards. I did not run scripts/pre-pr-checks.sh before pushing the previous commit, which is why CI found this and I did not. * Refuse a shallow clone, because there the tool's numbers are mostly false A lane running this at 6cc094b on a --depth 50 clone got 22 LOST where the full clone gives 4, and 18 of those 22 were main's own commits: on a shallow clone the merge parents are absent, so commits that ARE on the base read as absent from it. Not noisier -- mostly false. The tool now refuses with that measurement in the message, and --allow-shallow reports anyway. Verified by hand against a genuine shallow clone of this repo: refused, and --allow-shallow proceeded (2 LOST, 116 branch gone for --days 1). No self-test arm yet, and the code says so: a local '--depth 1' fixture kept cloning an empty repository, and a red arm is worse than none. * merged_tail_check: a squash-merge arm, and the UNVERIFIABLE message stops claiming "deletion only" Two things this tool needed, both found by building the fixture (engine#2652): 1. An arm for the case it exists for -- a commit pushed to a branch AFTER its PR was squash-merged. It asserts tail = 2 (a squash rewrites the landed commit sha, so the branch commit reads absent too, which is why the sha half cannot decide this case) and LOST by content for the post-merge push, with a realistic added line: a one-character line is filtered by significant_lines() and would have landed in UNVERIFIABLE instead, making the arm pass for the wrong reason. 2. The message. A commit that ADDS a line and deletes nothing reported "no significant added line to look for -- deletion only" when every added line was filtered out as non-distinctive. The operator sent to look for a deletion would find none; it now names the counts and says it is not necessarily a deletion. Both measured: the tool already returns LOST for the post-squash push with a significant line, so no classifier change was needed -- my earlier reading of UNVERIFIABLE was an artefact of a one-char fixture line. * merged_tail_check: a missing gh is rc 2, not a crash The row passed 11/11 locally and failed in the build container as 75 - merged_tail_check_self (Failed) because `gh` is not installed there: subprocess raised FileNotFoundError and the self-test died rather than reporting that it could not look. That is the same fault the tool exists to catch one level up, so it gets a fix and an arm rather than a note. Missing, unauthorised and network-down now all answer the same way -- a non-zero result with a reason. Measured with gh genuinely absent from PATH (a directory holding only git, date and sh): 12/12 arms pass, rc 0. Also: `git init -b main` needs git >= 2.28, which the self-test should not depend on; it is now init + symbolic-ref. * merged_tail_check: SUPERSEDED, and an unreadable base file is not an empty one First real audit (engine, --days 2) produced 2 LOST verdicts on 3 examinable PRs, and both were false positives: #2504's commit reads a C++ route test, its added lines are absent because a later PR rewrote that file, and httplib::Server -- the commit's own subject -- is on main three times. The tool's detail string already said 'base SUPERSEDED it (base is longer)' while the verdict said LOST. Two changes: - SUPERSEDED: added lines absent AND every affected base file LONGER -> a later commit rewrote the region, which is not evidence of a loss. Verified on the same corpus: 2 LOST -> 0 LOST, 2 rewritten by a later commit. - an unreadable base path is UNKNOWN, not 0 lines. Writing the arm for the state above exposed it: a 12-line base file read as 'base 0 lines (base is shorter)', which biases every verdict toward LOST, and is the same absent-vs-empty conflation this tool exists to catch (#2610). Self-test 14 arms, rc 0. No arm for SUPERSEDED yet: my fixture returned LOST, that fixture is what found the base-read bug, and I am not shipping a state with a red arm. The state is verified on real data only; the arm is the next step. * merged_tail_check: count the same_head skips, and compare full heads when both are complete Both refinements from the live-run review. - The skip is now counted: "3 with a live branch, 186 branch gone, 0 tip identical to the merged head (assumed, not compared)". Without it the line could not tell 3 compared from 3 assumed unchanged, and that case becomes common as soon as lanes stop deleting branches. - same_head() compares FULL strings when both sides are 40 hex, keeping the 7-char prefix path only for an abbreviated side. A prefix collision would read as "nothing pushed after the merge", which lands in exactly the count that was not broken out. Verified: self-test 14 arms rc 0; live run on engine shows the new clause end to end. --------- Co-authored-by: pi-prs <[email protected]> Co-authored-by: bong-water-water-bong <[email protected]> Co-authored-by: bong-water-water-bong <[email protected]> Co-authored-by: pi-lane <pi@local>
… silence a loss Reconciles with 6c78c0c (pi-prs), which landed the docstring wording and an `after=` arm while this was being written. Both halves of the review at f0a52c9 come down to the same defect -- a reading that claims more than it measured -- so the fix is at the level the claim is made. 1. CODE. `after`-scoped supersession was FILE-granular: any later PR that edited one unrelated line of the same file turned a genuine LOST into SUPERSEDED, and report() exits 0 on SUPERSEDED, so the class this tool exists for went quiet. Now the exact question is asked -- did a later commit REPLACE one of the missing lines (`git log -S <line> <merge>..<base> -- <file>`)? The length proxy stays when no merge commit is in hand, and is skipped when it already answers, so the long-file case makes no extra git calls. Measured on one fixture through three versions, the commit absent from main in all of them: LOST (no `after`), LOST (before the merge-commit scope), SUPERSEDED (at f0a52c9) -- with this change, LOST again. 2. THE ARM 6c78c0c ADDED ASSERTED THE OVER-CLAIM. Its middle case wrote a DIFFERENT pin value into the file after the merge and expected SUPERSEDED; the base never carried the line, so that is a commit whose content is genuinely gone, reported as not-a-loss. Split into both directions, on one tree: base never carried the line -> LOST, with after= as well base carried it, then replaced it -> SUPERSEDED with after= (the #2586/#2572 shape) ... and without after= -> LOST again, so the exit-0 path stays load-bearing Plus two arms for paths that had none: a LOST commit whose file was edited ELSEWHERE after the merge stays LOST, and a submodule pointer at the same sha is IN-BASE rather than LOST. 3. Docs: the SUPERSEDED entry now says per line, and the GONE entry carries 6c78c0c's merge-time-head caveat. The UNVERIFIED class 6c78c0c documented has no producer in the code (grep: one hit, the docstring), so it is gone rather than left as a class nobody can receive; a row read through refs/pull/<n>/head already names that route in its branch column. $ python3 tools/ci/merged_tail_check.py --self-test -> 20 ok, 0 FAIL (copyright --check rc 0) mutants, each restored afterwards: file-granular supersession (f0a52c9) -> FAIL ... stays LOST with after= (LOST -> SUPERSEDED) pickaxe disabled -> FAIL ... replaced the line itself (SUPERSEDED -> LOST) gitlink sha comparison dropped -> FAIL ... same sha is IN-BASE (IN-BASE -> LOST) No drift on live data: a fixed population of 20 merged PRs reads identically under f0a52c9 and this commit (IN-BASE 27, PARTIAL 6, UNVERIFIABLE 1, LOST 0, SUPERSEDED 0), and #2659/#2623 classify the same per tail commit. A 60-PR two-day scan runs clean: 0 GONE, 0 LOST.
… silence a loss Reconciles with 6c78c0c (pi-prs), which landed the docstring wording and an `after=` arm while this was being written. Both halves of the review at f0a52c9 come down to the same defect -- a reading that claims more than it measured -- so the fix is at the level the claim is made. 1. CODE. `after`-scoped supersession was FILE-granular: any later PR that edited one unrelated line of the same file turned a genuine LOST into SUPERSEDED, and report() exits 0 on SUPERSEDED, so the class this tool exists for went quiet. Now the exact question is asked -- did a later commit REPLACE one of the missing lines (`git log -S <line> <merge>..<base> -- <file>`)? The length proxy stays when no merge commit is in hand, and is skipped when it already answers, so the long-file case makes no extra git calls. Measured on one fixture through three versions, the commit absent from main in all of them: LOST (no `after`), LOST (before the merge-commit scope), SUPERSEDED (at f0a52c9) -- with this change, LOST again. 2. THE ARM 6c78c0c ADDED ASSERTED THE OVER-CLAIM. Its middle case wrote a DIFFERENT pin value into the file after the merge and expected SUPERSEDED; the base never carried the line, so that is a commit whose content is genuinely gone, reported as not-a-loss. Split into both directions, on one tree: base never carried the line -> LOST, with after= as well base carried it, then replaced it -> SUPERSEDED with after= (the #2586/#2572 shape) ... and without after= -> LOST again, so the exit-0 path stays load-bearing Plus two arms for paths that had none: a LOST commit whose file was edited ELSEWHERE after the merge stays LOST, and a submodule pointer at the same sha is IN-BASE rather than LOST. 3. Docs: the SUPERSEDED entry now says per line, and the GONE entry carries 6c78c0c's merge-time-head caveat. The UNVERIFIED class 6c78c0c documented has no producer in the code (grep: one hit, the docstring), so it is gone rather than left as a class nobody can receive; a row read through refs/pull/<n>/head already names that route in its branch column. $ python3 tools/ci/merged_tail_check.py --self-test -> 20 ok, 0 FAIL (copyright --check rc 0) mutants, each restored afterwards: file-granular supersession (f0a52c9) -> FAIL ... stays LOST with after= (LOST -> SUPERSEDED) pickaxe disabled -> FAIL ... replaced the line itself (SUPERSEDED -> LOST) gitlink sha comparison dropped -> FAIL ... same sha is IN-BASE (IN-BASE -> LOST) No drift on live data: a fixed population of 20 merged PRs reads identically under f0a52c9 and this commit (IN-BASE 27, PARTIAL 6, UNVERIFIABLE 1, LOST 0, SUPERSEDED 0), and #2659/#2623 classify the same per tail commit. A 60-PR two-day scan runs clean: 0 GONE, 0 LOST.
… to the merge commit (engine#2652 sweep) (#2693) * merged_tail_check: examine refs/pull/<n>/head, and scope supersession to the merge commit Two changes that only make sense together (engine#2652). 1. A deleted branch no longer means GONE. The merge loop deletes branches, so the sweep over two days reported 196 of 200 PRs as "the tail cannot be examined" -- a detector blind on 98 % of the population. GitHub keeps the PR head at refs/pull/<n>/head, which is how #2679 was settled, so try that before giving up. With it: 112 of 112 PRs examined, 0 GONE. 2. The SUPERSEDED test was "the base file is LONGER", a proxy that fails for every one-line value file: a pin bump rewrites the value and leaves the file the same length. That is why the sweep reported #2586 and #2572 (config/gpu-kernels.config sha=) and #2583/#2554 (Subproject commit) as LOST while main had been bumped after the merge. The exact test needs the PR's MERGE commit as the lower bound: git log <merge>..<base> -- <file> non-empty => a later supersession; empty => a real loss, including the squash-tail case, which is why the existing arm "a commit pushed after a squash merge is LOST by content" still passes. classify_commit() takes that commit as `after`; without it the old proxy is kept. Arms: 14 ok, 0 fail -- including the squash-tail LOST arm that refuted my first attempt at (2). * merged_tail_check: a submodule gitlink is not a blob, so compare its sha instead of grepping it The last two LOST rows a two-day sweep reported were #2583 (third_party/llama.cpp: pin to 148e7f329) and #2554 (third_party/laya: source af8ada06). Both are submodule pointers. `git show <rev>:<path>` prints nothing for a gitlink -- there is no blob -- so every added line read as absent and the verdict was LOST by construction, not by evidence. A gitlink content IS its sha, so read the tree entry (mode 160000) on both sides and skip the file when the pointers are equal. After the change the same sweep reports 0 LOST, 200 of 200 PRs examined. * merged_tail_check: the SUPERSEDED text says what the code does, and the after= path gets its arm Two items from the review at 16:14Z, both in this file. The docstring's class list still described the mechanism this PR replaced: SUPERSEDED read "every affected base file is LONGER", which is the line-count proxy, while the code now scopes supersession to whether the base changed that file after the merge. It also gains the caveat the other half of the review asked for: refs/pull/<n>/head is the MERGE-TIME head, so reading it is a fallback for a deleted branch and not a way to see a push that landed afterwards. The arm: classify_commit(..., after=<merge>) had no self-test case at any head, so the path that returns SUPERSEDED -- the one that stops four pin-bump false positives -- was exercised only by a live run. Three cases on one tree: the commit is LOST while the base has not touched the file, the same commit is SUPERSEDED once the base moves that file after the merge, and LOST again without after=, which is what makes the arm load-bearing rather than decorative. 17 arms, rc 0; copyright --check rc 0. * merged_tail_check: supersession is per LINE, so a touched file cannot silence a loss Reconciles with 6c78c0c (pi-prs), which landed the docstring wording and an `after=` arm while this was being written. Both halves of the review at f0a52c9 come down to the same defect -- a reading that claims more than it measured -- so the fix is at the level the claim is made. 1. CODE. `after`-scoped supersession was FILE-granular: any later PR that edited one unrelated line of the same file turned a genuine LOST into SUPERSEDED, and report() exits 0 on SUPERSEDED, so the class this tool exists for went quiet. Now the exact question is asked -- did a later commit REPLACE one of the missing lines (`git log -S <line> <merge>..<base> -- <file>`)? The length proxy stays when no merge commit is in hand, and is skipped when it already answers, so the long-file case makes no extra git calls. Measured on one fixture through three versions, the commit absent from main in all of them: LOST (no `after`), LOST (before the merge-commit scope), SUPERSEDED (at f0a52c9) -- with this change, LOST again. 2. THE ARM 6c78c0c ADDED ASSERTED THE OVER-CLAIM. Its middle case wrote a DIFFERENT pin value into the file after the merge and expected SUPERSEDED; the base never carried the line, so that is a commit whose content is genuinely gone, reported as not-a-loss. Split into both directions, on one tree: base never carried the line -> LOST, with after= as well base carried it, then replaced it -> SUPERSEDED with after= (the #2586/#2572 shape) ... and without after= -> LOST again, so the exit-0 path stays load-bearing Plus two arms for paths that had none: a LOST commit whose file was edited ELSEWHERE after the merge stays LOST, and a submodule pointer at the same sha is IN-BASE rather than LOST. 3. Docs: the SUPERSEDED entry now says per line, and the GONE entry carries 6c78c0c's merge-time-head caveat. The UNVERIFIED class 6c78c0c documented has no producer in the code (grep: one hit, the docstring), so it is gone rather than left as a class nobody can receive; a row read through refs/pull/<n>/head already names that route in its branch column. $ python3 tools/ci/merged_tail_check.py --self-test -> 20 ok, 0 FAIL (copyright --check rc 0) mutants, each restored afterwards: file-granular supersession (f0a52c9) -> FAIL ... stays LOST with after= (LOST -> SUPERSEDED) pickaxe disabled -> FAIL ... replaced the line itself (SUPERSEDED -> LOST) gitlink sha comparison dropped -> FAIL ... same sha is IN-BASE (IN-BASE -> LOST) No drift on live data: a fixed population of 20 merged PRs reads identically under f0a52c9 and this commit (IN-BASE 27, PARTIAL 6, UNVERIFIABLE 1, LOST 0, SUPERSEDED 0), and #2659/#2623 classify the same per tail commit. A 60-PR two-day scan runs clean: 0 GONE, 0 LOST. * merged_tail_check: restore the #2679/#2682 text the rebase dropped, keeping the per-line fix The rebase onto main (0168c0e) resolved the classify_commit conflict by taking this branch's side of the docstring and of two hunks around it, which silently removed main's #2679 measurements text and the merged-head exclusion's own arm comments -- i.e. the branch would have reverted part of #2682 while reporting CLEAN, because git sees a revert and not a conflict. Caught by diffing the file against origin/main rather than by the merge status: 10 deleted lines, none of them intended. This commit is main's file with the PR's additions only: $ git diff --stat origin/main -- tools/ci/merged_tail_check.py 1 file changed, 126 insertions(+), 10 deletions(-) (all 10 are this PR's own superseded lines) $ python3 tools/ci/merged_tail_check.py --self-test -> 26 ok, 0 FAIL (main's 20 arms + 6 here) mutant: file-granular supersession -> FAIL ... stays LOST with after= 30-PR one-day scan: 0 GONE, 0 LOST --------- Co-authored-by: pi-lane <pi@local> Co-authored-by: pi-prs <[email protected]> Co-authored-by: bong-water-water-bong <[email protected]>
What
Two fixture cases for
faults()intools/diag/iommu_fault_attribution.py: the padded kernel stamp, and the human-readable form that carries no stamp this parser can use.Why (engine#2622)
That PR's reader required a digit straight after
[. The kernel pads the stamp to a fixed width — two spaces at 321 s, four below 10 s:so nothing matched, every fault parsed with
t = None, and the tool reported "no fault shares an iova with an unmap inside the window: ordering not shown by this capture" — a negative for input it should have matched, for a capture that contained the matching unmap 31 µs away.This reader already used
^\[\s*(...)and parses the real form, but nothing pinned it: its fixture wrote the unpadded[1234.500000], the same shape as the example in the file that was wrong. A fixture generated from the example validates the assumption, not the input.The two arms
Both padding widths, because the early-boot line is where a boot-time fault would be parsed from. And the second arm is the sentence-level part: "I cannot read this capture" and "the capture shows no ordering" are different findings, and the tool must not print the second when the first is true — the same distinction the
-row andNO SAMPLEalready carry.Verified
No behaviour change; two assertions added where a behaviour was right but unpinned.