Skip to content

Record the corpus in four CI shards - #468

Open
leftibot wants to merge 1 commit into
cpp-best-practices:mainfrom
leftibot:corpus-shards
Open

leftibot wants to merge 1 commit into
cpp-best-practices:mainfrom
leftibot:corpus-shards

Conversation

@leftibot

Copy link
Copy Markdown
Collaborator

Part of #454, part 1: "check that the corpus job's time and the fetch cache still fit, and split the job if not."

Why

On a pull request, the corpus job takes about 31 minutes today: 16 minutes to record the PR and 15 to record the base, for example on #466. The job fetches about 5 GB of checkouts. Doubling the corpus (the next PR for #454) would make that about an hour on every pull request and about 10 GB on one runner.

What changes

  • python -m corpus record and fetch take --shard K/N. A project's shard is crc32(name) % N, so it depends on the name alone, and adding or removing a project moves no other. Today's 236 projects split 56, 56, 63 and 61.
  • The corpus job becomes a matrix of four shards, corpus (1/4) to corpus (4/4). Each fetches, records and compares its quarter, writes its own diff into the job summary under "Corpus, shard K/4", and uploads corpus-recording-K. Nothing else reads the artifact. fail-fast is off, so every shard reports.
  • corpus/README.md documents --shard and the shards.

If branch protection requires a check named corpus, it needs the four new names. main isn't protected today.

Tests

tests/test_corpus.py ShardTests checks that:

  • the four shards divide the manifest exactly, each holding more than 15% of it;
  • a project's shard doesn't depend on the other entries;
  • 1/1 is the whole corpus;
  • --shard 3/4 fetches exactly that shard;
  • wrong values (0/4, 5/4, 1, a/b, 1/0) are usage errors.

All local gates passed: ruff, ruff format, mypy, lizard, 3,375 tests with 99% coverage, jscpd, markdownlint and the strict self-check. actionlint and zizmor also pass on ci.yml.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt

python -m corpus record and fetch take --shard K/N. A project's shard
follows from its name alone, so adding a project moves no other. CI runs
the corpus job as a matrix of four shards, each fetching, recording and
comparing about a quarter of the corpus, so the doubled corpus fits a
job's time and disk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
@codecov

codecov Bot commented Nov 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.48%. Comparing base (9440220) to head (318936c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #468   +/-   ##
=======================================
  Coverage   99.48%   99.48%           
=======================================
  Files         369      369           
  Lines       26200    26200           
  Branches     3263     3263           
=======================================
  Hits        26065    26065           
  Misses        135      135           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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