Skip to content

ci: collapse coverage in PR comment with per-class diff - #2176

Merged
beto-rodriguez merged 1 commit into
masterfrom
ci/coverage-comment-details
Apr 26, 2026
Merged

ci: collapse coverage in PR comment with per-class diff#2176
beto-rodriguez merged 1 commit into
masterfrom
ci/coverage-comment-details

Conversation

@beto-rodriguez

Copy link
Copy Markdown
Collaborator

Summary

  • Coverage section in the PR comment now follows the same <details> pattern as benchmarks/tests: the H4 line states whether coverage increased / decreased / stayed flat (with the delta), and the before/after table lives behind a Show details toggle.
  • Inside <details>: the existing Before/After/Delta table, a link to the full coverage report at https://live-charts.github.io/LiveCharts2/, and a new Class coverage changes table that lists only the classes whose line coverage changed since the baseline.
  • The coverage job now also emits ReportGenerator's JsonSummary and fetches the previous Summary.json from the badges branch so pr-comment.js can compute the per-class diff.

The per-class diff needs a baseline Summary.json on the badges branch — that gets deployed on the first master push after this lands. Until then, the helper detects the missing baseline and shows a one-line note instead of swamping the table with "everything is new".

Test plan

  • Verify the next PR run renders the new collapsed coverage block (header line shows direction + delta)
  • After this lands and a master push deploys Summary.json to the badges branch, verify the next PR shows the Class coverage changes table populated
  • Verify the badges and HtmlSummary outputs still deploy correctly (no regression from adding JsonSummary to -reporttypes)

🤖 Generated with Claude Code

The coverage section now follows the same details-tag pattern as the
benchmarks and tests sections: the H4 line states whether coverage
increased / decreased / stayed flat (with the delta), and the table,
docs link, and per-class diff live inside <details>.

To support the per-class diff, the coverage job now also emits
ReportGenerator's JsonSummary, fetches the previous Summary.json from
the badges branch, and bundles both into the coverage-summary
artifact so pr-comment.js can compute the changed-classes table.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 26, 2026 17:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the CI PR-commenting pipeline to present coverage results in a collapsible block and to include a per-class line coverage diff by comparing ReportGenerator JsonSummary outputs against the badges branch baseline.

Changes:

  • Collapse the coverage section in the PR comment into a <details> block with a direction/delta summary header.
  • Extend the coverage workflow to generate JsonSummary and export current/previous Summary.json for class-level comparison.
  • Add buildCoverageBlock() helper to render the new coverage section, including a “Class coverage changes” table.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/pr-comment.yml Switches from inline coverage markdown to buildCoverageBlock() with optional per-class inputs.
.github/workflows/livecharts.yml Adds JsonSummary generation and publishes old/new Summary.json into the coverage-summary artifact.
.github/scripts/pr-comment.js Implements buildCoverageBlock() to render a collapsible coverage section and compute per-class diffs.

Comment thread .github/scripts/pr-comment.js
@beto-rodriguez
beto-rodriguez merged commit 69319d7 into master Apr 26, 2026
11 checks passed
@beto-rodriguez
beto-rodriguez deleted the ci/coverage-comment-details branch April 26, 2026 17:28
pull Bot pushed a commit to Mu-L/LiveCharts2 that referenced this pull request Apr 30, 2026
buildCoverageBlock iterated `a.classes` (a count, e.g. 191) instead of
`a.classesinassembly` (the array), throwing `TypeError: number is not
iterable` on every PR. The outer try/catch in pr-comment.yml swallowed
the throw, so the entire #### Code Coverage block vanished from PR
comments with no visible failure in the workflow logs. Per-class line
coverage is also `c.coverage`, not `c.linecoverage`.

Regression from 70350b8 (PR Live-Charts#2176, "ci: collapse coverage in PR
comment with per-class diff"). Verified end-to-end against the real
coverage-summary artifact from PR Live-Charts#2193's run.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants