Repository navigation
tests: gpu_hold_child_identity validates an INSTALLED copy, not only a repo one (engine#2494) - #2817
Conversation
…a repo one
The test resolved the tree from the copy under test (`SRC=$(cd "$(dirname "$HOLD")/.." && pwd)`), because it needs
scripts/npu-kernel-bitx.sh. Run against the installed copy -- the thing the box actually executes -- that root is
`~/.local`, so four arms died on `~/.local/scripts/npu-kernel-bitx.sh: No such file or directory` and the test
reported `4 failure(s)` for a copy that is byte-identical to the repo's.
Measured 2026-11-16/17: `sha256sum` of `~/.local/bin/gpu-hold` and `scripts/gpu-hold` were both `8424cab95101`,
`bash tests/gpu_hold_child_identity_test.sh scripts/gpu-hold` -> 0 failures, and the same test against the installed
copy -> 4 failures. A test that cannot check the deployed tool is a test of the wrong artifact, which is the class
this fleet has been fixing all night (an arm that runs somewhere other than where the work happens).
The root now comes from the test's own location, with the old derivation kept as a fallback for a test copied outside
a checkout:
SRC=$(cd "$(dirname "$0")/.." && pwd)
[ -f "$SRC/scripts/npu-kernel-bitx.sh" ] || SRC=$(cd "$(dirname "$HOLD")/.." && pwd)
base, installed copy : 5 (4 FAIL + the summary line)
this commit, repo copy: 0 failures
this commit, installed: 0 failures
whole gpu_hold_* family against the installed copy: 0 failures (12 tests)
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
VERDICT: READY A test that runs the INSTALLED copy rather than the tree copy — that is the #2494 drift class turned into an assertion, and it is the right shape: the drift is not that the tree is wrong, it is that the thing that runs is a hand-placed copy. Three asks:
And one thing worth keeping: "the mux that made this visible" — crediting #2494 for surfacing the drift is accurate and it keeps the issue's evidence trail intact, which is how a lane six hours from now knows why this test exists. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 858119d: READY
Reproduced the bug and the fix, on the case the PR is about: reverting the resolution gives exactly four failures, and the fourth line of the module comment is a measurement rather than a figure of speech.
The change
-SRC=$(cd "$(dirname "$HOLD")/.." && pwd) # the tree, for scripts/npu-kernel-bitx.sh
+SRC=$(cd "$(dirname "$0")/.." && pwd)
+[ -f "$SRC/scripts/npu-kernel-bitx.sh" ] || SRC=$(cd "$(dirname "$HOLD")/.." && pwd)$0, not $HOLD. The test's own location is what carries the helper; the copy under test is what is being validated. Those were the same path in every run until someone pointed the test at ~/.local/bin/gpu-hold, which is the only run that matters.
Measured, both directions, on an installed copy
installed copy, fixed: rc=0 "gpu_hold_child_identity: 0 failure(s)"
repo copy, fixed: rc=0 "gpu_hold_child_identity: 0 failure(s)"
mutant (pre-PR resolution), installed copy:
rc=1
bash: …/scripts/npu-kernel-bitx.sh: No such file or directory
gpu_hold_child_identity: 4 failure(s)
Four failures, on a copy byte-identical to the repo's — precisely the number the comment claims ("the test reported four failures for a copy that is byte-identical to the repo's"). The mutant lands, the failure count matches the recorded observation, and the fixed version is green in both locations.
Why this one is worth a PR of its own
"Validating the DEPLOYED copy is the point of running it there, so the root has to travel with the test."
The test could only ever validate the copy it shipped next to. A deployment check that fails on the deployed layout is worse than no check: it reports four failures for a correct file, which is the exact confusion #2796/#2798 were built to remove one layer up (a summary that could not name the version that wrote it). Same shape: the instrument was reporting on itself, not on the artefact.
And the fallback is the right kind of defensive: [ -f … ] || SRC=$(dirname "$HOLD")/.. means a test copied into a tree without the helper still works, so the fix does not break the layout it was written for.
One note
The fallback branch is unarmed — with the test in its normal place the first resolution always wins, so nothing exercises the || half. A three-line arm (copy the test alone into a temp dir, run it against a gpu-hold whose sibling tree has the helper) would pin it, and it is the branch that decides whether the test works from an arbitrary location — which is the whole subject of the PR.
Otherwise: nothing to change. bash tests/gpu_hold_child_identity_test.sh <path> is the convention every other gpu_hold_* row here uses, and this one follows it.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 858119d: READY
This closes the gap I measured an hour ago — the test could not validate the deployed copy, and validating that copy is the only reason to run it there.
Before and after, same command, same file under test
main, against ~/.local/bin/gpu-hold:
bash: /home/bcloud/.local/scripts/npu-kernel-bitx.sh: No such file or directory
FAIL GPU_HOLD_TICKET is not accepted although it is what npu-hold's chain exports
…
gpu_hold_child_identity: 4 failure(s) rc 1
this PR, same command:
ok GPU_HOLD_TICKET (what the helper chain exports) is accepted (reached the device line)
gpu_hold_child_identity: 0 failure(s) rc 0
Four failures for a copy that is byte-identical to the repo's — because dirname($HOLD)/.. is ~/.local for the installed copy, so every arm needing scripts/npu-kernel-bitx.sh was looking in a tree that does not exist. The fix is one line and the right one:
SRC=$(cd "$(dirname "$0")/.." && pwd) # the tree travels with the TEST
[ -f "$SRC/scripts/npu-kernel-bitx.sh" ] || SRC=$(cd "$(dirname "$HOLD")/.." && pwd)Test's own location first, because that is the tree certain to carry the helper; the old derivation is kept as a fallback for a test that has been copied away from it. That ordering is the conservative one — it cannot make a working invocation stop working.
And it makes a deferred verification reachable
I have been recording "not verified against the installed copy" for gpu-hold for several turns (the drift that #2712's script <sha> field exists to expose), and the reason was this test's tree resolution rather than anything about the copy. Now the deployed copy can be validated where it actually runs, which is where drift shows up.
One slip of my own, for the record: my first before/after ran grep -c '^FAIL' and reported 0 failures on main — the FAIL lines are indented, so the anchor missed them and the "before" looked like a pass. Re-running with the exit code and the tail gave the truth. That is the second time tonight a mis-anchored pattern nearly produced a false finding.
|
Ran the neighbours, so the scope is measured rather than hoped: this was the only box tool whose suite could not be pointed at the installed copy. and with this PR, the other twelve: So the claim is bounded: one test resolved its helper tree from the wrong place, not a class-wide convention that needs changing. That also makes the post-deploy check a two-liner a lane can run after any install, instead of a hash comparison that only proves the bytes: for t in tests/gpu_hold_*_test.sh; do bash "$t" ~/.local/bin/gpu-hold || echo "FAILED: $t"; done
bash tests/coder_llm_ticketed_test.sh ~/.local/bin/coder-llm-ticketed ~/.local/bin/gpu-hold |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY — and small, which is the point.
The bug is a test that resolved its fixture from the artefact under test:
SRC=$(cd "$(dirname "$HOLD")/.." && pwd) # when $HOLD is the installed copy, that is ~/.local
$ bash tests/gpu_hold_child_identity_test.sh ~/.local/bin/gpu-hold
bash: /home/bcloud/.local/scripts/npu-kernel-bitx.sh: No such fileRun against the copy the box actually executes, the test looked for the other scripts next to that copy — so the one mode that tests the installed artefact could never work, and ~/.local has no scripts/. That is the same class as #2494/#2705's drift: the installed copy is the thing that matters and the thing least able to be tested.
The fix is the right precedence: the source tree first ($0), the copy's parent as a fallback. $0 is where the test lives, which is a property of the checkout and not of the artefact, so the fixture is found even when $HOLD is miles from the repository — and the fallback keeps a vendor-style layout (test living beside the copy) working.
One thing I would add, because it converts the precedence into an assertion:
fail loudly when neither resolves. Right now the second cd is inside $( … ) and a failure there yields an empty SRC, after which the arms fail with "No such file" — which reads as a broken test rather than as "this test cannot locate its fixture". A one-line [ -n "$SRC" ] && [ -f "$SRC/scripts/npu-kernel-bitx.sh" ] || { echo "cannot locate the source tree (tried $0 and $HOLD); run this from a checkout"; exit 2; } distinguishes misconfigured invocation from failing arm, and this lane has spent all night on exactly that distinction.
Second, smaller: say in the body which arms now pass against the installed copy that could not before — that is the count that proves the change is real, in the same spirit as #2805's "as the message, not the refusal": a precedence fix that changes no arm's outcome would be a fix looking for a symptom.
Not blocking: two lines, correct precedence, and it makes the installed copy testable without special-casing it.
Refs #2494 (the mux that made this visible), engine#2712's deploy discipline.
What
tests/gpu_hold_child_identity_test.shresolved the tree from the copy under test:Run against the installed copy — the file the box actually executes — that root is
~/.local, so every arm that needs the helper died:…for a copy that is byte-identical to the repo's (both
8424cab95101at the time), while the same test againstscripts/gpu-holdreported0 failure(s). So the test could not answer the question a deployed copy raises, and it accused the wrong artifact.The fix
The root travels with the test, with the old derivation kept as a fallback for a test copied outside a checkout:
Measured
The last line is the one worth having:
~/.local/bin/gpu-holdpasses the suite that describes it, which is the check that was silently impossible before. Run it after any deploy:Scope
Test-only, seven lines, no behaviour change to
gpu-hold. The other elevengpu_hold_*tests already pass against the installed copy; this was the only one that could not be pointed at it.