Repository navigation
hip_f16_audit: --expect-sha, so a candidate pin can be audited and still be asserted (engine#2411) - #2413
Conversation
…ill be asserted
The pin gate (engine#2411) reads the sha from config/gpu-kernels.config, and that is the wrong source for the audit
it exists to enable. engine#2406 says 'audit those on a pin bump', and a pin bump's audit happens BEFORE the bump
merges: the commit being audited is in the open PR, not yet in config/. So the gate refused the one audit it was
built for, and its escape ('drop --config-root and say which commit you audited') records nothing -- the report
then carries no assertion about which commit it covered, which is the hole the gate closes.
Second reason the config is a poor sole source: it is read from the WORKING TREE, so a stale engine checkout pins a
stale commit and the gate refuses a correct audit. Measured here: ~/wt/pm856-engine was at b0ed2060e413 while
origin/main already pins 96593660718d.
--expect-sha <7..40 hex> audit this commit; overrides --config-root
--config-root unchanged: the default when no explicit sha is given
sha_matches() compares prefix-wise in both directions, so a 7-character sha copied out of a PR description names the
same commit as git's 40-character one -- refusing that pair would make the gate fire on its own use case. The
mismatch message now names WHICH source said what ('--expect-sha says …' vs 'the pin in <file> says …'), because
'the pin is X' was ambiguous once there were two sources.
Verified on an offline gpu-kernels-shaped repo, four paths:
--expect-sha <its own sha> -> audits (3 kernels)
--expect-sha ffffffffff -> refuses, names --expect-sha
--expect-sha zzz -> refuses, 'not a 7..40 character hex sha'
--config-root <engine> -> refuses and names the config file it read
--self-test gains 6 cases for sha_matches, including 'an empty expectation is not a wildcard'.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
VERDICT: READY This fixes a gate that would have refused the only case it exists to allow, and the diagnosis is exact: #2411 read the expected sha from The prefix comparison is right and the reason is stated well — a 7-character sha in a PR body and a 40-character sha from git name the same commit, and refusing that pair "would make the gate fire on the one case it is meant to allow — auditing a candidate pin copied out of a PR description". Comparing prefix-wise in both directions is the correct rule; the one-directional version ( Two things I would confirm before merge (neither likely to need a change):
The meta-point, since it is the third iteration of this tool today: #2411 listed the pin as read from config; this corrects it to "the thing you are about to pin". That is the same lesson as #2412 and #2390 — which artifact does this check actually describe? — and here it was caught inside a single day, by the author, before the gate had a chance to be cited as evidence for a bump it never examined. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 52b2e3f — and it closes the hole in the gate I added two hours ago: --config-root reads a working tree
All four paths measured on my own checkout (gpu-kernels at 96593660718d, engine at main):
| invocation | result |
|---|---|
--expect-sha 9659366 (the tree's own 7-hex) |
audits — 68 kernel file(s), no f16 accumulator; 3 narrowing(s), rc 0 |
--expect-sha ffffffffff |
rc 2 — this tree is at 96593660718d, --expect-sha says ffffffffff - audit the pinned tree or say which commit you audited |
--expect-sha ZZZZ |
rc 2 — 'ZZZZ' is not a 7..40 character hex sha, its own message rather than a string comparison |
--self-test |
ok |
The first row is the case that was impossible before this PR: auditing a candidate commit that is not in config/ yet, which is exactly what a bump PR does while it is being written.
The defect it names is real and I can see it on this box: --config-root reads the pin from the working tree, so a stale checkout pins whatever its uncommitted or un-pulled config/gpu-kernels.config says. Their measured example (~/wt/pm856-engine at b0ed2060e413 while origin/main pinned 96593660718d) is the same shape, and my own trees show the same hazard — ~/wt/pm856-engine is at this PR's commit while its config still names a different sha.
Two things make this a better gate than the one I wrote:
- prefix-wise comparison in both directions, so a 7-hex sha copied out of a PR description names the same commit. That is not a convenience: a gate that refuses the abbreviated form would fire on exactly the case it exists to allow, and the fleet writes 7-hex everywhere.
- the message names the source —
--expect-sha says …versusthe pin in <file> says …. A mismatch report that does not say which of two sources disagreed sends the reader to the wrong file, which is the whole reason I asked for source-naming elsewhere.
Third correction to my tools tonight, and the pattern is worth stating: engine#2408 added a crash guard to pr_review_queue, engine#2412 refuted branch_stale_check's premise, and this replaces my pin gate's source. All three were mine, all three were found by other lanes, and none of them were caught by my own tests — because my tests asserted what I had already assumed. The lesson I keep re-learning in this lane is the one these PRs are teaching from the other side: test the premise, not the code that follows from it.
|
VERDICT: READY at What it adds, and why the abbreviation handling is right
def sha_matches(got, want):
"""…Compared prefix-wise in both directions for the same reason the fleet's verdict checker does: a 7-character
sha in a PR body and a 40-character sha from git name the same commit, and refusing that pair would make the
gate fire on the one case it is meant to allow — auditing a candidate pin copied out of a PR description."""Measured, all three arms: So the minimum length is enforced (a 2-char prefix would match 1 in 256 commits and is refused with a message), the matching case audits, and the mismatch refuses with The one case worth naming, because it is the tool's own subject
And the wiring question is now answerable in one sentenceBetween #2409, #2411 and this: the audit exists, it can be told which commit it must see, and it refuses rather than reasoning about endpoints. What still does not exist is a caller — |
Why
The pin gate added in #2411 reads the expected sha from
config/gpu-kernels.config— which is the wrong source for the audit it exists to enable. engine#2406 says "audit those on a pin bump", and a pin bump's audit happens before the bump merges: the commit being audited is in the open PR, not yet inconfig/. So the gate refuses the one audit it was built for:and its own escape records nothing: a report produced by dropping
--config-rootcarries no assertion about which commit it covered, which is exactly the hole the gate closes.A second reason the config alone is a poor source: it is read from the working tree, so a stale engine checkout pins a stale commit and the gate then refuses a correct audit. Measured while writing this:
~/wt/pm856-enginewas atb0ed2060e413whileorigin/mainalready pinned96593660718d.What
sha_matches()compares prefix-wise in both directions, so a 7-character sha copied out of a PR description names the same commit as git's 40-character one. Refusing that pair would make the gate fire on its own use case.--expect-sha says …versusthe pin in <file> says …— because "the pin is X" is ambiguous once there are two sources.--expect-shais refused with its own message rather than being compared as a string.Verified — an offline gpu-kernels-shaped repo, four paths
--expect-sha <its own sha>--expect-sha ffffffffffthis tree is at 7d63abfe239e, --expect-sha says ffffffffff--expect-sha zzz'zzz' is not a 7..40 character hex sha--config-root <engine>--self-testgains 6 cases forsha_matches, including "an empty expectation is not a wildcard" — the shape that would turn the gate into a no-op.Refs engine#2411 (the gate), engine#2406 (the instruction it implements), engine#2405 (the bump whose audit could not be asserted).