Skip to content

fix(coverage): fail loud when an expected coverage artifact download fails#34

Merged
monsieurleberre merged 2 commits into
devfrom
fix/25-coverage-download-not-silent
Jul 14, 2026
Merged

fix(coverage): fail loud when an expected coverage artifact download fails#34
monsieurleberre merged 2 commits into
devfrom
fix/25-coverage-download-not-silent

Conversation

@monsieurleberre

Copy link
Copy Markdown
Contributor

Closes #25.

Problem

In csharp-ci.yaml and scala-ci.yaml, the coverage-output job downloaded the coverage artifact with continue-on-error: true and defaulted to empty coverage when the file was absent. That conflated two distinct cases:

  1. No coverage shard ran → empty is correct (badge intentionally skipped). ✅
  2. A shard produced coverage (uploaded with if-no-files-found: error) but the download failed (throttling, retention, infra) → empty silently produced a blank/stale coverage badge on an otherwise-green run. ❌

Fix (symmetric across both workflows, coverage-output job only)

  • needs: build-and-testneeds: [normalize, build-and-test] so the job can read the normalized matrix.
  • New job-level env: COVERAGE_EXPECTED: ${{ contains(fromJSON(needs.normalize.outputs.matrix).*.coverage, true) }}. normalize-ci-matrix.sh guarantees every shard entry carries a boolean coverage key, so this cleanly answers "was a coverage shard configured" with zero changes to upstream jobs.
  • Download step: dropped continue-on-error: true; now gated if: env.COVERAGE_EXPECTED == 'true'. Expected-but-failed downloads now fail the job loud; when no shard requested coverage the download is skipped entirely.
  • Read step: defense-in-depth — if COVERAGE_EXPECTED=true and the read value is empty, emit ::error:: and exit 1 instead of outputting empty coverage.

Verification

  • actionlint clean on both files; committed tree verified via git show HEAD:<file>.
  • Pre-open review: SHIP — reviewer independently traced the predicate through the normalize job / normalize-ci-matrix.sh, confirmed the fromJSON(...).* object-filter is valid in job-level env, and confirmed the only consumer of coverage-output.outputs.coverage is the top-level workflow output (no internal needs: coverage-output), so the newly-possible failure skips nothing internal.

Behavior change

Fail-louder only: a run where the artifact silently vanished previously went green with a blank badge and will now fail coverage-output. Healthy consumers see no change; zero-coverage-shard consumers keep the intentional empty output.

…act is missing

The coverage-output job in csharp-ci.yaml and scala-ci.yaml downloaded
the coverage-percent artifact with continue-on-error: true and defaulted
to an empty coverage output when the file was absent, conflating 'no
coverage shard configured' (empty is correct) with 'coverage shard
uploaded but the download failed' (blank/stale badge on a green run).

The job now derives COVERAGE_EXPECTED from the normalized matrix: when a
shard set coverage: true the download runs without continue-on-error and
the read step rejects an empty value; when none did, the download step
is skipped and the empty output stays intentional.

Closes #25
Signed-off-by: monsieurleberre <monsieurleberre@users.noreply.github.com>
@monsieurleberre monsieurleberre merged commit 4abe0bb into dev Jul 14, 2026
2 checks passed
@monsieurleberre monsieurleberre deleted the fix/25-coverage-download-not-silent branch July 14, 2026 06:20
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.

coverage-output: distinguish 'no coverage configured' from a failed artifact download

1 participant