← Back to Pull requests

let the test suite run as a shard so CI can split it across jobs #1945

Open
unknown opened this pull request with 362 lines diff across 4 files
View on GitHub
unknown unknown commented on Oct 04, 2026 01:30 UTC
Author

run-tests.sh --shard=I/N runs every Nth test, so the suite can be split across parallel CI jobs. Opt-in: without the flag nothing changes.

Measured on features types basics (147 tests):

| run | wall |
| --- | --- |
| unsharded | 77.5 s |
| 4 shards, in parallel | ~19 s each |

The four shards came to 37 + 37 + 37 + 36 = 147, exactly the unsharded total, so the partition has no gaps or overlap. Round-robin rather than contiguous blocks keeps them balanced, since neighbouring tests cost about the same. Default run still prints == running 147 tests on 6 parallel workers == with no shard note and the same 147 passed.

Why sharding, rather than tuning the existing run

I measured before changing anything.

Parallelism is already saturated. On a 6-core box, same 147 tests:

| -j | wall |
| --- | --- |
| 4 | 77.5 s |
| 8 | 74.9 s |
| 12 | 74.7 s |

3.6% from tripling the workers, so raising -j in CI buys nothing.

The cost is per-test compiler work. A cold build of a small program, from --time-report=json:

| phase | time | share |
| --- | --- | --- |
| cc | 475 ms | 36% |
| codegen | 336 ms | 26% |
| semantic (11 modules) | 240 ms | 18% |
| link | 41 ms | 3% |
| parse + lex | 12 ms | 1% |

The C compiler is already tcc, the fastest option, and cc is the only part the .salam-build object cache can remove.

Sharing that cache between tests does not work. Each test builds in its own throwaway job directory. Pointing several tests at one directory looked promising - rebuilding the same file reports cc: 0.0 ms - but a different test in a warmed directory reports modules_built: 11, modules_cached: 0 and takes 1.24 s against 1.28 s cold. Different tests pull different module sets and different generic instantiations, so the hit rate is nil. Even a perfect cache would only reach the 612 ms semantic+codegen floor, about 35%.

So the remaining lever is wall-clock across machines, which is what this enables.

Two ways to use it

Neither is in this PR - the first touches the release workflow while a release is in flight, and the second is a CI-cost decision that is yours.

1. Shard the release gate. Validate full test suite takes 494 s on Linux x86_64 and 859-1076 s on the Windows runners. Four shards would put that near 130 s and 270 s. It needs the gate moved out of the platform build jobs into jobs that download the existing salam-linux artifact.

2. Run the suite on pull requests. compiler-release.yml is the only workflow that runs run-tests.sh, and its gate is behind startsWith(github.event.head_commit.message, 'release:'). The suite therefore never runs on a pull request. That is why uchar_cast, timereport/json, big_struct_values and the ___chkstk_ms failure all reached a release attempt before anyone saw them. Sharded, a PR-time gate costs about two minutes of wall-clock over four jobs.

Diff: 362 lines (+271 / -91) across 4 files Reviewer: copilot-pull-request-reviewer[bot] Review duration: 0m
All Vouch review confidence checks passed
Residual risk 0.38 = Change Risk (0.43) × (1 − Review Confidence (0.11)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 362 lines diff across 4 files
0.43
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 7% · Reviewer familiarity: 35%
11%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.353
Shallow Review Depth shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #1945"
general weight: 0.35
Assignees
Unassigned
Labels
risk: medium confidence: 11.1% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 42.6% (MEDIUM) · Higher = larger blast radius
42.6%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 11.1% · Lower = rushed or shallow review
11.1%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 37.9% · Moderate risk
37.9%