Repository navigation
CI: publish diff and overall coverage numbers into the pull request description - #336
Merged
Merged
Conversation
Add scripts/publish_coverage_numbers_to_pr.py: after the tests and diff-cover steps on a pull request, read coverage.json and diff-cover.json, render one block between marker comments with the changed-lines figure and the whole-package figure, and replace that block in the pull request's description through the REST API, appending it when absent. The author's text outside the block is never touched. The pytest job gains pull-requests: write for that step; coverage.json joins the artifact. Nine mirror tests in triple form; mypy clean; the conventions check reports 0 breaches. The merge-commit half is a repository setting the owner flips: default merge message from the pull request's title and description. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…changed line is measured The first run on #336 spliced the block into the description's prose, which quoted the markers literally; a block is now matched only where each marker stands alone on its line, with a test for markers quoted in prose. The same run reported 100% of 0 changed lines on a change outside the devcapsule package; that case now reads "none measured". 13 mirror tests pass; mypy clean; the conventions check reports 0 breaches. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The owner set the merge commit's title and message to the pull request's title and description on 2026-11-04; verified through the repository API. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Owner order of 2026-11-04, maintenance workstream, following #335.
What changes
scripts/publish_coverage_numbers_to_pr.pyruns in the pytest job on pull requests, after diff coverage. It readscoverage.jsonanddiff-cover.json, renders one block bounded by two HTML comment markers with the changed-lines figure and the whole-package figure, and replaces that block in this description through the REST API, appending it when absent. Text outside the block is never touched. The pytest job gainspull-requests: writefor that one step.coverage.jsonjoins the coverage artifact.The merge commit half
No code. Under Settings, Pull Requests, set the default merge commit message to "Pull request title and description". The block then lands in the merge commit's detail as the description stands at merge time, which is after the green run that wrote it. Until the setting is flipped, the numbers live in the pull request only.
What the first run taught
The first run on this PR spliced the block into the paragraph above, because that paragraph quoted the two markers literally and the upsert matched them mid-sentence. The markers are now matched only when each stands alone on its line, with a test for markers quoted in prose. The same run reported "100% of 0 changed lines", because this PR touches no line of the
devcapsulepackage; that case now reads "none measured" instead of a percentage.Evidence
tests/unit/scripts/test_publish_coverage_numbers_to_pr.py, triple form: the figures, the block in both cases, the upsert in its four cases, the step with a recorded API, the refusals.validate_unittests_follow_conventions.py: 110 legacy files, 1524 tests, 3 files follow the convention, 0 breaches.🤖 Generated with Claude Code
Test coverage, from CI run
devcapsuledevcapsule