Skip to content

fix(runner): use per-group limiter for DFS-bounded concurrent scheduling#10108

Draft
hi-ogawa wants to merge 3 commits intovitest-dev:mainfrom
hi-ogawa:fix/max-concurrency-scheduling
Draft

fix(runner): use per-group limiter for DFS-bounded concurrent scheduling#10108
hi-ogawa wants to merge 3 commits intovitest-dev:mainfrom
hi-ogawa:fix/max-concurrency-scheduling

Conversation

@hi-ogawa
Copy link
Copy Markdown
Collaborator

@hi-ogawa hi-ogawa commented Apr 9, 2026

Description

I thought I had a clean picture and solution in #9653, but it turns out to be a wrong way to model concurrency for test execution (even though what's claimed in the PR is still "mathematically correct"). This PR revised the approach to limit concurrency at each concurrency branches (i.e. Promise.all) instead of scattering through all leaf calls. This model should fit better how concurrent behaves for testing scenarios.


Hmm, well this is actually quite different (too simplified) model and loose about global limit for nested describe.concurrent. The new model might be actually intuitive and fine, but let me explore if we have somehow solution to keep both good parts.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

Replace the global `limitMaxConcurrency` (FIFO, per-operation) with
short-lived per-group limiter instances created at each concurrent
dispatch point. Each child holds one slot for its entire subtree
duration, producing DFS-ordered execution with bounded parallelism.

Guarantee: at any concurrent group, at most `maxConcurrency` subtrees
are simultaneously in-flight, bounding resource ownership at every
level of the task tree (not just at leaf tests).

Fixes vitest-dev#10097

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 9, 2026

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit ac20327
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/69d70b81eb03ad000800b031
😎 Deploy Preview https://deploy-preview-10108--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@hi-ogawa
Copy link
Copy Markdown
Collaborator Author

hi-ogawa commented Apr 9, 2026

Okay, this looks like a genuinly hard (or impossible) problem. I'm leaning towards reverting #9653. I think the state before that PR already had the most practical trade-off.

Any new "solution" will probably becomes the matter of introducing opt-in/out to let uses choose certain behavior e.g. describe.concurrent inheritance. per test limit, per branch limit.

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

Labels

None yet

Projects

None yet

1 participant