Skip to content

feat(worker): respect custom patch target in PR comment indicator - #1380

Open
yuvalgnessin-qz wants to merge 1 commit into
codecov:mainfrom
yuvalgnessin-qz:fix/comment-patch-target-indicator
Open

yuvalgnessin-qz wants to merge 1 commit into
codecov:mainfrom
yuvalgnessin-qz:fix/comment-patch-target-indicator

Conversation

@yuvalgnessin-qz

@yuvalgnessin-qz yuvalgnessin-qz commented Jul 1, 2026 •

Copy link
Copy Markdown

I originally reported this in codecov/feedback#54 (comment)

The solution is AI-generated and so is the PR Summary below. If that's against the policy, I totally get it - feel free to close.

AI Below

Make the PR comment's patch-coverage indicator respect a custom coverage.status.patch target instead of hardcoding the checkmark to 100% patch coverage.

Problem. The comment's patch line shows ✅ only when there are zero missed/partial lines in the diff (HeaderSectionWriter, sections.py — if misses_and_partials:). A team that sets, say, coverage.status.patch.default.target: 90% gets a passing codecov/patch check but still a red ❌ in the comment at 91% patch coverage. Reported in codecov/feedback#54.

Change. When a custom patch target is configured and patch coverage meets it (respecting threshold), the comment's patch line shows ✅ (and still reports the count of lines missing coverage). auto/unset targets keep the historical 100%-only checkmark, so existing comments are unchanged. This mirrors StatusPatchMixin so the comment agrees with the status check.

Scope. HeaderSectionWriter only. TeamPlanWriter intentionally ignores yaml config (patch-only lightweight plan) and is left as-is.

Tests. Added two TestNewHeaderSectionWriter cases (custom target met → ✅; not met → ❌). ruff check and ruff format pass.

Refs: codecov/feedback#54

Legal Boilerplate

Look, I get it. The entity doing business as "Codecov" is owned by Harness, Inc. In 2026 Harness acquired Codecov and as a result Harness is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Harness can use, modify, copy, and redistribute my contributions, under Harness's choice of terms.

The comment's patch line hardcoded the checkmark to 100% patch coverage,
so a team that sets a custom coverage.status.patch target still saw a red
X in the PR comment even when the codecov/patch status check passed.

Reflect the configured default patch target (and threshold) when choosing
the patch-line indicator, so the comment agrees with the status check. An
auto/unset target keeps the historical 100%-only checkmark, so existing
comments are unchanged. Scoped to HeaderSectionWriter; TeamPlanWriter
intentionally ignores yaml config and is left as-is.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@yuvalgnessin-qz
yuvalgnessin-qz marked this pull request as ready for review July 1, 2026 20:27

This branch has not been deployed

No deployments
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