Skip to content

Add generate-time suite sharding (--shard-count / --shard-index)#161

Merged
lahma merged 1 commit into
mainfrom
feat/suite-sharding
Jul 13, 2026
Merged

Add generate-time suite sharding (--shard-count / --shard-index)#161
lahma merged 1 commit into
mainfrom
feat/suite-sharding

Conversation

@lahma

@lahma lahma commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Adds optional sharding to generate so a CI matrix can compile and run independent slices of the suite on separate runners in parallel.

What

  • --shard-count (default 1 = no sharding) and --shard-index ([0, shard-count)) on the generate command, plumbed through TestSuiteGeneratorOptions.
  • Each test file is assigned to a shard by a stable FNV-1a hash of its name — not string.GetHashCode(), which is per-process randomized on modern .NET. So shard k always contains the same files across runs, machines and operating systems; shards never overlap; and their union is exactly the full suite. Strict and non-strict variants of a file share a shard, and a shard generated on one OS can be reused (e.g. from a cross-OS cache) by test jobs on any other.

Validation

Console run against a real test262 checkout, --shard-count 4:

shard test cases
0 24,889
1 24,593
2 25,076
3 25,008
Σ 99,566 = full unsharded suite

New tests cover partition (no overlap / no loss), determinism, and argument validation. Existing snapshot tests are unaffected (10/10 pass).

Motivation

Consumed by Jint to shard its ~99.5k-case Test262 run across parallel GitHub Actions runners (the suite execution dominates CI wall-clock, and free runners are capped at 4 vCPU which NUnit already saturates — so horizontal sharding is the only lever left).

🤖 Generated with Claude Code

Splits the generated suite into N deterministic, disjoint slices so a CI
matrix can compile and run them on separate runners in parallel. Assignment
is a stable FNV-1a hash of the test file name (not string.GetHashCode, which
is per-process randomized), so shard k always holds the same files across
runs/machines/OSes, shards never overlap, and their union is the full suite.
Strict and non-strict variants of a file share a shard.

Wired through TestSuiteGeneratorOptions, the generator, and the console tool.
Added partition/determinism/validation tests; existing snapshots unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lahma
lahma merged commit 8b73bd3 into main Jul 13, 2026
2 checks passed
@lahma
lahma deleted the feat/suite-sharding branch July 13, 2026 10:21
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