Repository navigation
Commit a08ffd1
test: make the MoE fixture actually test nesting, and fix two harness faults (#145)
Review follow-ups on #143/#144. All three findings were in code I wrote.
**The MoE fixture tested nothing it claimed.** It used `qwen3_moe`, whose Swift
configuration decodes from the root of config.json, so the expert count had to be
at the top level; the nested copy underneath was never reached, because
findExpertCounts is breadth-first and returns on the first hit. Both advertised
properties — the nesting, and the `vision_config` decoy that "must not be
mistaken" — were dead weight. Deleting the nested walk entirely would not have
failed it.
Rebuilt on `gemma4`, whose Gemma4Configuration decodes `text_config` and nothing
else, so the count exists only one level down and the decoy is genuinely reached.
`gemma4` also contains no "moe", so modelTypeImpliesMoE cannot rescue it — which
is what made the qwen3_moe version untestable.
Red-green verified, the check the previous version could not pass: reverting
detection to the pre-#114 top-level single-key form fails the new assertion, and
restoring it passes. The fixture now reproduces #112.
The assertion also moved to the right gate. There are two: a config-level MoE
check, and a model-level StreamableMoE conformance check. gemma4 passes the first
and legitimately declines the second, so asserting "streaming enabled" would have
tested the wrong thing. It now asserts only that detection did not reject.
Incidentally covers the fused-expert remap — real gemma4 checkpoints ship
`experts.gate_up_proj` as one tensor that sanitize splits into
`switch_glu.gate_proj`/`up_proj`. A wrong split axis is a silent numerical fault.
**Two harness faults.**
cleanup() killed the server without waiting, and the readiness loop probed health
before checking liveness. If a teardown outlived the 1s sleep, the next fixture
would fail to bind, and its first probe would be answered by the previous
server — assertions then run against the wrong checkpoint and report a false
pass, not a flake. cleanup now waits, and liveness is checked first.
The generator wrote into existing directories without clearing them, so files a
builder stopped emitting survived and the fixture kept testing a shape the source
no longer described. Each fixture's own directory is now cleared first — scoped to
one known directory, which is also what keeps regeneration away from siblings
like tests/fixtures/omni, whose assets belong to test-omni.sh.
Suite: 6 passed, 0 failed, twice consecutively.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent 664a05d commit a08ffd1
4 files changed
Lines changed: 139 additions & 84 deletions
File tree
- scripts
- tests
- fixtures/moe-nested
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
230 | 231 | | |
231 | 232 | | |
232 | 233 | | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| 254 | + | |
254 | 255 | | |
255 | 256 | | |
256 | 257 | | |
257 | | - | |
| 258 | + | |
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
261 | 262 | | |
262 | 263 | | |
263 | 264 | | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
| 265 | + | |
269 | 266 | | |
270 | 267 | | |
| 268 | + | |
271 | 269 | | |
272 | | - | |
| 270 | + | |
| 271 | + | |
273 | 272 | | |
274 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
275 | 293 | | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | 294 | | |
281 | 295 | | |
282 | 296 | | |
283 | | - | |
284 | | - | |
285 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
286 | 302 | | |
287 | 303 | | |
288 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
289 | 307 | | |
290 | 308 | | |
291 | 309 | | |
292 | 310 | | |
293 | 311 | | |
294 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
295 | 317 | | |
296 | 318 | | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
304 | 335 | | |
305 | 336 | | |
306 | 337 | | |
| |||
319 | 350 | | |
320 | 351 | | |
321 | 352 | | |
322 | | - | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
323 | 363 | | |
324 | 364 | | |
325 | 365 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
15 | 6 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | 7 | | |
21 | | - | |
| 8 | + | |
22 | 9 | | |
23 | 10 | | |
24 | 11 | | |
25 | 12 | | |
26 | 13 | | |
27 | 14 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 15 | + | |
33 | 16 | | |
34 | 17 | | |
| 18 | + | |
35 | 19 | | |
36 | | - | |
| 20 | + | |
| 21 | + | |
37 | 22 | | |
38 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
39 | 34 | | |
40 | 35 | | |
41 | | - | |
| 36 | + | |
42 | 37 | | |
43 | 38 | | |
44 | 39 | | |
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
39 | 48 | | |
40 | 49 | | |
41 | 50 | | |
| |||
52 | 61 | | |
53 | 62 | | |
54 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
55 | 68 | | |
56 | 69 | | |
57 | | - | |
58 | 70 | | |
| 71 | + | |
59 | 72 | | |
60 | 73 | | |
61 | 74 | | |
| |||
97 | 110 | | |
98 | 111 | | |
99 | 112 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
105 | 127 | | |
106 | 128 | | |
107 | 129 | | |
108 | 130 | | |
109 | 131 | | |
110 | 132 | | |
111 | | - | |
112 | 133 | | |
| 134 | + | |
113 | 135 | | |
114 | 136 | | |
115 | 137 | | |
116 | 138 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 139 | + | |
| 140 | + | |
121 | 141 | | |
122 | | - | |
| 142 | + | |
123 | 143 | | |
124 | 144 | | |
125 | 145 | | |
| |||
0 commit comments