fix(pipeline): exclude deleted files from reviewer coverage - #570
Open
piekstra wants to merge 1 commit into
Open
fix(pipeline): exclude deleted files from reviewer coverage#570piekstra wants to merge 1 commit into
piekstra wants to merge 1 commit into
Conversation
A PR that deletes files could never be approved by cr. Deleted paths are in the diff and get assigned to a reviewer, but a reviewer cannot inspect a file that no longer exists at head, so it reports the path skipped. That marked the reviewer's coverage incomplete_skipped, and buildReview coerces an APPROVE to a COMMENT whenever any reviewer coverage is incomplete. The result: a review with zero findings posts as a comment, and on a branch requiring one approval the PR is unmergeable. Exclude deleted paths (FilePatch.Deleted) from the coverage-completeness decision: a skipped or unassigned deletion is no longer a gap, since there is nothing at head to inspect. Skipped files are still reported in full for transparency; only the status decision drops deletions.
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.
Problem
A PR that deletes files can never be approved by cr — it always posts as a comment, even with zero findings.
Chain:
buildReviewerCoveragemarks that reviewerincomplete_skipped(pipeline.go).buildReview(reviewplan.go) coerces anAPPROVEtoCOMMENTwhenever any reviewer coverage is incomplete.Observed in the wild on two PRs that delete files (a legacy router removal; a Create-React-App → Vite migration): every re-review, including local
--rerun, producedoutcome: commentwith 0 findings across all reviewers, solely because one reviewer skipped a deleted file. A sibling PR with no deletions approved normally.Fix
Exclude deleted paths (
FilePatch.Deleted) from the coverage-completeness decision inbuildReviewerCoverage:incomplete_skipped.incomplete_unassignedgap.The deletion set is derived at the call site from
prepared.parsed.Patchesand threaded intobuildReviewerCoverage.Tests
TestBuildReviewerCoverageIgnoresSkippedDeletedFiles— a reviewer skipping a deleted file stayscomplete, and the skip is still surfaced.TestBuildReviewerCoverageDeletedUnassignedFileIsNotAGap— an unassigned deletion doesn't create anunassignedcoverage entry.buildReviewerCoveragetests updated for the new parameter.make lintandmake testpass. Verified end-to-end by building the patched binary and re-reviewing a real deletion PR: the clean review now postsapproveinstead ofcomment.