From 02736d26fe9bc6a2021fa38fbdb8268dedcf0278 Mon Sep 17 00:00:00 2001 From: Jack Herrington Date: Mon, 30 Nov 2026 16:50:12 -0800 Subject: [PATCH] fix(ci): let the coverage regression check gate, not per-project absolute thresholds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Coverage job forces --coverage.include=src/** so the PR and its merge-base measure the same file set (apples-to-apples for coverage-check.mjs). But that include lowers each package's percentage below the absolute coverage.thresholds in its vitest config (calibrated for the default tested-files include), so vitest fails the run before the regression check ever compares. Seven packages (cms-core, cms-api, prm, cms-cli, cms-compat-wp, connect-atproto, …) tripped this on any broadly-affected PR, even with all tests passing. Zero the absolute thresholds in both the head and merge-base CI runs; the intended gate — a >0.5pp drop vs the merge-base (coverage-check.mjs) — is unchanged. Per-project thresholds still apply to local `pnpm test:coverage`, which uses the default include they were tuned for. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/pr.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2afbd814..41c44b77 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -102,7 +102,12 @@ jobs: PROJECTS: ${{ steps.affected.outputs.list }} run: | rm -rf packages/*/coverage app/*/coverage onboarding/packages/*/coverage - pnpm exec nx run-many --targets=test:coverage --projects="$PROJECTS" --outputStyle=static -- --coverage.reporter=json-summary --coverage.include='src/**' + # Zero the absolute per-project coverage.thresholds here: they are + # calibrated for each package's default (tested-files) include, but CI + # forces --coverage.include=src/** so the merge-base comparison is + # apples-to-apples, which lowers the percentage and trips them. The + # real coverage gate is the regression check (coverage-check.mjs). + pnpm exec nx run-many --targets=test:coverage --projects="$PROJECTS" --outputStyle=static -- --coverage.reporter=json-summary --coverage.include='src/**' --coverage.thresholds.lines=0 --coverage.thresholds.functions=0 --coverage.thresholds.statements=0 --coverage.thresholds.branches=0 node "$RUNNER_TEMP/coverage-check.mjs" --collect "$RUNNER_TEMP/cov-head" --expect "$PROJECTS" # Re-measuring the merge-base is normally a set of Nx Cloud cache # restores seeded by the Coverage workflow on main: the task hashes are @@ -130,8 +135,9 @@ jobs: exit 0 fi # Extra reporters/include so a merge-base whose scripts are still - # `vitest run --coverage` still writes coverage-summary.json. - pnpm exec nx run-many --targets=test:coverage --projects="$base_list" --outputStyle=static -- --coverage.reporter=json-summary --coverage.include='src/**' + # `vitest run --coverage` still writes coverage-summary.json. Zero the + # absolute thresholds for the same reason as the head run above. + pnpm exec nx run-many --targets=test:coverage --projects="$base_list" --outputStyle=static -- --coverage.reporter=json-summary --coverage.include='src/**' --coverage.thresholds.lines=0 --coverage.thresholds.functions=0 --coverage.thresholds.statements=0 --coverage.thresholds.branches=0 node "$RUNNER_TEMP/coverage-check.mjs" --collect "$RUNNER_TEMP/cov-base" --expect "$base_list" - name: Compare if: steps.affected.outputs.list != ''