Skip to content

test: derive slow tests' timeouts from the work they do - #33

Merged
Mearman merged 3 commits into
mainfrom
fix/derive-test-timeouts
Oct 29, 2026
Merged

Mearman merged 3 commits into
mainfrom
fix/derive-test-timeouts

Conversation

@Mearman

@Mearman Mearman commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Fixes #32

The unit tests that visit every generated model, or make RUNS property runs, ran under vitest's default timeout. On a loaded machine they time out with unchanged work, which fails the pre-push hook. Each now takes a timeout of its own work count times a named per-operation budget, in the way the rank test already did. No global timeout changed, nothing skipped or retried.

test/budget.ts holds budgetFor(operations, perOperationMs), which returns the { timeout } options and refuses a non-positive result (a timeout of 0 disables vitest's), plus candidateCount (the product of the options each dimension offers, constraints ignored) and subsetCount.

Suite Work count Budget constant
counting, naive-search tests candidate combinations of the random and late-constrained models CANDIDATE_BUDGET_MS
counting, rank test Σ (count + 1) over the models (unchanged); its constant is raised, see below RANK_OPERATION_BUDGET_MS
covering, per-strength tests candidate combinations times t-subsets of dimensions, per generated model OBSERVATION_BUDGET_MS
covering, "never reads the solution set" the test's own queryBound QUERY_BUDGET_MS
search, rank candidate combinations of the generated models CANDIDATE_BUDGET_MS in each
JSON Schema and parseModel property tests RUNS per property, one or two properties RUN_BUDGET_MS
cancellation, whole-space test SPACE times the five searches it makes COMBINATION_BUDGET_MS
condition monotonicity conditions times (partial assignments plus their completions) EVALUATION_BUDGET_MS
trilean evaluation budget nodes of the two trees it builds NODE_BUDGET_MS

Each constant is at least two hundred times the CPU time per operation of the heaviest test that uses it on an idle machine, so only a loop that stops terminating fails. The existing rank budget was about sixteen times, not the forty its comment claimed, so I raised it to the same margin.

Not covered: the README example imports (readme.unit.test.ts), the first test of enumerate.unit.test.ts and the site suites. Their cost is module loading or DOM rendering of a few nodes, not a work count to derive; none exceeded the default timeout in the full run the pre-push hook made.

Every commit type releases a patch version in this repo, so the test: commits cut a patch release with unchanged package contents.

The suites that visit every generated model gave each test vitest's
default timeout, which a machine under heavy load exceeds while the
work is unchanged. Each test now takes a timeout of its own work count
(candidate combinations, observed tuples or engine queries) times a
named per-operation budget, so load alone cannot fail it and a search
that stops terminating still does.
Each agreement and round-trip property made `RUNS` runs under vitest's
default timeout, which a loaded machine exceeds while the work is
unchanged. The timeout is now the property runs the test makes times a
named per-run budget.
…meouts from their work

The whole-space cancellation test, the condition monotonicity test and
the trilean evaluation budget test ran under vitest's default timeout,
which a loaded machine exceeds while the work is unchanged. Each now
takes its searches, evaluations or tree nodes times a named budget.
@Mearman
Mearman marked this pull request as ready for review October 29, 2026 19:52
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ⚠️ Failed 2026-10-29T19:52:43.555620Z
We couldn’t complete this review. Comment @codex security review to try again.
fe1da3b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins.

@Mearman
Mearman merged commit 60827be into main Oct 29, 2026
10 checks passed
@Mearman
Mearman deleted the fix/derive-test-timeouts branch October 29, 2026 19:53
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Derive per-test timeouts from the work in the slow unit tests

1 participant