Skip to content

Commit e1ce678

Browse files
committed
fix(ci): skip validate-tests-merge's global coverage threshold under scoped test selection
Scoped test selection (#ci-scoped-test-selection) runs vitest --changed across all 3 shards for a miner/mcp/discoveryIndex/backend-only PR, so merging those shards reconstructs only that narrow subset's coverage, not the whole suite. validate-tests-merge's global 80% threshold check assumed a merged-shard total always meant whole-suite coverage and false-failed a fully-tested, scoped-selection PR as a result. Disables the threshold in that same case, mirroring the per-shard COVERAGE_NO_THRESHOLDS pattern already used above it -- Codecov's patch gate still enforces real per-line coverage on the actual diff regardless.
1 parent c9ad463 commit e1ce678

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,17 @@ jobs:
11321132
# vitest.config.ts's own comment describes; Codecov's patch gate (changed-lines only) doesn't cover a
11331133
# whole-repo regression outside the diff, so this is what actually restores that backstop for CI, using
11341134
# vitest's own --mergeReports against each shard's uploaded blob report.
1135+
#
1136+
# That "merged = whole-suite" assumption breaks when scoped test selection (#ci-scoped-test-selection,
1137+
# see the shard job's own SCOPED_TEST_SELECTION comment above) was active for this run: all 3 shards then
1138+
# ran the SAME narrow `--changed=origin/main` subset (not a partition of the ~2,900-test full suite), so
1139+
# merging them still only reconstructs that narrow slice's coverage -- correctly high for the files it
1140+
# touches, but the threshold judges the WHOLE include set, so it false-fails even a fully-tested scoped
1141+
# PR (confirmed live: a 3-file packages/loopover-mcp-only PR with 100% coverage on its own two touched
1142+
# test files still reported 0%/80% and failed). This job disables the threshold in that same case, via
1143+
# the identical SCOPED_TEST_SELECTION condition -- Codecov's patch gate already enforces real per-line
1144+
# coverage on a scoped PR's actual diff regardless, so nothing is lost by skipping the whole-suite
1145+
# backstop specifically when it can't see the whole suite.
11351146
validate-tests-merge:
11361147
name: validate-tests-merge
11371148
needs: [changes, validate-tests]
@@ -1160,6 +1171,12 @@ jobs:
11601171
path: all-blob-reports
11611172
merge-multiple: true
11621173
- name: Merge shard coverage and check the global threshold
1174+
env:
1175+
# Mirrors validate-tests' own SCOPED_TEST_SELECTION condition exactly (this job already has
1176+
# `needs.changes` available). vitest.config.ts checks this var for TRUTHINESS, not `=== 'true'`,
1177+
# so the false branch must be an empty string (falsy), not the literal string "false" (which JS
1178+
# treats as truthy) -- that's why this is a `&& 'true' || ''` expression, not a bare boolean.
1179+
COVERAGE_NO_THRESHOLDS: ${{ (github.event_name == 'pull_request' && vars.SCOPED_TEST_SELECTION_ENABLED != 'false' && needs.changes.outputs.rees != 'true' && needs.changes.outputs.controlPlane != 'true' && needs.changes.outputs.engine != 'true' && needs.changes.outputs.backendConfig != 'true' && (needs.changes.outputs.backend == 'true' || needs.changes.outputs.miner == 'true' || needs.changes.outputs.mcp == 'true' || needs.changes.outputs.discoveryIndex == 'true')) && 'true' || '' }}
11631180
run: npx vitest run --coverage --mergeReports=all-blob-reports
11641181

11651182
# Diff-scoped security gate: fails only on vulnerabilities this PR introduces.

0 commit comments

Comments
 (0)