Skip to content

Fix Codecov 0%: fix coverage.json, rm gem codecov#2857

Merged
david-a-wheeler merged 1 commit into
mainfrom
fix_codecov
Jun 26, 2026
Merged

Fix Codecov 0%: fix coverage.json, rm gem codecov#2857
david-a-wheeler merged 1 commit into
mainfrom
fix_codecov

Conversation

@david-a-wheeler

Copy link
Copy Markdown
Collaborator

Our earlier commit e2de938 created the file
coverage/codecov-result.json fixing the
"Found 0 coverage files" error, but the site still showed 0%. Codecov's backend rejected the upload as "Unusable report ... incorrect data format": the abandoned codecov 0.6.0 gem's formatter emits the deprecated v2 "network" report format (a filename list, a "<<<<<< network" separator, then one line of coverage JSON) which isn't even valid JSON despite the .json name. The pinned Codecov CLI uploaded it without complaint because --plugin noop means it never parses the file, so the upload step looked healthy while the backend silently discarded the data.

This commit changes the approach for recording coverage results. Now we write coverage/coverage.json with SimpleCov::Formatter::JSONFormatter (from simplecov_json_formatter), whose output Codecov parses natively, and point the CLI --file at it. As before this runs in test:coverage_gaps rather than test_helper.rb, because CI runs with DEFER_COVERAGE set (swapping in SimpleFormatter) and the merged result is only complete once all parallel + system runs finish.

This removes the abandoned codecov gem entirely and drops its dead formatter reference from test_helper.rb (it never ran in CI anyway, since DEFER_COVERAGE overrode it). The codecov gem was the only thing pulling in simplecov, including its <0.22 pin, so we now list simplecov and simplecov_json_formatter explicitly: both are required directly (in test_helper.rb and test:coverage_gaps respectively), so declaring them prevents a future simplecov release that stops bundling the JSON formatter from breaking coverage reporting in a surprising way.

Our earlier commit e2de938 created the file
coverage/codecov-result.json fixing the
"Found 0 coverage files" error, but the site still showed 0%.
Codecov's backend rejected the upload as "Unusable report ...
incorrect data format": the abandoned codecov 0.6.0 gem's formatter
emits the deprecated v2 "network" report format (a filename list, a
"<<<<<< network" separator, then one line of coverage JSON) which isn't
even valid JSON despite the .json name. The pinned Codecov CLI uploaded
it without complaint because `--plugin noop` means it never parses the
file, so the upload step looked healthy while the backend silently
discarded the data.

This commit changes the approach for recording coverage results. Now we
write coverage/coverage.json with SimpleCov::Formatter::JSONFormatter
(from simplecov_json_formatter), whose output Codecov parses natively,
and point the CLI --file at it. As before this runs in test:coverage_gaps
rather than test_helper.rb, because CI runs with DEFER_COVERAGE set
(swapping in SimpleFormatter) and the merged result is only complete once
all parallel + system runs finish.

This removes the abandoned codecov gem entirely and drops its dead formatter
reference from test_helper.rb (it never ran in CI anyway, since
DEFER_COVERAGE overrode it). The codecov gem was the only thing pulling
in simplecov, including its <0.22 pin, so we now list simplecov and
simplecov_json_formatter explicitly: both are required directly (in
test_helper.rb and test:coverage_gaps respectively), so declaring them
prevents a future simplecov release that stops bundling the JSON
formatter from breaking coverage reporting in a surprising way.

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
@david-a-wheeler david-a-wheeler merged commit b742504 into main Jun 26, 2026
6 checks passed
@david-a-wheeler david-a-wheeler deleted the fix_codecov branch June 26, 2026 00:54
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

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