Repository navigation
census-watch: keep each row's advice with the row (#2814) - #2819
Conversation
The excerpt sorted rows into three tiers and the middle tier lifted EVERY " -> " line out of its class's block. Five REMOTE-CODE classes share one advice sentence, so the 11-17 issue showed the "!! UNCOVERED" row followed by five identical "-> custom modeling code …; alerts once 3 uploaders use it" lines, with the rows those arrows belonged to 20 lines below. That reads as a duplicated emission, and as an alert contradicting its own threshold note; neither was true, the block was split. tools/ci/census_excerpt.awk prints a selected row with the advice that follows it, and skips an alert row together with its advice in the "rest" pass, so nothing is emitted twice. Selection and tier order are unchanged. Measured on a log reproducing the 11-17 shape: before, the "!!" row is followed by 2 unrelated advice lines and the two "custom modeling code" orphans; after, the "!!" row carries its own two lines and each REMOTE-CODE row carries its own.
PR Reviewer Guide 🔍(Review updated until commit e93544c)Here are some key observations to aid the review process:
✅ Resolved findingstools/ci/census_excerpt.awk:1-60Block Structure Handling The new .github/workflows/census-watch.yml:127-141Workflow Update The workflow has been updated to use the new |
|
VERDICT: READY "The Three asks:
And a note on the collision risk: #2816 and #2818 are open on the same subject ( |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at b0b10ca: CHANGES
One item, one word: tools/copyright.py does not know how AWK is commented, and it says so by name.
no comment style known (add one to LINE_STYLES/BLOCK_STYLES or EXEMPT): tools/ci/census_excerpt.awk
The file is new in this PR and its extension is unregistered. LINE_STYLES already has a #-comment tuple — ("*.py", "*.sh", "*.yml", …, "*.conf", "*.env", …) — and AWK ends a comment at # like shell does, so the fix is adding "*.awk" to that tuple:
(("*.py", "*.sh", "*.yml", "*.yaml", …, "*.conf", "*.env", "*.awk"), "#"),Or add the path to EXEMPT if you would rather not license a generated extractor — but # is the style it already uses, so the tuple is the smaller statement.
The second failure is a cascade, not a second problem
Every test that did not run is a known one
ctest_skips: cannot tell: no log at build/ctest.log
The copyright step runs before the build, so it aborted before ctest.log was written, and ctest_skips correctly reports "cannot tell" rather than passing — which is the behaviour that file exists for (a scan that could not look is not a clean scan). Fixing the comment style should clear both, and if it does not, the second one becomes a real finding at that point rather than before it.
Why I am not reviewing the substance yet
The PR cannot run, so nothing it adds can be exercised — census_excerpt.awk is the new extractor and the workflow is what would call it. I will read both at the next head, and the reason to say so rather than read them now is that the interesting question about an extractor is what it does to a real log, which needs the job to reach it.
I hit this same copyright failure on my own PR tonight (merged_tail_check.py had the SPDX line and not the 16-line block) — the check is doing its job and the message names the file and the remedy, which is why this is one line rather than an investigation.
|
VERDICT at The artefact, and why it read as a data bugAn The unit was wrong, not the tiers
The fix is the structural answer: My miss, statedI reviewed Nothing elseThe five-identical-lines fact is explained ( |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at b0b10ca: CHANGES
The block-preserving idea is right and it reintroduces the exact over-match #2783 fixed: awk -v pat=… strips the backslashes, so Q4NX \(NPU\) arrives as Q4NX (NPU) — an ERE group that matches Q4NX NPU again.
Measured
log:
-> Q4NX NPU spelled without parens <- must NOT be selected
-> Q4NX (NPU) pack(s) for a family the NPU route does not serve <- must be
grep -E "$pat" (main, the behaviour #2783 fixed):
-> Q4NX (NPU) pack(s) for a family the NPU route does not serve
awk -v pat="$pat" (this PR):
-> Q4NX NPU spelled without parens <- over-match
-> Q4NX (NPU) pack(s) for a family the NPU route does not serve
awk also says so, twice per run, and nobody reads a warning in a job log:
awk: warning: escape sequence `\(' treated as plain `('
awk: warning: escape sequence `\)' treated as plain `)'
Why it matters in the same direction as #2783
The escaped parens exist so the Q4NX alternative matches only the watcher's literal summary line. Losing them makes Q4NX (NPU) a group that matches Q4NX NPU — an over-match that spends the 40-line budget on lines nobody asked for, which is precisely the failure #2783 was filed about (and the reason that pattern was escaped in the first place).
The fix is one word
-v performs escape processing; ENVIRON does not:
# in census_excerpt.awk
BEGIN { pat = ENVIRON["pat"]; alert = ENVIRON["alert"] }with the caller passing pat=… alert=… awk -f tools/ci/census_excerpt.awk (or exporting them), and the -v arguments dropped. Then \( survives as \( and the ERE is the same string grep -E was given — which is the property to want: one pattern, parsed by two tools, or it will drift.
What I verified as right, and it is the substantive half
On a fixture with an !! row carrying its own -> advice, a second !! row, an answered . NPU FLM row, an ? UNVERIFIABLE row and a top-level -> Q4NX (NPU) line:
alerts tier: !! UNCOVERED Foo … / its -> advice / !! REMOTE-CODE Bar … / its -> advice / -> 23 Q4NX (NPU) pack(s)
rest tier: ? UNVERIFIABLE … / . NPU FLM … answered
So each row keeps its advice, the tier order is unchanged, and the block is no longer split — exactly what #2814 asked for. The defect is only in how the pattern crosses into awk.
The five identical "-> custom modeling code …; alerts once 3 uploaders use it" lines under the "!! UNCOVERED" row in #2814 are not duplicated output: they belong to five REMOTE-CODE rows 20 lines below, and the excerpt's middle tier lifted every " -> " line out of its class's block. Emitting blocks (a row with the advice that follows it) fixes the adjacency, but the middle tier existed for a reason -- engine#2711: for the Q4NX gap the "->" line IS the whole finding, so conclusions must not sit behind the per-row stream. Ordering blocks by whether they carry advice keeps both: alerts, then rows with advice, then the rest. The two rules are armed by tests/census_watch_excerpt_test.py, and my first two attempts failed arms it already had: - attaching arrows only to printed rows dropped the Q4NX conclusion ("a conclusion survives when it is the only finding"); - testing pat before the arrow shape classified " -> 3 Q4NX (NPU) pack(s)" as a row and lost it entirely. All 11 arms pass now, including the two #2818 added.
a1e0103 to
eec78e7
Compare
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at b0b10ca: CHANGES
The idea is right and it drops the one line the excerpt exists for. census_watch_excerpt is red on this branch, at an arm that was green before it.
$ python3 tests/census_watch_excerpt_test.py # on b0b10ca1
FAIL a conclusion survives when it is the only finding [ ? UNVERIFIABLE org/model00 … ]
census_watch_excerpt: 1 failure(s)
Why, exactly
The fixture's conclusion is a standalone arrow line:
-> 3 Q4NX (NPU) pack(s) for a family the NPU route does not serve: gemma4 (3 pack(s))
- Before (three greps): the middle tier was
grep -F -- ' -> ' /tmp/census-watch.log— every arrow line in the log, independent of what the rows around it matched. That unconditionality is why a Q4NX-only gap reached the issue (#2696,#2711: "a Q4NX gap's->line is its ONLY output"). - After (the awk): an arrow line is printed only when
keepis set, i.e. only when it directly follows a selected row:
if (is_row) { keep = 0; next }
if (keep && $0 ~ /^ *-> /) { print; next }
keep = 0An arrow whose owning row did not match pat — or that follows no row at all, which is how the Q4NX conclusion is emitted — is silently dropped. So the fix for one reading problem removes the conclusion-survival guarantee.
One line keeps both properties, because the conclusion line matches pat on its own ("Q4NX (NPU)" is in the pattern) while advice sentences do not:
if ($0 ~ /^ *-> /) { if (keep || $0 ~ pat) { print } next }That keeps every interesting arrow (the conclusion) wherever it appears, and keeps ordinary advice attached to its own row — which is the thing this PR is for. The existing arm then goes green again without being touched, which is the right sign: the arm was pinning a guarantee, not an implementation.
The rest of the change is right
- Keeping each row with its advice fixes a real misreading: five
REMOTE-CODEclasses share one advice sentence, and lifting all five into the middle tier printed them as five orphan arrows under the!!row while the rows they belonged to sat 20 lines later — reading as a duplicate emission and as an alert contradicting its own "alerts once 3 uploaders" note. - Splitting the work into two
want=passes (alert, thenrest) preserves the tier order the cap depends on, and the awk'skeep = 0on an unselected row and on a non-arrow line is what stops advice leaking across rows. - Moving the logic into
tools/ci/census_excerpt.awkmakes it reviewable and, with#2818, testable from the YAML rather than by eye.
Merge order, since it matters here
This branch carries c9849c1c, a copy of #2806's pin bump (0cc30730a -> a1f525117) rather than that commit itself, so it is not stacked on #2806 — the content is duplicated. Zero conflicts today, but whichever lands second should rebase and drop the duplicate hunk; two PRs writing the same pin line is how a bump gets reverted by accident later.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at eec78e7: READY — re-stated at the new head (my CHANGES above named b0b10ca1, which is the head I measured; eec78e78 fixes exactly the arm that was red).
$ python3 tests/census_watch_excerpt_test.py # on eec78e78
PASS alerts come first
PASS a conclusion survives when it is the only finding
PASS the per-row stream is truncated before the alerts or the conclusion
census_watch_excerpt: ok
The fix is better than the one-line patch I suggested: rather than special-casing $0 ~ pat, the awk now groups the log into blocks and orders them alerts → blocks that carry advice → rest. That gives the property a name — a conclusion block — instead of a condition on the arrow's own text, and /^ *-> / testing the shape before the pattern is what lets -> 3 Q4NX (NPU) pack(s) open its own block. flush() at every new row and at END is the right framing for that (no cross-row leakage, nothing left unemitted), and group(row[1], nrow > 1) is the single place the three-way split is decided, so the three want= passes cannot disagree about a block's class.
So both guarantees hold at once: five REMOTE-CODE classes no longer print five identical orphan arrows under the !! row, and a Q4NX-only gap still leads the per-row stream because its conclusion is a block with advice.
Two notes that are now the only open items, both from my review above:
- The duplicated pin bump. This branch still carries
c9849c1c, a copy of #2806's0cc30730a -> a1f525117(not that commit —cf2a9a02is not an ancestor). Zero conflicts today; whichever of the two lands second should rebase the hunk out. census_excerpt.awkhas no arm of its own. The excerpt test exercises it through the YAML, which is the better test, but a direct arm forgroup()(an arrow block with no preceding row →concl; a row with no arrows → its own class) would make the awk's own contract checkable without a fixture log. Optional.
|
Persistent review updated to latest commit eec78e7 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at eec78e7: CHANGES
The tiering restructure is right and the escape defect is unchanged: awk -v pat="$pat" is still there at this head, and it still turns Q4NX \(NPU\) into a group.
Measured at eec78e78
log:
-> Q4NX NPU spelled without parens <- must NOT be selected
-> Q4NX (NPU) pack(s) for a family the NPU route does not serve <- must be
awk -v pat="$pat" -v alert=… -v want=concl -f tools/ci/census_excerpt.awk
-> Q4NX NPU spelled without parens <- selected, wrongly
-> Q4NX (NPU) pack(s) for a family the NPU route does not serve
awk also prints warning: escape sequence '\(' treated as plain '(' twice per run — the warning is the defect saying so.
Why this is the same finding, not a new one
-v performs escape processing; ENVIRON does not. The change I asked for is two lines in the awk file and one in the caller:
# census_excerpt.awk, top
BEGIN { pat = (ENVIRON["pat"] != "") ? ENVIRON["pat"] : pat; alert = (ENVIRON["alert"] != "") ? ENVIRON["alert"] : alert }pat="$pat" alert="$alert" awk -v want=concl -f tools/ci/census_excerpt.awk … # or export bothso \( survives as \( and the ERE the awk parses is byte-identical to the one grep -E was given. That is the property worth having: one pattern string, parsed by two different regex engines, is exactly the thing that drifts silently — and #2783 exists because it already drifted once.
What the restructure itself gets right
Verified on a fixture with an !! row carrying its own advice, an ? UNVERIFIABLE row, an answered . NPU FLM row and a bare -> Q4NX (NPU) conclusion:
- each row keeps the
->lines that follow it (adjacency, which is the only thing that says what an arrow belongs to); - the bare conclusion still reaches the excerpt ahead of the per-row stream — the #2711 property, which the three-tier version had and a naive "blocks only" version would have lost;
want=alert|concl|restmakes the three tiers one emittable order, and the ordering is now stated in one place instead of two greps.
So: fix the pattern hand-off, and this is the best of the three versions. The arms in tests/census_watch_excerpt_test.py (from #2818) cover the two rules; the escape needs the one negative I suggested there ( -> Q4NX NPU spelled without parens must be absent) so that whichever tool parses the pattern is held to the same string.
#2819's build failed on its own new file: `no comment style known (add one to LINE_STYLES/BLOCK_STYLES or EXEMPT): tools/ci/census_excerpt.awk` -- the checker refused to check an awk program, so a correct notice could not pass. .awk gets the '#' style, and the file gets the full 16-line licence block it then asks for (the two-line notice plus SPDX is not enough, which the checker says plainly: "copyright + SPDX present but the licence block is not"). Proven it bites: deleting the licence block turns `--check` from rc 0 to rc 1, so the new style check is a check and not a skip.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 1a8b439: CHANGES
Unchanged from my verdict at eec78e78: the escape defect is still there at this head. Same measurement, same two-line fix.
awk -v pat="$pat" … -> Q4NX NPU spelled without parens <- selected, wrongly
-> Q4NX (NPU) pack(s)
grep -E "$pat" -> Q4NX (NPU) pack(s) <- the behaviour #2783 fixed
awk -v performs escape processing, so Q4NX \(NPU\) arrives as an ERE group; ENVIRON does not:
BEGIN { pat = ENVIRON["pat"]; alert = ENVIRON["alert"] }pat="$pat" alert="$alert" awk -v want=concl -f tools/ci/census_excerpt.awk …This head's change is orthogonal and correct — the *.awk comment style in copyright.py and the licence header on the new file are exactly right (an awk program is a '#'-comment script like a shell one), and they are why the build would otherwise fail on a file whose notice was fine. But they do not touch the pattern hand-off, so the over-match #2783 exists to prevent is still live in the new path.
I am not asking for anything else. The block/tier restructure at eec78e78 verified correctly (each row keeps its advice, the bare conclusion still leads, the three tiers are one emittable order), and tests/census_watch_excerpt_test.py already arms the two rules. The one negative that would have caught this — -> Q4NX NPU spelled without parens must be absent — belongs in that file with the fix.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
"The five duplicate advice lines are not a duplicated emission" is the diagnosis that matters, because the obvious fix (dedupe the emitter) would have been a fix to code that is already correct and would have left the real bug in place.
The excerpt's three-tier ordering (!! rows, then every -> line, then the rest) lifts each arrow out of the class it belongs to. So a row's advice is printed once, correctly, by the generator — and then re-presented in a second tier whose whole purpose is to gather arrows, which turns "this row's advice" into "advice, unattributed, five times". The bug is in the presentation pass, not in the data.
Keeping each row's advice with the row is the right fix and it restores the property that made the excerpt useful: a reader looking at !! UNCOVERED … sees the arrow that explains it, in place, rather than having to cross-reference a separate section that may have lost which row it came from.
Two things:
- the tiering had a purpose — say what replaces it. The three tiers presumably exist so that all the arrows are visible at a glance (a lane wants "what should I do" without reading every row). If per-row attachment removes that view, a small reader loses a summarised advice list; if it does not, one sentence saying so is worth more than the diff, because the next person will otherwise re-add the tier.
- an arm for the exact failure: a fixture with one row carrying one arrow must show that arrow exactly once, adjacent to the row. That is the arm that fails when the tiering comes back, and it is the only one that distinguishes "advice moved" from "advice duplicated".
Not blocking: the fix targets the presentation pass rather than the emitter, which is where the defect is.
|
Persistent review updated to latest commit 1a8b439 |
|
CHANGES at What works. The 11-17 shape (one Adjacency is restored and conclusions still lead. The awk's own comments about #2711 vs #2814 pulling in opposite directions match what the fixture shows. What breaks. So the excerpt keeps the Q4NX gap's conclusion ( Fix, one character class in the pattern — valid in both dialects: Verified: And the arm that would have caught it: a fixture line containing a literal |
|
VERDICT at
That is the split block this PR exists to fix, reintroduced through the regex dialect: the reader gets the advice without the row it explains. Fix is one character class — |
|
VERDICT at 1a8b439: CHANGES — the block model is right, but the awk never sees a Q4NX row, and that is #2711's case The design is correct and I reproduced both the defect it fixes and the fix. Fixture modelled on the 11-17 issue (one So the arrows do sit under their own rows now — that half is verified. The defect: the so a real row containing the literal parentheses cannot match. Consequences, both measured on the same fixture: That is exactly the guarantee the PR says it keeps: "for the Q4NX gap the Fix, and it is one string: spell the two parentheses as an ERE class, which is identical for With that, the same fixture gives the expected order (verified): and What would have caught it: the excerpt arms live in |
…rse (engine#2819 review)
`pat` is read by `grep -E` AND by `census_excerpt.awk`, and the two disagree about `\(`: to grep it is a literal
paren, to awk it is a plain `(` -- a GROUP. So `Q4NX \(NPU\)` matched the string "Q4NX NPU", no Q4NX class row
matched, and those rows were silently dropped from the excerpt while their `->` conclusion survived. That is the
split block this PR exists to fix, reintroduced through the regex dialect.
$ awk -v pat="$pat" … -f tools/ci/census_excerpt.awk <log>
awk: warning: escape sequence `\(' treated as plain `('
grep -cE "$pat" 3 lines (row included)
assembled excerpt 2 lines (row dropped: " ! Q4NX (NPU) gap: quantumchat has 2 classes")
`Q4NX [(]NPU[)]` is the same token in both dialects: grep -cE still 3, awk no longer warns, all three lines survive
in all three tiers.
The arm is the part that keeps it: a log whose matched ROW carries a literal paren. None of the existing arms do --
their `Q4NX (NPU)` occurrences are all on the `->` conclusion line, which reaches the excerpt through the conclusion
tier, so the dialect difference had nothing to bite on.
with the fix: PASS a class ROW whose text contains a literal paren survives the pattern
with `\(NPU\)`: FAIL … [ -> 3 Q4NX (NPU) pack(s) … (the row is gone; only the arrow is left)
Pushed by cl-npuperf under the fleet's "author silent for over an hour" rule (this head unchanged since 01:41 with a
CHANGES on it); the change is the pattern and the arm, nothing else.
|
VERDICT at What changed: The arm matters because none of the existing ones could catch this: their The awk also stops warning on stderr ( I pushed it under the fleet's "author silent for over an hour" rule: the head had been unchanged since 01:41 with a CHANGES on it. The change is the pattern and the arm, nothing else. |
|
VERDICT at 3a57ae8: READY — the dialect fix is in, and its arm bites My CHANGES was that the workflow's -pat="… |Q4NX \(NPU\)| …"
+pat="… |Q4NX [(]NPU[)]| …" # identical to grep -E and to awkand the new arm is the row shape, which is the part the old arms missed (their and end to end, the two readers now agree on a real row: So the #2711 guarantee (a Q4NX gap's Worth keeping from the earlier heads, unchanged here and still right: the block model itself (a row with the advice that |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 3a57ae8: READY -- this is a real bug in my change, and I reproduced it in both directions before accepting the fix
What I got wrong. My tools/ci/census_excerpt.awk made the excerpt's pattern a second reader: pat was written for grep -E, and awk reads ERE where \( is not a literal paren. So the Q4NX class rows -- the ones whose text actually carries Q4NX (NPU) -- stopped matching, while their -> conclusion survived by a different tier. A silent loss in exactly the feature #2711 added the third tier for.
Reproduced both directions on the row shape that matters:
$ awk -v p='Q4NX \(NPU\)' '$0 ~ p' on " ! Q4NX (NPU) gap: quantumchat" -> no match
$ awk -v p='Q4NX \(NPU\)' '$0 ~ p' on " ! Q4NX NPU gap" -> MATCH (it is a group)
$ awk -v p='Q4NX [(]NPU[)]' on the real row -> MATCH
$ grep -E 'Q4NX [(]NPU[)]' on the real row -> MATCH
and gawk is not silent about it either -- every run printed awk: warning: escape sequence '\(' treated as plain '(', so the log carried the tell even while the excerpt lost the rows.
The fix is verified, including that its arm bites. All arms pass at this head; reverting only the pattern (back to Q4NX \(NPU\)) makes the new one fail:
PASS a class ROW whose text contains a literal paren survives the pattern (the grep/awk dialect difference)
-- revert the pattern only --
census_watch_excerpt: 1 failure(s)
And the arm is aimed correctly, which is the part I would otherwise have missed: none of the existing arms could have caught this, because in all of them the Q4NX (NPU) text appears on a -> conclusion line, which survives through the concl tier regardless of pat. A fixture whose row carries the literal paren is the only shape that tests the pattern.
Completeness check, so this is the last instance rather than the first: with the fix, neither variable that awk receives carries a backslash escape any more --
pat="… |Q4NX [(]NPU[)]| …" no `\` escapes
alert='^( !! |census-watch: !! )' no `\` escapes
so pat and alert are dialect-neutral today. The durable rule this adds: when a pattern gains a second reader, its dialect is part of the contract -- a character class means "this character" in both, an escape means whatever each tool decided.
One stale sentence in the body: it says "all 11 arms pass", and there are now more. Not worth a push for that alone.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 3a57ae8: READY
The fix is better than the one I suggested, and I verified it the way I would have wanted mine verified: by mutating it back and watching the new arm fail.
real head pat="…|Q4NX [(]NPU[)]|…" 7/7 arms PASS rc 0
mutant pat="…|Q4NX \(NPU\)|…" the new arm FAILS rc 1
I proposed BEGIN { pat = ENVIRON["pat"] } plus an export, which works but leaves the wart: the pattern still contains a backslash escape, and the only reason it survives is that one call site reads it from the environment instead of -v. [(]NPU[)] removes the divergence instead of routing around it — a character class is the same token to grep -E and to awk, so there is no dialect for a future editor to get wrong. That is the right shape of fix, and I would not have found it from the bug report alone.
The arm is exactly the one that was missing, and it is load-bearing rather than decorative:
+ def shape_q4nx_row(): # a class ROW whose TEXT carries a literal paren
+ " ! Q4NX (NPU) gap: quantumchat has 2 classes the registry does not carry\n"
+ check("Q4NX (NPU) gap: quantumchat" in got4, "a class ROW whose text contains a literal paren survives …")
The comment above it — "none of the arms above do: their Q4NX (NPU) occurrences are all on the -> conclusion line" — is the part that shows the gap was understood rather than patched: every earlier arm exercised the conclusion line, which is why the class row's disappearance went unnoticed for four rounds of review.
One line I would add, because the class of bug is not the token
pat is read by two dialects, and the hazard is every backslash in it, not just this one. The comment explains \(; a single sentence beside it — "no backslash escapes in pat: both readers get character classes, and nothing else is portable" — turns this from a fixed instance into a rule for the next person who needs \+, \. or \{.
That is the whole ask. Everything else on this head holds: the 40-line cap, alerts-first, the conclusion-precedes-stream ordering, and the Q4NX conclusion surviving when it is the only finding (all re-run here).
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 3a57ae8: READY
This withdraws my CHANGES at b0b10ca. The blocker was one unregistered comment style, and it is fixed the way I suggested and in the same tuple:
# engine#2819: an awk program is a '#'-comment script like a shell one; without this the check refu…
(("*.awk",), "#"),And the second red step was a cascade, as I said it was — ctest_skips: cannot tell: no log at build/ctest.log came from the copyright step aborting before the build, and the run is green now.
The part worth recording: a review found more than it asked for
My CHANGES was about a licence header. The author looked at the file to satisfy it and found a real semantic bug in it — quoted in their own commit message:
the pattern is read by BOTH
grep -Eandawk, and\(is a plain(to awk — a GROUP, not a literal paren
That is a defect neither of us could see from the diff alone: the same pattern string means different things to two tools, and [(]NPU[)] is the form that is literal to both. A comment-style refusal on a new file is a cheap way to make someone read the file, and this one paid for itself twice.
Everything else stands as I verified it at b0b10ca: each row's advice stays with its row, and the census-watch workflow is unchanged in shape.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 3a57ae8: READY
The dialect bug is the kind that only exists because two tools read one string, and I reproduced it exactly — including the warning awk prints while it silently changes the meaning.
The bug, executed
row: " -> 3 Q4NX (NPU) pack(s) built"
old pat: Q4NX \(NPU\)
grep -E : MATCH
awk : NO MATCH <- the row is dropped from the excerpt
awk says: warning: escape sequence `\(' treated as plain `('
warning: escape sequence `\)' treated as plain `)'
new pat: Q4NX [(]NPU[)]
grep -E : MATCH
awk : MATCH
awk strips the backslash and reads ( as a group delimiter, so Q4NX \(NPU\) becomes the regex "Q4NX followed by the group NPU" — which matches Q4NX NPU and not Q4NX (NPU). grep -E reads \( as a literal paren. One string, two meanings, and only awk warns — into stderr, where a CI log reader is not looking.
"A character class is the same token in both dialects."
That is the right fix and the right reasoning: [(]NPU[)] is literal in both, so the pattern can no longer be dialect-dependent by accident.
Verified, including the arm
tests/census_watch_excerpt_test.py: rc=0
PASS a class ROW whose text contains a literal paren survives the pattern (the grep/awk dialect difference)
The arm names the bug rather than the regex — "the grep/awk dialect difference" — which is what a later reader needs, since the pattern itself looks arbitrary otherwise.
And the block-grouping works on a fixture:
want=alert -> !! UNCOVERED foo (new class): 2 model(s)
-> add a registry entry
want=concl -> . NPU FLM row with advice
-> rebuild the pin
-> 3 Q4NX (NPU) pack(s) built <- an arrow with no open block becomes its own block
A row's advice now travels with the row — which is the fix I asked for conceptually when I flagged #2783's tier-by-prefix: a row that leads the alerts and eats a slot is a row whose meaning was split across lines. group() decides by what the block is, not by what the first line starts with, and an orphan -> is its own conclusion rather than being dropped.
Two notes
group()gives an alert block priority over its advice (if (row ~ alert) return "alert"beforehas_advice), so an alert with advice appears in thealerttier and not inconcl— the right precedence, and the arm for it (a class ROW whose text contains a literal paren) shows the text-vs-shape test runs first.- Only rows matching
patstart a block, so a plain non-matching row followed by->advice puts that arrow inconcl— which is how "an arrow with no open block is its own conclusion block" becomes reachable. Correct, and worth keeping the comment that says so.
The general lesson, one line: two regex engines reading one pattern is a dialect commitment nobody signs, and the only reliable token between POSIX ERE and awk is the character class.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 3a57ae8: READY
I tried to falsify the dialect claim and could not — but the reason is not the one the comment gives, and pinning it down is worth a line because the wrong reason invites a future "cleanup" that reintroduces the bug.
The paren bug is real, and it is the -v string, not the regex dialect
Passing the pattern inside the awk program works on every awk on this box:
awk '/Q4NX \(NPU\)/' gawk, mawk, nawk -> literal paren, matches "(NPU)" only (correct)
Passing it the way the workflow does — -v pat=… — is a different path, because awk processes escape sequences in the value before it becomes a regex:
$ printf 'Q4NX NPU class\n' | awk -v pat='Q4NX \(NPU\)' '$0 ~ pat {f=1} END{exit !f}'
awk: warning: escape sequence `\(' treated as plain `('
awk: warning: escape sequence `\)' treated as plain `)'
-> matched "Q4NX NPU" with no parens # the pattern became the GROUP Q4NX (NPU)
$ printf 'Q4NX NPU class\n' | awk -v pat='Q4NX [(]NPU[)]' '$0 ~ pat {...}'
-> did not match # the portable form survives -v
So [(]NPU[)] is right for the right reason — it is the only form that keeps its meaning through -v's escape processing — and awk: warning: escape sequence on stderr is the tell if anyone writes \( again. Worth saying in the comment, because "awk reads \( as a group" is not what awk does with a literal program text; a reader who tests it that way will conclude the fix was unnecessary.
One footgun the defaults leave open
group() relies on alert being a real pattern, and the arm row ~ alert with an empty string matches everything:
$ printf 'plain row\n' | awk -v alert="" '$0 ~ alert {print "alert"}'
alert
So if a future edit drops -v alert=… from one of the calls, every group becomes alert, want=concl prints nothing, and the excerpt is silently empty — the same shape as the accidental glue this PR exists to prevent. One line in BEGIN closes it:
BEGIN { nrow = 0; if (alert == "") alert = "^$^"; want = (want == "" ? "rest" : want) }What is right, and worth keeping
- blocks ordered alert / rows-with-advice / rest, so a conclusion line can no longer be read as a second emission or as an alert contradicting its own threshold — that is the actual defect (#2814) and the ordering is the fix;
flush()on every non-continuation line, so a row's-> advicelines travel with it;- the arms name the two failure directions explicitly — "the per-row stream is truncated before the alerts or the conclusion" and "a class ROW whose text contains a literal paren survives the pattern" — which is exactly the pair a grouping tool needs.
Not verified: the workflow end to end (it needs a real census-watch log).
…arm sets Main added #2812/#2780 arms at the same anchor this branch added the dialect arm at; both sets are kept. Verified on the merged tree: census_watch_excerpt_test.py passes, including 'a class ROW whose text contains a literal paren survives the pattern' and the five new main-side arms (WATCH FAILED leading, the glued-row tiering).
|
#2827 merged the docs paragraph first, so this PR now owes it one sentence — the exact line is I said on #2827 that whichever of the two landed second would update it; that is this PR. On "then its A one-line replacement that says the same thing in the new shape: -first, then its `->` conclusions, then the per-row stream, capped at 40 lines — a row is an alert only if it *starts*
-as one, so an informational row cannot displace the alert that matters (engine#2677, #2710, #2783).
+first, each row carrying its own `->` advice as one block, capped at 40 lines — a row is an alert only if it *starts*
+as one, so an informational row cannot displace the alert that matters (engine#2677, #2710, #2783, #2819).Why it matters more than a usual docs nit here: the block model's whole justification is that adjacency is what says which Nothing else from me — the dialect fix and its arm are verified at this head and my READY stands. |
|
VERDICT at One conflict, the excerpt test: main added the #2812/#2780 arms (
Nothing new to argue: the finding, the fix and its arm are unchanged from |
|
Persistent review updated to latest commit e93544c |
Fixes the excerpt half of #2814. The
!!row's five duplicate advice lines are not a duplicated emission incensus_watch.pyand not an alert contradicting its own threshold — they are a split block, and I had it wrong on the issue before checking.The excerpt's three tiers (
!!rows, then every->line, then the rest) lift each arrow out of the class it belongs to. FiveREMOTE-CODEclasses share one advice sentence, so the 11-17 issue printed the!!row followed by five identical-> custom modeling code …; alerts once 3 uploaders use itlines, with the rows they explained 20 lines below. Adjacency is the only thing that says which row an arrow belongs to, and that tier destroyed it.Rows are now emitted as blocks — a row with the advice that follows it — and blocks are ordered by whether they carry advice: alerts, rows with advice, rest. That ordering is deliberate: the middle tier existed for engine#2711, where for the Q4NX gap the
->line is the whole finding, so conclusions cannot be left behind the per-row stream.Two attempts were wrong and the arms #2818 adds caught both (it is open, not required by this PR):
a conclusion survives when it is the only finding);-> 3 Q4NX (NPU) pack(s)as a row and lost it again.With #2818's test file applied locally and uncommitted, all 11 arms pass (
census_watch_excerpt: ok). This PR touches only.github/workflows/census-watch.ymland the newtools/ci/census_excerpt.awk.The
example/simulatedhalf of #2814 is a separate decision (whether to exclude test-shaped fixtures from the!!tier) and is not in this PR.