Skip to content

ci: strip zero-instruction lines before Codecov upload - #260

Merged
Lemkinator merged 1 commit into
mainfrom
ci/codecov-zero-instruction-lines
Oct 3, 2026
Merged

Lemkinator merged 1 commit into
mainfrom
ci/codecov-zero-instruction-lines

Conversation

@Lemkinator

@Lemkinator Lemkinator commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • The Kover IntelliJ engine writes <line mi="0" ci="0" mb="0" cb="0"> for return-only lines.
  • Codecov's JaCoCo parser reads line attributes only, so it counts these lines as misses. kotlinx-kover #699 is closed as won't fix.
  • A new XML-aware filter (.github/scripts/strip-zero-instruction-lines.py) removes these <line> entries from reportDebug.xml. CI runs it before the Codecov upload, and all counters stay unchanged.
  • CLAUDE.md gains one line on the Kover tool entry that documents the CI filter step.

Commit:

  • afd06ac ci: strip zero-instruction lines before Codecov upload

Verification

  • Local filter run on reportDebug.xml: 0 lines removed, 1495 kept, all 1845 counters unchanged. This repo has no affected lines today.
  • Parity: the script is EXACT identical; EXACT-tier drift 0.

Notes

  • This change does not alter coverage today. It prevents false misses once Kover emits zero-instruction lines.

🤖 Generated with Claude Code

https://claude.ai/code/session_012g8rnoGyH6eeKMXGqyc7hz

Adds a filter that removes zero-instruction JaCoCo lines before Codecov upload. Documents the CI step. Test results were not provided.

Kover's IntelliJ engine writes <line mi="0" ci="0" mb="0" cb="0"> for
return-only lines, and Codecov's JaCoCo parser counts them as misses.
kotlinx-kover #699 is closed as won't fix, so CI removes these entries
from the Kover XML before the upload. Counters stay unchanged.
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 24b07ebd-2caf-4e02-84ce-126c444b5877
📥 Commits

Reviewing files that changed from the base of the PR and between cad5573 and afd06ac.

📒 Files selected for processing (3)
  • .github/scripts/strip-zero-instruction-lines.py
  • .github/workflows/ci.yml
  • CLAUDE.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change adds a script that removes zero-instruction <line> elements from Kover XML reports. The CI local-tests job runs the script before uploading coverage to Codecov. The Kover guidance documents this step.

Changes

Kover coverage filtering

Layer / File(s) Summary
XML filtering and report processing
.github/scripts/strip-zero-instruction-lines.py
The script checks the mi, ci, mb, and cb attributes. It removes lines when all four values are "0", reports removed and kept counts, and processes each supplied report.
CI integration and guidance
.github/workflows/ci.yml, CLAUDE.md
The local-tests job filters the Kover XML report before the Codecov upload. The Kover guidance documents the filtering step.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant LocalTests as local-tests job
  participant Filter as zero-instruction line script
  participant Report as Kover XML report
  participant Codecov
  LocalTests->>Filter: Process report before upload
  Filter->>Report: Remove zero-instruction lines and write XML
  LocalTests->>Codecov: Upload filtered report
Loading

Merge Risk: ⚪ Minimal · up to afd06

No actionable coverage-report regression is established, and the filter runs before the Codecov upload. The exact Kover 0.9.11 XML shape could not be verified, but no known merge blocker remains.

Security Architecture Review

Security architecture risk: 🔵 Low · up to afd06

The change is confined to coverage reporting and does not expand CI permissions or change the upload destination. Coverage verification still precedes filtering, and filter failures normally prevent upload. Risk is low because compatibility with the precise generated report format remains unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The evidenced exposure is confined to the CI coverage report and its existing external reporting destination. The new invocation supplies no dynamic report path and does not introduce an application-facing network entrypoint.

Trust Boundaries and Controls

  • inferred — Pull-request content already influences the code and report generated by the existing Gradle step. Adding this local transformation does not establish a new caller authority or bypass the coverage-verification control: verification occurs before report mutation, and the upload destination is unchanged.

Resilience and Maintainability Implications

  • inferred — Parse errors terminate filtering before mutation, while output failures or cancellation can leave partial XML. The ordinary Codecov coverage step does not run after filter failure; the separate failure-report upload targets HTML, not the rewritten XML. No persistent insecure configuration is shown by this transition.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: CI strips zero-instruction lines before uploading coverage to Codecov.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks each line with care,
Four zero counts? It trims them there.
The report is saved, its totals shown,
Then off to Codecov it is flown.
CI runs the script before the send,
A tidy trail from start to end.

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Low risk] Adds a script to clean coverage reports before upload.

The PR appears safe to merge; the untested filtering case is a non-blocking concern.

Fix All in Claude CodeFindings

  1. P2 Filtering case has no test ▶
Fix with agent prompt
### Issue 1
.github/scripts/strip-zero-instruction-lines.py:17-24
The reported local run removed zero lines, and there is no test fixture with an all-zero `<line>`. That leaves the new removal behavior untested. A small Kover XML fixture could check that only the intended line is removed and that retained lines and counters survive the rewrite.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary

The PR adds a CI step that removes zero-instruction lines from Kover XML before uploading it to Codecov and documents that step.

  • The workflow filters the same report file it uploads.
  • A synthetic test would cover the filtering case absent from the reported local run.

Reviews (1) · Last reviewed commit: "ci: strip zero-instruction lines before ..."

Comment on lines +17 to +24
for sourcefile in tree.iter("sourcefile"):
for line in sourcefile.findall("line"):
if is_zero_instruction_line(line):
sourcefile.remove(line)
removed += 1
else:
kept += 1
tree.write(path, encoding="UTF-8", xml_declaration=True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Filtering case has no test The reported local run removed zero lines, and there is no test fixture with an all-zero <line>. That leaves the new removal behavior untested. A small Kover XML fixture could check that only the intended line is removed and that retained lines and counters survive the rewrite.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/scripts/strip-zero-instruction-lines.py
Line: 17-24

Comment:
**Filtering case has no test** The reported local run removed zero lines, and there is no test fixture with an all-zero `<line>`. That leaves the new removal behavior untested. A small Kover XML fixture could check that only the intended line is removed and that retained lines and counters survive the rewrite.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declining. The script is ~20 lines of CI glue that fails loudly (exit 1) on a missing or malformed report. Its removal behavior was verified against a fixture with 364 injected all-zero lines (exactly those removed, every counter unchanged) when it was introduced; this repo carries a byte-identical copy enforced by a parity check. A separate Python test suite plus a CI step in every Android repo would cost more than the script it guards.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s reasonable. The injected-fixture verification covers the removal path and counter preservation, while the parity check prevents this copy from drifting. Given the script’s small scope and fail-loudly behavior, adding a separate fixture/test suite here would be disproportionate. I’m withdrawing the test-coverage concern.

Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.

@codecov

codecov Bot commented Oct 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@Lemkinator
Lemkinator merged commit 0d651de into main Oct 3, 2026
10 checks passed
@Lemkinator
Lemkinator deleted the ci/codecov-zero-instruction-lines branch October 3, 2026 14:19
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