Commit 5be8f6a
committed
Restore CI coverage for hook argv expansion and preflight blocking
The hook escaping regression came from asserting a literal `node` prefix even
though installed hooks may be patched to an absolute node binary. The test now
captures argv after shell expansion instead of accidentally invoking the real
runner, and the pre-tool enforcer now sanitizes malformed threshold env input so
agent-heavy exhausted-context preflight keeps blocking deterministically. The
remaining CI flakes came from ambient test-process state leaking into the
pre-tool harness (env kill-switches, cwd/config, and child_process mocking) plus
a tmux-availability assumption in the duplicate-worker dispatch test, so those
assertions are now hermetic and environment-agnostic.
Constraint: Installed hooks may start with an absolute quoted node path after plugin setup
Constraint: Pre-tool tests must not inherit hook kill-switches, Claude config, or mocked child_process state from the surrounding test runner
Constraint: Duplicate-worker dispatch coverage must not require tmux to be available
Rejected: Keep assuming a literal `node` prefix in hook tests | no longer matches shipped hook shape
Rejected: Leave malformed threshold env unchecked | comparison against NaN silently disables blocking
Rejected: Assert immediate `notified` dispatch state in the duplicate-pane test | depends on tmux availability outside the test contract
Confidence: high
Scope-risk: narrow
Directive: Keep hook argv assertions focused on post-shell tokenization, not a specific node binary spelling
Directive: Keep shell-spawned hook tests pinned to isolated HOME/CLAUDE_CONFIG_DIR values, cleared skip flags, isolated child cwd, and direct execFile child_process access so ambient state cannot leak in
Tested: npm test -- --run src/__tests__/pre-tool-enforcer.test.ts
Tested: npm test -- --run src/__tests__/pre-tool-enforcer.test.ts src/team/__tests__/api-interop.dispatch.test.ts src/__tests__/hooks-command-escaping.test.ts
Tested: npm test -- --run
Tested: npm run build
Tested: npm run lint
Not-tested: PR CI rerun on GitHub after push1 parent 85b12bd commit 5be8f6a
File tree
4 files changed
+107
-23
lines changed- scripts
- src
- __tests__
- team/__tests__
4 files changed
+107
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | 94 | | |
96 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
97 | 104 | | |
98 | 105 | | |
99 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
12 | 29 | | |
13 | 30 | | |
14 | 31 | | |
| |||
31 | 48 | | |
32 | 49 | | |
33 | 50 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
51 | 56 | | |
| 57 | + | |
52 | 58 | | |
53 | 59 | | |
54 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
5 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
6 | 10 | | |
7 | 11 | | |
8 | 12 | | |
| |||
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
17 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
18 | 25 | | |
19 | 26 | | |
20 | 27 | | |
21 | 28 | | |
22 | 29 | | |
| 30 | + | |
| 31 | + | |
23 | 32 | | |
| 33 | + | |
| 34 | + | |
24 | 35 | | |
25 | 36 | | |
| 37 | + | |
26 | 38 | | |
27 | 39 | | |
28 | 40 | | |
| |||
377 | 389 | | |
378 | 390 | | |
379 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
380 | 451 | | |
381 | 452 | | |
382 | 453 | | |
| |||
392 | 463 | | |
393 | 464 | | |
394 | 465 | | |
395 | | - | |
396 | 466 | | |
397 | 467 | | |
398 | 468 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
| 210 | + | |
210 | 211 | | |
211 | 212 | | |
0 commit comments