feat: fail-fast early bail + durable partial results#12
Merged
Conversation
Chunked, Node-driven execution so the CLI can stop after N failures (maxFailures, default 10) and never lose results on a timeout/crash. twd-cli-only; no twd-js changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Accumulate results in Node per chunk instead of one whole-suite page.evaluate. Behavior-preserving; sets up early-bail and durable partial results. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bail out of the chunk loop once total failures reach maxFailures, report the Not-run count and banner, and skip contract validation on the incomplete run. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Accumulate results in Node-visible state so a mid-run protocolTimeout or crash surfaces the tests that completed instead of discarding the whole run. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Address final-review findings: dedupe accumulated results by id so a describe.skip suite spanning multiple chunks is not counted skipped more than once; avoid a '0 test(s) were not run' early-stop banner; clarify the coverage-skip note in CLAUDE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
TWD Contract Validation
23 passed · 41 failed · 3 warnings · 1 skipped Failed validations./contracts/users-3.0.json
./contracts/posts-3.1.json
./contracts/products-3.0.json
./contracts/events-3.1.json
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On large suites the CLI loses everything on a timeout and wastes minutes retrying.
Real case:
holafly/webapp-platform-admin(320+ tests). When ~40 fail, each is retried (retryCountdefault 2) so the slowest tests run ~80×. The whole suite ran inside onepage.evaluate, andtestStatuswas only returned to Node whenrunAll()fully resolved — so aprotocolTimeoutmid-run rejected that single CDP call and discarded every result, leaving a bare timeout error in CI.What changed
The suite now runs in ordered chunks driven from Node (
runByIdsper chunk), accumulating results in Node. This gives two wins at once:maxFailures, the run stops, prints the results gathered so far + a "Stopped early" banner with aNot run: Kcount, and exits non-zero.page.evaluatetimes out/crashes, results from completed chunks are printed before the diagnostic instead of being lost.twd-cli-only — no
twd-jschanges; consuming apps upgrade just the CLI.Config (new)
maxFailures100disables (run everything).chunkSize100= one call.Bail trigger is cumulative total failures (not consecutive). Execution order is preserved (chunks are contiguous slices of the runner's pre-order test list). Contract validation is skipped on an early stop (partial data). The
protocolTimeoutdiagnostic was reworded for the chunked model.Tests
242 passing. New coverage: multi-chunk accumulation, early-bail stops the loop at the threshold,
maxFailures: 0disables bail, partial results printed on a mid-run crash, contracts skipped on early stop, duplicate suite-skip dedupe across chunks, and the existing exact-block summary assertions unchanged (backward-compat on the normal path).Design + plan:
docs/superpowers/specs/2026-07-21-max-failures-early-bail-design.md,docs/superpowers/plans/2026-07-21-max-failures-early-bail.md.🤖 Generated with Claude Code