test: a test gets 30 s before vitest calls it hung - #99
Merged
Merged
Conversation
vitest's default budget of 5 s is a hang detector, and on this workstation it reported four tests as failed that were not hung. Each takes 0.4 to 1.7 s on an idle machine and went over 5 s while another session's build and tests held the load average at 8 on four threads: an uncertain absent batch in weather.test.ts, two frozen-verification cases and the PostgreSQL historical-epoch copy in generation-migration. A hung test never finishes, so the number only decides how long it takes to say so. Tests that name their own budget keep it, and bounds a client depends on are asserted by their own tests, as in failure.test.ts. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Summary
A TypeScript test now gets 30 s before vitest reports it as hung. Before this it got vitest's
default of 5 s. On this workstation the 5 s budget reported four tests as failed that were not
hung. It changes one setting in
typescript/vitest.config.tsand adds a paragraph todocs/test-toolchain.md.What was measured
On 27 September, four tests went over 5 s in
make checkruns for #93, #96 and #97. Anothersession's build and tests held the load average at about 8 on four threads. The same tests on an
idle machine, from the JSON reporter:
weather.test.ts, an uncertain absent batchfrozen-verification.live.test.ts, the request captured before metadata callsfrozen-verification.live.test.ts, a target-only rowgeneration-migration.live.test.ts, historical epochs from PostgreSQLEach was a slow test, not a hang. Each passed on a rerun of the same tree.
71 tests already carry a budget of their own, from 15 s to 120 s, and keep it. The count comes from
a throwaway reporter that read each test's timeout. The idle durations come from the JSON reporter.
Why a single number
The budget is a hang detector. A hung test never finishes, so the number only decides how long it
takes to say so, and 30 s stays finite. 928 tests use the default budget, and the slowest of them
takes 1.9 s on an idle machine. Today's worst slowdown was at least fourteenfold, on the first
runWeathercall ofweather.test.ts. A separate budget for*.live.test.tswould not have covered it, becauseweather.test.tsis a unit test.A bound that a client depends on is asserted by its own test, as
failure.test.tsdoes for connectand handshake timeouts. This setting does not carry one.
Mutations
Temporary probe tests, removed afterwards, and the config restored from a copy kept beside it:
testTimeoutremovedC1 is the one that must keep failing: the detector still fires.
Tests
make checkwith both live engines on211c9ab(this branch rebased on docs: the documents describe the 0.1.0 release; main moves to 0.1.1.dev0 #98):python (3.12)failed on its first attempt, intest_the_build_budget_bounds_a_held_build_and_recovery_finishes_it[postgres], with "tupleconcurrently updated" from a
DROP INDEX CONCURRENTLYduring recovery. That is a race in theindex operator's PostgreSQL recovery. It is on
maintoo, and nothing here touches Python. Itnow reproduces deterministically and is fixed in its own pull request. The rerun of that job
passed, and all fourteen checks are green.
🤖 Generated with Claude Code