Shard console app tests across parallel jobs - #4376
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughConsole coverage tests now run in three shards. Each shard uploads an LCOV report, and a new composite action merges those reports into one file before downstream coverage processing. ChangesConsole coverage aggregation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ShardJobs as Console shard jobs
participant Artifacts as LCOV artifacts
participant MergeAction as merge-lcov action
participant AWK as merge-lcov.awk
ShardJobs->>Artifacts: Upload shard LCOV reports
Artifacts->>MergeAction: Download reports
MergeAction->>AWK: Pass sorted .info tracefiles
AWK-->>MergeAction: Write merged lcov.info
MergeAction-->>ShardJobs: Provide consolidated coverage report
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
6544edd to
2a51e44
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Purpose
Console App Tests is the longest job in the PR Builder: ~11.7 min of vitest in a single run, against ~2.7 min of fixed setup, for a ~14.5 min job. Everything else finishes well before it, so it sets the floor for how fast a PR run can be.
This splits the suite across 3 shards that run concurrently, taking the job to roughly 6.5 min and moving it off the critical path (which becomes Build Product to Playwright E2E at ~13 min).
Phase 2 of #4268.
Approach
test-frontend-console-app-shardsis a 3-way matrix runningvitest run --coverage --shard=N/3, withfail-fast: falseso one broken shard does not mask the others.Because each shard only sees its own tests, coverage arrives in three partial LCOV reports.
test-frontend-console-appbecomes a small aggregator that merges them back into a singleconsole-coverageartifact, soupload-frontend-coverageand the patch coverage gate are untouched and keep consuming exactly what they do today. The merge itself is a newmerge-lcovcomposite action: an awk script that sums per-line and per-function hit counts and recomputes the LF/LH/FNF/FNH totals. That follows the precedent already set bygo-cover-to-lcov.awkin the patch coverage gate, which deliberately avoids third-party coverage converters.Two details that are load-bearing:
🧪 Console App Tests with Coverage, which is a required status check. It also runs withalways()plus an explicit shard-result check rather than relying onneedsalone, because a skipped required check counts as passing for branch protection: without that, a failing shard would skip the aggregator and quietly satisfy the requirement.console-lcov-shard-N, with no "coverage" in the name, so the patch coverage gate's*coverage*artifact download only ever picks up the merged report and never a partial one.Verification
The merge was validated end to end against real sharded output rather than by inspection. Running the console
flows/hookstests as--shard=1/2and--shard=2/2produced two genuine istanbul reports (25 files/452 lines and 19 files/450 lines); merging them yields the union of 37 files and 860 lines, and every single line's merged hit count equals the sum of its per-shard counts (0 mismatches). The merged report was then parsed with the samediff_cover==10.4.0the gate uses, to confirm it is inside that parser's LCOV grammar.Two parser constraints found during that check and handled:
FNDAmust carry exactly two fields, andFNmay carry either two or three, so the merger keeps the leadingFNfields verbatim and takes the function name after the last comma.Trade-off
Runner-minutes for this job go from ~14.5 to ~20 (each shard repeats the ~2.7 min of install and frontend build). 3 shards rather than 2 is deliberate:
--shardsplits by file count, not duration, so an uneven split could otherwise leave one shard close to the old runtime.Related Issues
Related PRs
Checklist
breaking changelabel added.Security checks
Summary by CodeRabbit