Skip to content

🐛 Fix OOM: shard coverage into 4 parallel jobs#4181

Merged
clubanderson merged 1 commit intomainfrom
fix/coverage-shard
Apr 1, 2026
Merged

🐛 Fix OOM: shard coverage into 4 parallel jobs#4181
clubanderson merged 1 commit intomainfrom
fix/coverage-shard

Conversation

@clubanderson
Copy link
Copy Markdown
Collaborator

Single-process OOMs at 5.5GB. Shards into 4 parallel runners (~2K tests each), merges with nyc, updates badge.

Single-process coverage OOMs at 5.5GB on 7GB runners even with
maxWorkers=1. Now shards tests into 4 parallel jobs (~2000 tests
each, ~4GB heap), merges coverage with nyc, then updates badge.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Copilot AI review requested due to automatic review settings April 1, 2026 16:37
@kubestellar-prow kubestellar-prow bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Apr 1, 2026
@kubestellar-prow
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign mikespreitzer for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 1, 2026

Deploy Preview for kubestellarconsole canceled.

Name Link
🔨 Latest commit a10e0ff
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/69cd49d78dfac900077b6c78

@kubestellar-prow kubestellar-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 1, 2026
@clubanderson clubanderson merged commit 83784ea into main Apr 1, 2026
14 checks passed
@kubestellar-prow kubestellar-prow bot deleted the fix/coverage-shard branch April 1, 2026 16:38
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

👋 Hey @clubanderson — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the repository’s scheduled coverage workflow to avoid GitHub Actions runner OOMs by splitting the Vitest coverage run into multiple parallel shards and then merging the resulting coverage outputs into a single report used to update the coverage badge gist.

Changes:

  • Shard the Vitest coverage run into 4 parallel jobs (matrix) with lower per-job memory limits.
  • Upload per-shard coverage artifacts and add a follow-up job to download and merge them into a single coverage summary via nyc.
  • Update artifact naming/output to reflect merged coverage reporting.

Comment on lines +110 to +115
# Use nyc to merge and report
npx nyc report \
--temp-dir .nyc_output \
--report-dir coverage \
--reporter=json-summary \
--reporter=text
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npx nyc report relies on nyc being available, but web/package.json doesn’t include nyc as a dependency. In GitHub Actions this can cause npx to fetch an arbitrary latest nyc from the registry (or fail if network is flaky), making coverage merges non-reproducible. Add nyc to web devDependencies (pinned) and run the local binary so merges are deterministic.

Copilot uses AI. Check for mistakes.
Comment on lines 15 to 18
NODE_VERSION: '22'
GIST_ID: 'b9a9ae8469f1897a22d5a40629bc1e82'
TOTAL_SHARDS: 4

Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TOTAL_SHARDS is defined in env, but the shard matrix is hard-coded to [1, 2, 3, 4]. This duplication can drift (e.g., updating TOTAL_SHARDS but forgetting to update the matrix), breaking sharding/merge assumptions. Consider defining the shard count once (e.g., YAML anchor or generating the matrix from a single JSON string) so these stay in sync.

Copilot uses AI. Check for mistakes.
uses: actions/upload-artifact@v4
with:
name: coverage-shard-${{ matrix.shard }}
path: web/coverage/coverage-final.json
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The merge job will proceed and update the badge even if one or more shard coverage artifacts are missing (e.g., shard timeout/OOM leading to no coverage-final.json), because it merges whatever files it finds. If the badge should reflect full-suite coverage, consider setting if-no-files-found: error on the shard artifact upload and/or failing/skipping the merge when the number of found shard files doesn’t equal TOTAL_SHARDS.

Suggested change
path: web/coverage/coverage-final.json
path: web/coverage/coverage-final.json
if-no-files-found: error

Copilot uses AI. Check for mistakes.
@clubanderson
Copy link
Copy Markdown
Collaborator Author

🔄 Auto-Applying Copilot Code Review

Copilot code review found 1 code suggestion(s) and 2 general comment(s).

@copilot Please apply all of the following code review suggestions:

  • .github/workflows/coverage-hourly.yml (line 56): path: web/coverage/coverage-final.json if-no-files-found: error

Also address these general comments:

  • .github/workflows/coverage-hourly.yml (line 115): npx nyc report relies on nyc being available, but web/package.json doesn’t include nyc as a dependency. In GitHu
  • .github/workflows/coverage-hourly.yml (line 18): TOTAL_SHARDS is defined in env, but the shard matrix is hard-coded to [1, 2, 3, 4]. This duplication can drift (e.

Push all fixes in a single commit. Run cd web && npm run build && npm run lint before committing.


Auto-generated by copilot-review-apply workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants