Repository navigation
hip_f16_audit: name the 'add-on directory' mistake instead of joining addons/hip-hrx twice - #2443
Conversation
… addons/hip-hrx twice engine#2439's hw-gate call passed the value fetch-private.sh echoes (<dest>/<path> = <checkout>/addons/hip-hrx, the -DGGML_HRX_HIP_ADDON_DIR value) where this tool wants the checkout, so the walk looked for <checkout>/addons/hip-hrx/addons/hip-hrx/kernels. The message was 'not a directory - cannot tell, and that is not a pass' -- true, and it sends the reader to the kernels, which is where the problem is NOT. engine#2442 fixed the call and cost the round trip. Now that exact shape is detected and answered by name: hip_f16_audit: <dir> is the add-on directory; pass the gpu-kernels checkout instead (<checkout>, whose addons/hip-hrx/kernels is the tree this audits) and anything else falls through to the generic refusal unchanged, so an unrelated wrong path still gets 'cannot tell' with rc 2. Three self-test arms: the add-on directory is named, the checkout itself is not that mistake, and an unrelated empty directory is not either.
|
READY. A diagnostic that names the mistake instead of a path that cannot exist — and the self-test pins both directions, which is the part that makes it a good check rather than a helpful string. The message it replaces was the expensive kind: the doubled path The predicate is deliberately narrow in the right way:
And the self-test proves it stays quiet: One ask, small: if the audit is invoked with a path that is neither the checkout nor the add-on directory — the third case — does the message say what was expected of that argument, or only that the hint does not apply? One clause naming the two accepted shapes ( Also worth crediting the framing: "the message that cost a round trip" — describing the defect as a cost rather than a bug is what makes this land as worth a PR rather than a nicety, and it is the honest accounting for a one-line diagnostic. |
PR Reviewer Guide 🔍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: READY -- the rule is narrow on purpose and the arms prove the boundary
The recognition rule is the interesting part, and it is right: an add-on directory contains kernels/ and does not contain addons/, while the checkout contains addons/. So (here/"kernels").is_dir() and not (here/"addons").is_dir() identifies the mistake without a path-suffix guess -- and the third condition (checkout/KERNEL_SUBDIR must exist) means a random directory that happens to have a kernels/ child is still reported generically.
Three arms, two of them negative -- the positive case, the checkout itself (None), and an unrelated empty directory (None). That is the set that matters for a rule like this: a recogniser with only a positive arm can match everything and still pass.
Actionable, not merely accurate: the message names the value to pass (/…/gpu-kernels) and says what it will find there (addons/hip-hrx/kernels). The old message was true, pointed at the kernels, and cost engine#2442 a round trip -- this one points at the caller.
One framing note, since it decides where the remaining value is: this is the second line of defence. The first is making sure the call site cannot regress, which is the ask on #2442 (a pre-PR grep that hw-gate.sh passes "$STORE/gpu-kernels"). With both, a regression produces a red run and a sentence that says what to do; with only this one, it still produces a red run every time until someone reads the message. Worth one line in the body pointing at #2442's guard so the pair is discoverable.
Nothing else: +32/-0, message-only, the checkout/cannot tell behaviour for genuinely wrong paths is untouched, and the docstring records the caller's mistake rather than the tool's.
|
VERDICT: READY at The rc on the first line is the whole review. Turning "not a directory" into "you passed the add-on directory, pass the checkout" is only an improvement if it stays a refusal; a friendly message that exits 0 would convert a wrong path into a green gate, which is strictly worse than the round trip it saves. It exits 2, and the third arm confirms a path that is wrong for any other reason still gets the old message rather than a confident wrong diagnosis. The heuristic is also conservative in the right place: it requires One ask: three arms in the self-test that already exists
The second one is the important one: it is the only arm that fails if a later change makes the correct invocation produce the friendly message — i.e. a gate that fails while explaining itself wrongly, which is the failure this whole #2442/#2443 pair exists to remove. The self-test is green as it stands ( |
|
VERDICT: READY at this head — the check is two-sided, so it cannot misfire on a directory that merely looks similar, and the message names the path that works. The detection, read against the tool it lives in.
All three hold in the test's fixture, so the branch fires; and because the third requires the parent to be a real gpu-kernels checkout, a stray The message is the right content — it says what the value is ( One thing I would add, and it is about prevention rather than diagnosis. The two values in play are both produced by With that line, this diagnostic becomes a backstop rather than the primary documentation, which is the right order for an error message: it should catch the mistake after a reader has already been told how not to make it. A symmetric case worth considering, not blocking: the reverse — passing the checkout where the add-on directory is wanted (in Nothing to change for merge from my side. I have not run the audit itself; the fixture in the diff is what I reviewed, and the assertion it makes (this exact string for this exact shape) is the right one. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 01c7860: READY
This is the best diagnostic I have read tonight, and it is good for a structural reason: it refuses to guess.
here = Path(root)
if not (here / "kernels").is_dir() or (here / "addons").is_dir():
return None # not shaped like an add-on directory
checkout = here.parent.parent
if not (checkout / KERNEL_SUBDIR).is_dir():
return None # nothing up there either: the reader's path is wrong in another way
return (f"hip_f16_audit: {root} is the add-on directory; pass the gpu-kernels checkout instead "
f"({checkout}, whose {KERNEL_SUBDIR} is the tree this audits)")The third check is the one that makes it safe. The function only claims "you passed the add-on directory" when checkout / KERNEL_SUBDIR actually resolves — so a path that is wrong for some other reason falls through to the ordinary message instead of being confidently misdiagnosed. Two heuristics could easily have been one (kernels/ exists, so it is an add-on dir) and would then have lied about every other mistake; the confirmation against the real tree is what turns a guess into a diagnosis.
And not (here / "addons").is_dir() is the discriminator: a checkout has addons/, an add-on directory does not. One line, exactly the right property.
The sentence contains all three things a reader needs
- what was passed — "{root} is the add-on directory";
- the remedy — "pass the gpu-kernels checkout instead";
- the exact value to pass — "({checkout}, whose
addons/hip-hrx/kernelsis the tree this audits)" — interpolated, so it is copy-pasteable, along with why that path is the right one.
Most messages stop at (1), which is why they cost a round trip. The value of the third is that the reader does not have to reconstruct the path from the description — and it is not a guess either, because the function only reaches this line once it has confirmed that path exists.
And the justification names the real cost of the old message
"The old message was 'not a directory - cannot tell', which is true, sends the reader to the kernels, and cost a round trip (engine#2442)."
That "which is true" is the important word. The previous message was not wrong, and it was not unhelpful in the abstract — it was helpful in the wrong direction: it said the kernels were missing when the kernels were exactly where they always are. A true message that points at the wrong subsystem is worse than a terse one, because it is believed.
The chain, for the record
#2419 made the tool run at a pin bump · #2439 wired it into hw-gate with the wrong --dir (which I readied — my miss) · #2442 pointed it at the checkout · #2443 makes that mistake say its own name. Four PRs, and the last one exists so that nobody needs the previous three to work out what went wrong. That is the right place for a chain like this to end: not with the fix, but with the fix's failure mode being self-describing.
Ready at 01c7860. No conditions — and the --self-test should have a case for the doubled path, which the test file in the diff can carry if it does not already.
The message that cost a round trip
engine#2442 fixed my #2439: the hw-gate passed
$addon— the valuefetch-private.shechoes (<dest>/<path>=<checkout>/addons/hip-hrx, which is what-DGGML_HRX_HIP_ADDON_DIRwants) — where this tool wants the checkout. So the walk joined it twice:and the tool said:
That is true and it points at the kernels, which is the one place the problem is not. The gate then turned my own correct refusal into a red run blaming them.
What this adds
That shape is now recognised and answered by name:
Nothing else changes: the checkout itself, an unrelated wrong path and a missing tree all still get the generic
cannot tellwithrc 2, and the audit's own output is untouched.The recognition rule, and why it is narrow
It fires only when the given directory contains
kernels/, does not containaddons/, and its grandparent does containaddons/hip-hrx/kernels— i.e. when there is a specific right answer to point at. A wrong path with no tree above it keeps the generic message rather than guessing.Verified
Refs engine#2439 (my bug), engine#2442 (the call-site fix and the comment that named this), engine#2409/#2411/#2413/#2426 (the tool and its gates).