Commit fd5abed
test: stop CLI-spawn timeouts from flaking the release gate (#114)
Four tests failed intermittently under parallel load while passing in ~0.6s
idle. All the same cause: a spawn bound sized for an unloaded machine.
cli: franklin task tail reconciles stale queued tasks 5045ms (bound 5000)
cli: franklin task cancel <runId> kills running task 5841ms (bound 5000)
cli: franklin task wait reconciles stale queued tasks 5048ms (bound 5000)
franklin skills --json emits a parseable structure 8037ms (bound 8000)
The durations were the bound firing, not the work taking that long — the same
tests run in ~640ms when the machine is idle. `node dist/index.js` boots the
whole CLI (config load, MCP discovery, wallet init) before the subcommand runs,
and that startup balloons under concurrency.
Three things were wrong beyond the number:
1. The failures were undiagnosable. On timeout spawnSync returns status:null
with empty stderr, so `assert.equal(result.status, 0, result.stderr)` printed
"null !== 0" and named nothing. First time I hit this I could not tell what
had failed. assertCliExit() now says it exceeded the bound and that a loaded
machine is the likely cause.
2. skills.local.mjs had two bounds fighting: runCli defaulted to 8000ms while
the tests around it declared { timeout: 15_000 }, so the inner one always
won and the declared one never applied. Two call sites had already been
patched to timeoutMs: 15_000 individually — the usual sign that the default,
not the call site, is what's wrong.
3. One test told the CLI `--timeout 10000` under a 5000ms spawn bound, so the
harness would have killed the process before the behaviour under test could
finish. It only passed because the task goes 'lost' almost immediately.
Both files now use CLI_SPAWN_TIMEOUT_MS = 20_000, matching what test/local.mjs
already used for its other CLI-spawning tests ({ timeout: 20_000 }); 5s and 8s
were the outliers.
A flaky test in a release gate is worse than a slow one: it teaches you to wave
the next real failure past as "just that one again". Verified with two suites
running concurrently — the condition that produced the original failures —
636 pass on both.
Co-authored-by: 1bcMax <195689928+1bcMax@users.noreply.github.com>1 parent ee00e2a commit fd5abed
2 files changed
Lines changed: 57 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7625 | 7625 | | |
7626 | 7626 | | |
7627 | 7627 | | |
| 7628 | + | |
| 7629 | + | |
| 7630 | + | |
| 7631 | + | |
| 7632 | + | |
| 7633 | + | |
| 7634 | + | |
| 7635 | + | |
| 7636 | + | |
| 7637 | + | |
| 7638 | + | |
| 7639 | + | |
| 7640 | + | |
| 7641 | + | |
| 7642 | + | |
| 7643 | + | |
| 7644 | + | |
| 7645 | + | |
| 7646 | + | |
| 7647 | + | |
| 7648 | + | |
| 7649 | + | |
| 7650 | + | |
| 7651 | + | |
| 7652 | + | |
7628 | 7653 | | |
7629 | 7654 | | |
7630 | 7655 | | |
| |||
7645 | 7670 | | |
7646 | 7671 | | |
7647 | 7672 | | |
7648 | | - | |
| 7673 | + | |
7649 | 7674 | | |
7650 | | - | |
| 7675 | + | |
7651 | 7676 | | |
7652 | 7677 | | |
7653 | 7678 | | |
| |||
7683 | 7708 | | |
7684 | 7709 | | |
7685 | 7710 | | |
7686 | | - | |
| 7711 | + | |
7687 | 7712 | | |
7688 | | - | |
| 7713 | + | |
7689 | 7714 | | |
7690 | 7715 | | |
7691 | 7716 | | |
| |||
7722 | 7747 | | |
7723 | 7748 | | |
7724 | 7749 | | |
7725 | | - | |
| 7750 | + | |
7726 | 7751 | | |
7727 | | - | |
| 7752 | + | |
7728 | 7753 | | |
7729 | 7754 | | |
7730 | 7755 | | |
| |||
7756 | 7781 | | |
7757 | 7782 | | |
7758 | 7783 | | |
7759 | | - | |
| 7784 | + | |
7760 | 7785 | | |
7761 | | - | |
| 7786 | + | |
7762 | 7787 | | |
7763 | 7788 | | |
7764 | 7789 | | |
| |||
7828 | 7853 | | |
7829 | 7854 | | |
7830 | 7855 | | |
| 7856 | + | |
| 7857 | + | |
| 7858 | + | |
| 7859 | + | |
| 7860 | + | |
7831 | 7861 | | |
7832 | | - | |
| 7862 | + | |
7833 | 7863 | | |
7834 | | - | |
7835 | | - | |
| 7864 | + | |
7836 | 7865 | | |
7837 | 7866 | | |
7838 | 7867 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
25 | 37 | | |
26 | 38 | | |
27 | 39 | | |
| |||
34 | 46 | | |
35 | 47 | | |
36 | 48 | | |
37 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
38 | 53 | | |
39 | 54 | | |
40 | 55 | | |
| |||
0 commit comments