Skip to content

perf(e2e): parallelize scenario variants within test files#1956

Open
Stephen Belanger (Qard) wants to merge 4 commits intomainfrom
worktree-parallelize-scenarios
Open

perf(e2e): parallelize scenario variants within test files#1956
Stephen Belanger (Qard) wants to merge 4 commits intomainfrom
worktree-parallelize-scenarios

Conversation

@Qard
Copy link
Copy Markdown
Contributor

Summary

  • Wraps the for-loop in each multi-variant e2e scenario file in describe.concurrent so all SDK versions run their beforeAll subprocess hooks in parallel, bounded by maxConcurrency: 5 in vitest.config.mts
  • Uses describe.sequential for the per-version inner block to keep "wrapped" and "auto-hook" variants sequential within each version, preventing snapshot write races on --update
  • Adds js/scripts/run-parallel.mjs, a cross-platform Node.js script that runs the isolated provider test suites (ai-sdk-v5, ai-sdk-v6, claude-agent-sdk) concurrently; the shared-workspace suites (openai, anthropic, google-genai) stay sequential since they call pnpm prune on a shared node_modules

Expected CI wins:

  • anthropic-instrumentation: 6 SDK versions now run in parallel (was sequential)
  • ai-sdk-instrumentation: 4 SDK versions in parallel
  • openai-instrumentation: 3 versions in parallel
  • claude-agent-sdk-instrumentation: 4 versions in parallel within each of the two outer groups
  • test:external provider suite: ai-sdk v5/v6 and claude-agent-sdk now overlap with each other instead of chaining

All within the existing CI job structure — no new GitHub Actions jobs.

Test plan

  • Hermetic e2e tests pass locally (pnpm test:e2e:hermetic — 13 passed, 908 skipped awaiting API keys)
  • Full e2e CI run to confirm cassette-backed tests pass concurrently
  • js-provider-tests CI run to confirm run-parallel.mjs exit propagation works on both ubuntu and windows

🤖 Generated with Claude Code

Stephen Belanger and others added 4 commits May 6, 2026 14:13
Each multi-variant e2e scenario (e.g. anthropic: 6 SDK versions, ai-sdk:
4 versions) previously ran all describe blocks sequentially inside one
Vitest file. Since each withScenarioHarness call starts an isolated mock
server on its own ephemeral port with a unique testRunId, the tests are
already concurrency-safe.

Wrap the outer for-loops in describe.concurrent so all SDK versions run
their beforeAll subprocess hooks in parallel (bounded by maxConcurrency:
5). Inner describe.sequential blocks keep "wrapped" and "auto-hook"
variants for the same version sequential, avoiding snapshot write races
on --update runs.

Also parallelize test:external in js/: the isolated ai-sdk-v5, ai-sdk-v6,
and claude-agent-sdk suites (each with their own node_modules) now run
concurrently via a new cross-platform run-parallel.mjs script, while
openai/anthropic/google-genai (shared node_modules + pnpm prune) remain
sequential.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nd shell:true in run-parallel

- Add describe.sequential around each defineClaudeAgentSDKInstrumentationAssertions
  call so toMatchFileSnapshot has a test context when describe.concurrent propagates
  concurrency into the test bodies
- Use shell:true in run-parallel.mjs so pnpm.cmd works on Windows

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant