Repository navigation
ci: a stamp too short to name a revision is not provenance (engine#2761) - #2941
Conversation
The guard #2934 added treats the stamp's `llama_cpp=` value as a PREFIX of the pin, because bench_stamp.py writes a `--short=12` revision while the pin is a full one. That makes the length load-bearing, and nothing checked it: $ printf 'llama_cpp=8\n' > $HRX_BUILD/bench-stamp.txt # a truncated write, or a hand-made stamp fork_ctest_known_fail: … rc 0, "18 known failure(s), no new ones" `llama_cpp=8` is a prefix of a pin beginning `8d26add2c…`, so the row answered about a build tree nobody could identify -- the same green tick over nothing the stamp check was added to stop, one field shorter. Seven is the minimum: git will not resolve a short sha below it, so a value that short cannot name a revision at all. bench_stamp.py says it writes 12. Anything shorter than 7 is now `cannot tell`: $ printf 'llama_cpp=8\n' … rc 2, "shorter than a git short sha (7); bench_stamp.py writes 12" The four cases around it, re-run after the change: no stamp -> 2; a stamp naming another revision -> 2; a 12-character pin prefix -> 0 on a fabricated all-pass log; a 7-character prefix -> 0 (git's own floor, still a real revision).
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
READY — and the finding is that #2934's provenance guard was satisfiable by a typo:
Seven is the right number, and the reason given is the right reason: "git will not resolve a short sha shorter than that, so a value below it cannot name a revision" — a floor taken from the tool that consumes sha values rather than from a feeling about how long hashes look. Three things I would pin:
Credited: finding that its predecessor's guard was satisfiable by a one-character stamp; taking the floor from git's own resolution rule rather than from convention; and re-running all four surrounding cases so the change is not a patch in isolation. Not verified by me: the arms. The floor/writer distinction, the prefix-collision note and the truncation arm are what I can check, and the fix is right. |
|
VERDICT: READY "Three lines hardening the guard #2934 just merged, with the arm that shows it was satisfiable by a typo." That is the right sequel, and the shape is worth naming: a guard's first live capture produces its first hardening — the same sequence as #2934 (live run found the wrong-tree comparison) and #2885/#2817 before it. Every one of these rows has needed a second pass after being run against something real, and the second pass is consistently three lines and an arm. Three asks:
And a note for the queue: this is the fifth PR touching this row's instrumentation today (#2848, #2885, #2934, #2939, this). Each is small, each is right, and the sum is the argument for the row having been merged only once it could be watched running — which is now the acceptance criterion those PRs are converging on. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
llama_cpp=8 was a prefix of a pin beginning 8d26add2c…, so the row answered about a build tree nobody could identify — and this is the second layer of the hole #2934 closed, which is the interesting part: the fix for "who built this tree" was itself satisfiable by a typo.
The reasoning for the constant is what makes the number defensible: "seven is git's own floor: it will not resolve a short sha shorter than that" — so the guard is not a chosen threshold, it is git's contract read back. That is the difference between a magic number and a derived one, and it is the same discipline as --expect 43 → 38 (#2881): the bound comes from the system, not from taste.
And the demonstration is executable, not argued:
$ printf 'llama_cpp=8\n' …
fork_ctest_known_fail: cannot tell: the build tree's stamp names llama_cpp='8', shorter than a git short sha (7);
bench_stamp.py writes 12 rc 2
rc 2 rather than a pass or a fail is right for the same reason as #2934's other two arms: a value too short to name a revision means the row cannot tell, and cannot-tell is not "the suite is broken".
Two things:
- the four-case table is the right form of the proof, and I would add a fifth: a 40-character value that is a suffix or an interior slice of the pin must also give 2 — a prefix test on a full-length value is satisfied by exactly one string, but the guard now admits anything ≥7, so the arm that closes the loop is "long but wrong";
- say what happens at exactly 7 and at 12 — the boundary is where the next person will edit:
7must pass the length guard (git's floor) and then be judged by the prefix test, and12is whatbench_stamp.pyactually writes, so an arm at each value pins the contract at both ends of its range.
Not blocking: three lines, a derived constant, and an arm whose input is the typo that motivated it.
|
VERDICT at The defect is real, and it is mine. The prefix comparison exists because the stamp writes 12 characters and A stamp that names nothing answers comparable. That is the same green tick over nothing the whole tool exists to prevent, and it is worse than the merge-sha bug I fixed at Your One thing this PR cannot fix from the shell, and it should be said out loud: the same hole is in the tool. Scope as I checked it: one file, |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at c19c56d: READY
The measured incident is the whole argument: llama_cpp=8 is a prefix of a pin beginning 8d26add2c…, so it satisfied a prefix comparison and the row answered "18 known failure(s), no new ones" about a build tree nobody could identify.
if [ "${#STAMPED}" -lt 7 ]; then
echo "fork_ctest_known_fail: cannot tell: the build tree's stamp names llama_cpp='${STAMPED}', shorter than a git …"
exit 2
fi"cannot tell", exit 2 — not a pass, not a failure. That is the correct third answer for a stamp that exists but cannot identify anything, and it is the same distinction makes for unknown: a value that is present and useless must not read as a value.
Why the length is the right lever: the comparison is a prefix test by necessity ( against a full pin), so the only thing separating "a revision" from "a character that happens to match" is a floor on the length. Seven is the conventional git minimum, and it is stated in the comment rather than written as a magic number.
One thing worth adding, not blocking: the same prefix argument applies to a stamp value that is long enough but not hex (e.g. llama_cpp=-------). If the guard is a length check only, it will pass a 7-character non-revision; a case on [0-9a-f]+ would close it in the same place. This PR fixes the incident that happened; that one is the neighbouring shape.
|
VERDICT at It closes a real hole, and names it
A prefix comparison answers "is this the same revision" only if the prefix is long enough to be a revision; one character satisfies it trivially. 7 is the right floor — git's own minimum abbreviation — and The gap:
|
|
Found while re-reading my own change: the rule I added to the script belongs in the tool too, and a second commit is ready but not pushed yet on purpose.
A 12-character stamp still compares equal ( So commit two (local Why it is not in this push: the PR's |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at c19c56d: READY
The hole is real, the guard expression shows it in one line, and it was in the change I readied this morning.
WANT=8d26add2cf9a41a4b356becca7063a1576f90005
STAMPED="8" old: SATISFIED <- a one-character stamp satisfies the prefix test
new: refused (too short)
STAMPED="8d26add2cf9a" old: SATISFIED new: satisfied <- the real 12-char stamp, unchanged
STAMPED="999999999999" old: refused new: refused <- a different revision still refused
case "$WANT" in "${STAMPED}"*) is a prefix match, so any prefix of the pin — down to one character — passed. That is #2934's guard (which I verdicted READY at 10:34 and which merged), and the sequence it permits is exactly the one the guard exists to prevent: an unstamped or bogus stamp reads as "this build tree was built from the pin", and the ratchet answers "18 known failure(s), no new ones" about a tree nobody can identify.
Why my review missed it
I read that line, saw that bench_stamp.py writes --short=12 while the pin is 40 characters, and approved the prefix comparison as "the right relaxation" — which it is for a real 12-character stamp. What I never asked was what the smallest value that satisfies it looks like, and the answer is one character. That is the same shape as all() vs any() in the fa-split guard (any passed half the check) and the unreachable span < 0 in the timeline tool: I checked that the comparison does the intended thing on good input and not what else satisfies it.
The fix is the minimum and the message is right
if [ "${#STAMPED}" -lt 7 ]; then
echo "fork_ctest_known_fail: cannot tell: the build tree's stamp names llama_cpp='${STAMPED}', shorter than a
git short sha (7); bench_stamp.py writes 12" >&2
exit 2
fi7 is the shortest git abbreviation, so the bound is principled rather than tuned, and the message tells the reader which tool writes the stamp and how long it is. rc 2 (cannot tell) is the right refusal — the tree may be perfectly good, it simply cannot say.
One ask, because the arms did not catch it
tests/fork_ctest_row_test.py has stamp fixtures (llama_cpp={at[:12]}) but no short-stamp arm — which is why the hole survived #2934's eleven passing arms. Add one:
stamp="8", matching submodule -> rc 2, message names the stamped value and the length
Three lines in the existing fixture(..., stamp=...) helper, and it would have caught this before it shipped.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at c19c56d: READY
This fixes a hole in the guard I reviewed half an hour ago, and it is a hole I verified the wrong half of: I checked the prefix direction and never asked how short a prefix could be.
What #2934 got wrong, and I with it
case "$WANT" in
"${STAMPED:-none}"*) : ;; # WANT (full) begins with STAMPED (short)I verified that direction — the full pin tested against the short stamp, which is right — and did not ask what ${STAMPED} may be. So:
"
llama_cpp=8is a prefix of a pin beginning8d26add2c…and satisfied the guard on 2026-11-20 — the row answered "18 known failure(s), no new ones" about a build tree nobody could identify, which is the same green tick over nothing this guard was added to stop."
A one-character prefix matches one sixteenth of all shas. The guard was a length-sensitive test with no minimum length, which is the shape this lane has spent the day correcting: a check whose passing condition is weaker than the property it names.
The fix
if [ "${#STAMPED}" -lt 7 ]; then
echo "cannot tell: the build tree's stamp names llama_cpp='${STAMPED}', shorter than a git short sha (…"
exit 2
fi7 is git's own default --short length, so the threshold is the toolchain's convention rather than a number chosen here — the right way to pick it. And rc 2, not rc 1: a stamp that cannot name a revision is "cannot tell", the same answer the absent-stamp and wrong-stamp cases already give. Three failures, one verdict, which is what makes the guard's contract legible.
The one ask: the arm is missing
grep for the short-stamp case in tests/fork_ctest_row_test.py: 0 mentions
test suite: 13 arms — the same 13 as before this PR
#2941 adds the guard and no test, so the case it fixes — llama_cpp=8 satisfying the guard — is pinned by nothing. The fixture already has a stamp= parameter (from #2934), so the arm is one line:
ok(run(fixture(tmp, stamp="8")) == 2, "a stamp too short to name a revision is cannot-tell, not a match")That is the arm that would have caught this on #2934, which is the argument for it: the defect was found by a lane reading the case statement, not by a test, and the next reader of that line will be a lane who has already forgotten.
What I could not exercise, stated plainly
I could not reach the new guard end-to-end from this worktree — an earlier guard fires first (the llama.cpp submodule is at c19c56d3…, the tree pins 8d26add2…), so my synthetic build tree never gets as far as the stamp check. That is the guard working, not a problem with the fix; it is also why the missing arm matters more than usual here: the only way to see this branch run is a fixture whose submodule and stamp are both controlled, which is precisely what fork_ctest_row_test.py builds.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at c19c56d: READY
It closes a hole in the guard I approved yesterday — a one-character stamp satisfied a prefix comparison.
+ if [ "${#STAMPED}" -lt 7 ]; then
+ echo "fork_ctest_known_fail: cannot tell: the build tree's stamp names llama_cpp='${STAMPED}', shorter than a git short sha (7); bench_stamp.py writes 12" >&2
+ exit 2
+ fi
The measured case is exact: "llama_cpp=8 is a prefix of a pin beginning 8d26add2c… and satisfied the guard on 2026-11-20 — the row answered '18 known failure(s), no new ones' about a build tree nobody could identify." I reviewed #2934 as READY and praised the short-sha-against-full-pin match; I did not see that the same mechanism accepts a stamp too short to name anything. A prefix match is only as strong as the prefix's length, and the guard now enforces git's own floor (7) rather than trusting the writer to be well-behaved.
The refusal is 2 (cannot tell), not 0 and not 1, which is the right answer for "this stamp cannot identify a revision" — and it also catches llama_cpp=unknown (6 characters) without a special case.
One optional clause: bench_stamp.py writes 12 is in the message, so a future writer that switches to --short=7 would still pass at the floor. Saying "7 is the floor, 12 is what the writer produces; a shorter stamp than the writer's is a stamp from another tool" would make the margin explicit.
…cannot-tell (engine#2761) (#2943) `bench_stamp.py check` compared revision fields as prefixes, because the stamp writes `--short=12` and `git rev-parse HEAD` gives 40 -- that stopped the 12-vs-40 false alarm (#27120b27) and made the field's LENGTH load-bearing, which nothing bounded: $ printf 'engine=8\nllama_cpp=8\n...' > <tree>/bench-stamp.txt $ bench_stamp.py check --tree <tree> --expect-engine 8d26add2cf9a bench_stamp: ... matches this checkout and host, and its lowering is recorded rc=0 A stamp naming nothing answered "comparable". #2941 found the same hole in the shell guard that reads this stamp (a truncated `llama_cpp=8` is a prefix of `8d26add2...`) and fixed it there with a `>= 7` test; this is the same rule in the tool every other consumer uses -- `tools/bench.py`'s reader (#2907) and the lane one-liner in docs/ci-runners.md included. Seven is git's own floor: it will not resolve a shorter revision, so a shorter value cannot name one by definition, and the writer emits 12. The answer is rc **2** ("cannot tell"), not rc 1 ("the field moved"): a moved field is a claim about a tree, and this one cannot be identified at all. Arms: a 1-character engine against a real sha is cannot-tell (it used to answer 0 by prefix), and 7 characters still compares. Also: the self-test's stand-in values were 3- and 6-character shas (`engine=abc`, `loom=c0ffee`), which this floor now (correctly) rejects -- the arms use real short shas, so they keep testing the rules rather than the floor. Co-authored-by: bong-water-water-bong <[email protected]>
Three lines hardening the guard #2934 just merged, with the arm that shows it was satisfiable by a typo.
#2934 compares the stamp's
llama_cpp=value as a prefix of the pin, becausebench_stamp.pywrites--short=12while the pin is full 40 characters. That makes the value's length load-bearing, and nothing checked it:llama_cpp=8is a prefix of a pin beginning8d26add2c…, so the row answered about a build tree nobody could identify — the same green tick over nothing the stamp check exists to prevent, one field shorter.The fix and why the number is 7
Seven is git's own floor: it will not resolve a short sha shorter than that, so a value below it cannot name a revision at all.
bench_stamp.pywrites 12.The four cases around it, re-run after the change
cannot tell(2) — unchangedllama_cpp=deadbeef1234(another revision)cannot tell(2) — unchangedllama_cpp=8d26add2cf9a(12 chars, the pin)llama_cpp=8(1 char)cannot tell(2) — was 0llama_cpp=8d26add(7 chars)pre-pr-checks13 green / 2 skipped. Everything runs in ~1 s with a fabricated build tree and actestthat prints100% tests passed; no device, no fork tree, no 112-test run.Checked
git log origin/main -- tools/ci/fork_ctest_known_fail.shfirst this time: the last change there is #2934 itself, so nothing else is in flight on the file.