From 3dc77b55c9abe2d8873f163b9223947bfecb2394 Mon Sep 17 00:00:00 2001 From: Ben Limpich Date: Fri, 9 Jan 2026 16:12:49 -0800 Subject: [PATCH 1/2] update number of chunks codecov uses --- codecov.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codecov.yml b/codecov.yml index 17cd8f9e567b0..f526f04b2d410 100644 --- a/codecov.yml +++ b/codecov.yml @@ -13,8 +13,8 @@ coverage: codecov: notify: - # We shard our tests into 3 chunks, so we want CodeCov to wait for 3 builds before commenting - after_n_builds: 3 + # We shard our tests into 8 chunks, so we want CodeCov to wait for 8 builds before commenting + after_n_builds: 8 comment: require_changes: "coverage_drop OR uncovered_patch" From a547d6828d1ba2f9a7240135d487b6a645265b4e Mon Sep 17 00:00:00 2001 From: Ben Limpich Date: Fri, 9 Jan 2026 16:13:02 -0800 Subject: [PATCH 2/2] add test to make sure chunks stay in lock step --- tests/unit/codecovConfigTest.ts | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/unit/codecovConfigTest.ts diff --git a/tests/unit/codecovConfigTest.ts b/tests/unit/codecovConfigTest.ts new file mode 100644 index 0000000000000..24e4f60220737 --- /dev/null +++ b/tests/unit/codecovConfigTest.ts @@ -0,0 +1,48 @@ +import fs from 'fs'; +import path from 'path'; + +/** + * Extracts the after_n_builds value from codecov.yml + * Expected format: "after_n_builds: 8" + */ +function getAfterNBuildsFromCodecov(content: string): number | null { + const match = content.match(/after_n_builds:\s*(\d+)/); + return match ? parseInt(match[1], 10) : null; +} + +/** + * Extracts the chunk array from test.yml workflow + * Expected format: "chunk: [1, 2, 3, 4, 5, 6, 7, 8]" + */ +function getChunksFromTestWorkflow(content: string): number[] | null { + const match = content.match(/chunk:\s*\[([^\]]+)\]/); + if (!match) { + return null; + } + const chunksStr = match[1]; + return chunksStr.split(',').map((chunk) => parseInt(chunk.trim(), 10)); +} + +describe('Codecov configuration', () => { + test('after_n_builds matches the number of test shards in test.yml', () => { + const codecovPath = path.resolve(__dirname, '../../codecov.yml'); + const testWorkflowPath = path.resolve(__dirname, '../../.github/workflows/test.yml'); + + // Read codecov.yml and extract after_n_builds + const codecovContent = fs.readFileSync(codecovPath, 'utf-8'); + const afterNBuilds = getAfterNBuildsFromCodecov(codecovContent); + + // Read test.yml and extract chunk array + const testWorkflowContent = fs.readFileSync(testWorkflowPath, 'utf-8'); + const chunks = getChunksFromTestWorkflow(testWorkflowContent); + + // Validate both values exist + expect(afterNBuilds).not.toBeNull(); + expect(chunks).not.toBeNull(); + expect(Array.isArray(chunks)).toBe(true); + + // Validate they match + const numberOfShards = chunks?.length ?? 0; + expect(afterNBuilds).toBe(numberOfShards); + }); +});