fix: show checks summary when all checks were cancelled#13679
Open
s3onghyun wants to merge 2 commits into
Open
fix: show checks summary when all checks were cancelled#13679s3onghyun wants to merge 2 commits into
s3onghyun wants to merge 2 commits into
Conversation
printSummary gated the summary block on Failed+Passed+Skipping+Pending > 0, omitting Canceled. For a PR whose only checks were cancelled, the summary (and the 'Some checks were cancelled' message) was skipped, printing a blank line. Include Canceled in the guard. Signed-off-by: Seonghyun Hong <s3onghyun.hong@gmail.com>
|
Thanks for your pull request! Unfortunately, it doesn't meet the requirements for review:
Please update your PR to address the above. This PR will be automatically closed in 4 days if these requirements are not met. Full contribution requirements
|
Author
babakks
requested changes
Jun 19, 2026
babakks
left a comment
Member
There was a problem hiding this comment.
Thanks for the PR, @s3onghyun! 🙏
Changes look good. Just a few comments.
Comment on lines
+12
to
+16
| tests := []struct { | ||
| name string | ||
| counts checkCounts | ||
| want string | ||
| }{ |
Member
There was a problem hiding this comment.
Now that we're adding a test for printSummary, let's cover all code paths in the summary line if-statements, i.e.:
if counts.Failed+counts.Passed+counts.Skipping+counts.Pending+counts.Canceled > 0 {
if counts.Failed > 0 {
summary = "Some checks were not successful"
} else if counts.Pending > 0 {
summary = "Some checks are still pending"
} else if counts.Canceled > 0 {
summary = "Some checks were cancelled"
} else {
summary = "All checks were successful"
}
Comment on lines
+45
to
+55
| // Regression guard: a check set containing only cancelled checks must still | ||
| // produce a summary. Before the fix, the guard in printSummary omitted | ||
| // counts.Canceled, so a cancelled-only result printed an empty summary. | ||
| t.Run("cancelled-only is not silently empty", func(t *testing.T) { | ||
| ios, _, stdout, _ := iostreams.Test() | ||
| ios.SetStdoutTTY(true) | ||
|
|
||
| printSummary(ios, checkCounts{Canceled: 1}) | ||
|
|
||
| assert.Contains(t, stdout.String(), "Some checks were cancelled") | ||
| }) |
Member
There was a problem hiding this comment.
This is not needed. Please remove it.
Address review: expand TestPrintSummary to exercise every summary path (no checks, all successful, failed, pending, cancelled) and drop the redundant separate regression case. Signed-off-by: Seonghyun Hong <s3onghyun.hong@gmail.com>
Author
|
Thanks @babakks! Addressed both:
|
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.
Description
gh pr checksprints a blank summary when a PR's only checks were cancelled.printSummary(pkg/cmd/pr/checks/output.go) gates the summary block on:counts.Canceledis omitted, so a cancelled-only result sums to 0, the block is skipped, and theelse if counts.Canceled > 0 { "Some checks were cancelled" }branch becomes unreachable in exactly the case it was written for. The existing "some cancelled" test masked this by pairing a cancelled check with passing ones.Fix
Add
counts.Canceledto the guard.Testing
Added
TestPrintSummary(output_test.go) with a cancelled-only case asserting the "Some checks were cancelled" summary renders. Fails before, passes after;go test ./pkg/cmd/pr/checks/green.Reported in #13680.