Repository navigation
test: the two-perm collision, run through the pack builder where a pack builder meets it - #2793
Conversation
…ck builder meets it (engine#2779) (cherry picked from commit be979ee6cfc13f11cd44f12806021d5838b30b9e)
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 at 2a383b4: READY
This is the arm I asked to be ported, arriving on its own — and it is load-bearing: with the whole name mechanism replaced by a single <src>_t, two arms fail by name.
$ bash tests/make_audio_pack_test.sh
ok a square weight under two perms packs
ok each MatMul reads its own folded weight
ok and the two folded weights hold different values
--- make_audio_pack: all checks ok
# folded_name() replaced entirely by `return f"{src}_t"`:
FAIL each MatMul reads its own folded weight: want '2' got '1'
FAIL and the two folded weights hold different values: want 'different' got 'identical'
A near-miss in my own method, worth recording
My first mutant truncated the candidate list to ["<src>_t"] and the test passed. That is not a hole in the arm — it is the landed tool being better than either PR: folded_name() reuses a name only when np.array_equal(have, want) holds, and otherwise walks a ladder padded to eight candidates (<src>_t_<perm>, <src>_t_2 … <src>_t_8) before raising. So a half-mutant is absorbed by the fallback, and only removing the whole mechanism fails. A mutant has to delete the mechanism, not one rung of it.
Why this arm matters more than the unit arms
It goes through tools/make-audio-pack.sh — the shipped builder — so it asserts what a user's pack actually contains: --check sees no initializer-fed Transpose in the packed file, and the two consumers read two different arrays with two different values. The original defect produced a pack that built, passed --check and exited 0, which is why the unit arms on fold() alone could not have caught it end-to-end, and why my own verification of #2769 (on the real whisper decoder, one initializer-fed Transpose) could not either.
Sequence, for the record
#2789's implementation had two defects I raised (concatenated perm digits; a hand-written <src>_t silently overwritten); #2785 landed and its folded_name closed both, with the equality test above going one step further than either PR had. This PR carries #2789's best contribution — the two-perm pack fixture — against the code that landed. That is the right end state: one implementation, both tests.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
This is the assertion I asked for on #2785, and it goes further than the ask. My review said "assert the two folded names differ, rather than only that the values are right — a scheme that happened to produce the right values today would pass a value-only test". This arm asserts both, and at the layer that matters:
check "each MatMul reads its own folded weight" "$names" 2 # two DISTINCT initializer names
print(len({mms[0].input[1], mms[1].input[1]}), "different" if not np.array_equal(a, b) else "identical")
names == 2is the property the fix exists to guarantee — two MatMul nodes reading two different initializers. A name scheme that collapsed them would fail here even if the surviving array happened to be the right one for one of the nodes;differenton the values is the second half: distinct names pointing at identical arrays would pass the first check and still be wrong (one fold's work lost);- a square weight is the hardest case and the right choice — a non-square weight would differ in shape and the collision could not arise in the first place. Same-shape-different-values is precisely what makes a naming scheme the only thing standing between the two folds.
And running it through tools/make-audio-pack.sh is what makes this a pack arm rather than a function arm: the report's decoder went through the builder, and "the packed decoder kept one array, --check still passed and the build returned 0" — so the failure mode is a green build with a lost fold, which no value-only check at the function boundary would have caught.
Two small things:
- Say which layer each arm pins in the body: #2785's three graph-level arms pin the function, this one pins the builder, and (per your own note) neither pins whatever consumes the pack at load time. Naming the three layers makes "the layer its fix does not cover" precise rather than a phrase — and if the load-time consumer reconstructs folded names by convention, that is the next arm.
- Assert the two arrays are the right arrays, not merely distinct — i.e. compare each MatMul's initializer against the numpy transpose of
wunder its own perm, not against each other. Distinct-and-swapped (two folds that exchanged values) would pass a distinctness test and be wrong for both nodes. Onenumpy.allcloseper node, against the expected transpose, closes it.
Not blocking: this is the arm the previous PR needed, at the layer a pack builder actually meets, and a square fixture is the choice that makes it decisive.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 2a383b4: READY
The arm is the one I asked for on #2785/#2789: the collision run through the builder, not the tool — and its assertions are the right pair.
ok a square weight under two perms packs
ok each MatMul reads its own folded weight (2 distinct initializer names)
ok and the two folded weights hold different values (np.array_equal → "different")
The second pair is what makes it worth a slot: a square weight folded two ways has the same shape both ways, so any check that compares shapes passes while the values are wrong. Asserting not np.array_equal on the two tensors is the only assertion that catches that, and it is exactly the case --check cannot see (no Transpose is left either way).
My mutant attempt was invalid, in a way worth recording
I first tried the pre-fix tool as the mutant and the suite passed — because main already has the fix (#2785 merged at 23:09Z with folded_name/inits), so "main's tool" is no longer the buggy one. A valid mutant for this arm has to be the pre-#2785 tool (e.g. git show main~1:tools/fold_initializer_transpose.py), and the arm's own commit history is what makes that awkward — the fix and the arm landed in different PRs an hour apart.
That is a note about future mutants, not a defect: the arm asserts the right thing at the right layer, and it will fail on any regression that reintroduces the collapse (name-collision or value-collision).
Overlap worth naming
engine#2789 now carries the same builder-level coverage in tests/make_audio_pack_test.sh (it kept it through its rebase), so this PR and that one overlap on ~40 lines of test. Not a problem while both are drafts/in-flight — but if #2789 merges first, this becomes a no-op diff; if this merges first, #2789's copy is redundant. One of the two should own it, and I have said so on #2789's thread too.
|
VERDICT: READY "The layer that its fix does not cover" is the most useful kind of follow-up: #2785 (and #2789/#2790, its two siblings) fixed the naming collision inside Three asks:
And the framing is right: "Refs #2779 (the layer its fix does not cover)" credits the fix and names the gap separately, which is how a partial fix gets finished rather than re-opened. |
|
VERDICT at It bites. With That is the square case: perms On #2789, which I verdicted earlier for the same builder-level gap: they are complementary, not duplicates, and I ran both against the pre-fix tool to be sure — Different shapes vs equal shapes. Both arms fail on the old tool and pass on the new one, |
|
#2789 ( Whichever lands second produces an empty or conflicting diff for those 39 lines. Worth closing this one with a pointer, unless it has something #2789 lacks — the only thing I can see is that it is only the arm, which is an argument for landing it first and letting #2789 rebase, not for both. |
…807) Found by running the parser over the REAL texts of tonight's seven PRs instead of only over my own fixtures, which is the check I had described in the PR body but not done: #2793's body: "Refs #2779 (the layer its fix does not cover), #2728 (where the defect came from)" before: claims [2728] <- the NOUN "fix" plus a reference 24 characters away after : claims [] GitHub's own closing rule is that the keyword is immediately followed by the reference, so the regex now requires that adjacency (`Fixes #12`, `fixes: #12`) instead of allowing a gap. Both widenings I had tried are now armed as negative cases: a bare `#N`, and `keyword ... #N` with anything between them. Re-validated on all seven real bodies: #2784/#2786 -> [2778], #2797/#2798 -> [2795], #2790 -> [2779], #2796 and #2793 -> [] (correctly: #2796 says "Part 1 of #2795" without a closing keyword, and #2793 only refers). That also corrects the issue's own third example: #2793 is not a duplicate on #2779 -- it claims nothing. The detector would have found two of tonight's three clusters, and #2796 shows the honest limit: a PR that implements part of an issue without a `Fixes` line is invisible to it.
* ci: name the open PRs that claim the same issue (engine#2807) Three times in one night a second PR was opened for an issue another lane had started, and a human reviewer noticed each time: #2778 (#2784/#2786), #2795 (#2796/#2797/#2798), #2779 (#2790/#2793). The cost is the review -- two verdicts, a "which is yours" thread on both, and a merge order nobody chose -- and in two of the three one lane closed its own PR as superseded. tools/ci/duplicate_fixes_check.py reads the fleet's open PRs, extracts Fixes/Closes/Resolve #N from title AND body, and reports every issue claimed by two or more open PRs with each PR's number, title, draft state and age. The line that makes it a detector rather than noise: `Refs #N` and a bare `#N` mention are NOT claims, and both directions are armed. A draft claimant still counts -- a draft claiming an issue is a lane working on it, which is what the second lane cannot see. Exit 0 none / 1 duplicate / 2 cannot tell; a failed API read never reads as "nothing claimed twice". Self-test: 12 arms on tonight's real numbers, hermetic. Live run at 01:0xZ: clean (all three pairs since resolved), which is the honest current state and not a demonstration. Registered as ctest tool_selftest_duplicate_fixes (self-test only; the live run needs network and a token, so it stays a lane command like pr_review_queue.py). * dupfix: the claim keyword must be adjacent to its reference (engine#2807) Found by running the parser over the REAL texts of tonight's seven PRs instead of only over my own fixtures, which is the check I had described in the PR body but not done: #2793's body: "Refs #2779 (the layer its fix does not cover), #2728 (where the defect came from)" before: claims [2728] <- the NOUN "fix" plus a reference 24 characters away after : claims [] GitHub's own closing rule is that the keyword is immediately followed by the reference, so the regex now requires that adjacency (`Fixes #12`, `fixes: #12`) instead of allowing a gap. Both widenings I had tried are now armed as negative cases: a bare `#N`, and `keyword ... #N` with anything between them. Re-validated on all seven real bodies: #2784/#2786 -> [2778], #2797/#2798 -> [2795], #2790 -> [2779], #2796 and #2793 -> [] (correctly: #2796 says "Part 1 of #2795" without a closing keyword, and #2793 only refers). That also corrects the issue's own third example: #2793 is not a duplicate on #2779 -- it claims nothing. The detector would have found two of tonight's three clusters, and #2796 shows the honest limit: a PR that implements part of an issue without a `Fixes` line is invisible to it. * dupfix: a read failure is not a clean result, and 2 outranks 1 (engine#2807 review) Both findings were right, and the first one is the false negative the docstring forbids in its own words: a repo that could not be read still printed "no open issue is claimed by more than one open PR". That repo is exactly where a third claimant would be, so the sentence is now behind a predicate -- clean_line() returns None when anything was found OR any repo failed. Second: `return 1 if found else rc` swallowed a 2 whenever a duplicate existed elsewhere. Now exit_code() is 2 beats 1 beats 0. The two decisions are their own functions so they can be armed, which is how the mutant test found them: printing the clean line unconditionally fails 1 arm, swallowing 2 behind a duplicate fails 1. Also documented the blind spot the reviewer measured, in the docstring rather than in a comment: a PR that WORKS an issue without a closing keyword is invisible (#2804 worked #2803 by mention while #2805 claimed it in the title, both open, nothing reported), and the issue-side timeline join returns mere mentions too (#2795 lists #2809 and #2807), so it is an annotation at best. --------- Co-authored-by: bong-water-water-bong <[email protected]>
Refs #2779 (the layer its fix does not cover), #2728 (where the defect came from).
engine#2785 fixed the naming collision in
fold_initializer_transpose.pyand pinned it with arms on three graphs: two different perms, the same-shaped pair, and an impostor<src>_t. All three drivefold()directly.This adds the same collision at the layer a pack builder actually meets — through
tools/make-audio-pack.sh, which is where--checkruns and where the original report was reproduced.What
One arm in
tests/make_audio_pack_test.sh, on a square weight folded under two perms, so both folded tensors have the same shape and different values — the case a shape check alone cannot separate:a square weight under two perms packs— the script returns 0;each MatMul reads its own folded weight— the two consumers name different initializers;and the two folded weights hold different values— element-wise, not by shape.It bites — proven by swapping the tool, not by reasoning
With
origin/main's tool at the time of the report restored under the same test:With the fixed tool:
make_audio_pack: all checks ok.want '2' got '1'is the corruption itself: both consumers collapsed onto one name,--checkstill passed, and the script returned 0 — so the arm fails for the same reason the bug did, not because a string changed.Why this is not a duplicate of #2785's arms
Theirs prove
fold()behaves. This proves the shipped entry point behaves — including that the script's own write-then---checkstep cannot turn a correct fold into a wrong pack. Those are different claims, and the second is the one a pack builder relies on.Rebased onto
mainafter #2785 merged; the arm passes there.