Commit a549315
feat: abort throttled test runs + improve RUN_IN_PROGRESS recovery (#5)
* docs: add spec for throttle detection + abort
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: add implementation plan for throttle detection + abort
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat: add run:aborted event type and maxTestDurationMs option
* feat: expand RUN_IN_PROGRESS error with recovery guidance
* feat: add RunMonitor type + skeleton factory
* feat: implement runMonitor threshold detection
* test: pin runMonitor threshold boundary + document non-positive disable
Code review surfaced that the exact-threshold case (duration === thresholdMs)
was untested, and the JSDoc only mentioned "0 disables" even though the
implementation treats any non-positive value the same way. Add a boundary
test and tighten the comment.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat: wire runMonitor into browser client for throttle-based abort
* fix: paint favicon fail on abort tick + prune monitor state on runner crash
Code review surfaced two issues:
1. The abort-tick sent run:complete over the wire but left the favicon
showing 'running' until the (possibly hung) runner promise resolved.
Paint 'fail' in the tick so the tab indicator matches the wire
immediately.
2. A runner crash left monitor.currentTest populated, so a subsequent
threshold check could read stale in-flight state. Call
monitor.onTestEnd() in the catch block.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: pin maxTestDurationMs forwarding and run:aborted broadcasting
* feat: CLI --max-test-duration flag + run:aborted handler
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix: detect throttling via onTestEnd + lower default threshold to 5s
Smoke-testing surfaced the flaw: tests under throttling cluster in the
4-8s band per test — individually under the 10s threshold. The heartbeat
tick (3s interval) was the only detector, so tests that completed between
ticks slipped through. Result: a 1s run stretched to 27s with no abort.
Two fixes:
- RunMonitor.onTestEnd() now returns breach info if the just-ended test
exceeded threshold. createBrowserClient calls fireAbort() on that
breach from the onPass/onFail/onSkip callbacks — catches every
completed test, not just those still running at a heartbeat boundary.
- Default threshold lowered from 10000ms to 5000ms. 5s is still 5-10×
slower than any real TWD test and matches the observed per-test
duration under Chrome's background throttling.
Also refactored the abort block into a shared fireAbort() helper used by
both the heartbeat tick and the new onTestEnd breach path.
Spec updated to reflect the two-pronged detection design.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: document run:aborted threshold and RUN_IN_PROGRESS recovery
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 7cba63d commit a549315
13 files changed
Lines changed: 1872 additions & 24 deletions
File tree
- docs/superpowers
- plans
- specs
- src
- browser
- cli
- relay
- tests
- browser
- relay
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
82 | 97 | | |
83 | 98 | | |
84 | 99 | | |
| |||
0 commit comments