You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(contracts): make the coverage-sharding scripts maintainable
Address review feedback that the test-sharding / coverage scripts were hard to follow, with no
change to results (parallel coverage in CI and locally, identical merged coverage). Rewrite
mergeLcov.ts into a documented, unit-tested pure core (output byte-identical to before) and add
its unit test; extract named helpers in runParallelCoverage.ts; document why runShardCoverage.ts
must bypass the shell (the npx/HH308 brace-expansion, verified) and why compile.ts gates the
coverage compile-skip on solidity-coverage's __SOLIDITY_COVERAGE_RUNNING flag; add a README
explaining the whole shard pipeline. Verified locally: the mergeLcov unit test, parallel coverage
at 461 files / 96.459% lines / 97.160% functions, and the solhint ratchet unchanged at 181.
Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders>
|`test/contracts/integration/suiteDiscovery.ts`| Discover the IAsset suite files; `suiteWeight` (an `it()` count) and `assignBalancedShards` (greedy longest-processing-time bin-packing) to split them into evenly-weighted shards. |
26
+
|`test/contracts/integration/atsShardRunner.ts`|`runAtsShard(index, total)` — deploy the mega-asset **once** (`loadFixture`) and run only this shard's balanced slice. |
27
+
|`test/contracts/integration/ats.test.ts`| The entry. Reads `ATS_MEGA_SHARD_INDEX/TOTAL` (default `0/1` = every suite, one deploy = the serial CI run). |
28
+
|`test/contracts/integration/shards/ats.shard.{1..8}.test.ts`| Physical entries for **local**`mocha --parallel` (one file → one worker → `runAtsShard(k-1, 8)`). |
29
+
|`scripts/tools/coverage-shard/planShard.ts`| A coverage shard's file list: the mega entry (in every shard) + a balanced slice of the standalone suites. |
30
+
|`scripts/tools/coverage-shard/runShardCoverage.ts`| Run `hardhat coverage` for ONE shard (CI calls per runner; the local runner calls per worktree). |
31
+
|`scripts/tools/coverage-shard/mergeLcov.ts`| Union the per-shard lcovs into one report (preserving line/function/branch). |
32
+
|`scripts/tools/coverage-shard/runParallelCoverage.ts`| Local orchestrator: a git worktree per shard, run them concurrently, merge, tear down. |
33
+
|`tasks/compile.ts`| Skips the redundant second compile `hardhat coverage` would trigger (see below). |
34
+
|`.github/workflows/100-flow-ats-test.yaml`| The CI matrix (`coverage-ats`, 4 shards) + the `merge-coverage` job. |
35
+
36
+
## Two parallelism mechanisms — and why both exist
0 commit comments