Skip to content

fix: show checks summary when all checks were cancelled#13679

Open
s3onghyun wants to merge 2 commits into
cli:trunkfrom
s3onghyun:fix-checks-cancelled-only
Open

fix: show checks summary when all checks were cancelled#13679
s3onghyun wants to merge 2 commits into
cli:trunkfrom
s3onghyun:fix-checks-cancelled-only

Conversation

@s3onghyun

@s3onghyun s3onghyun commented Jun 18, 2026

Copy link
Copy Markdown

Description

gh pr checks prints a blank summary when a PR's only checks were cancelled.

printSummary (pkg/cmd/pr/checks/output.go) gates the summary block on:

if counts.Failed+counts.Passed+counts.Skipping+counts.Pending > 0 {

counts.Canceled is omitted, so a cancelled-only result sums to 0, the block is skipped, and the else 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.Canceled to 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.

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>
@s3onghyun s3onghyun requested a review from a team as a code owner June 18, 2026 12:37
@s3onghyun s3onghyun requested a review from BagToad June 18, 2026 12:37
@github-actions github-actions Bot added external pull request originating outside of the CLI core team needs-triage needs to be reviewed unmet-requirements and removed needs-triage needs to be reviewed labels Jun 18, 2026
@github-actions

Copy link
Copy Markdown

Thanks for your pull request! Unfortunately, it doesn't meet the requirements for review:

  • No linked help wanted issue found in PR description

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
  1. Include a detailed description of what this PR does
  2. Link to an issue with the help wanted label (use Fixes #123 or Closes #123)

@s3onghyun

Copy link
Copy Markdown
Author

I've opened #13680 describing the bug. This is a small, self-contained fix with a regression test, but I understand the contribution policy expects a triaged help wanted issue first — happy to wait for triage on #13680, and I'll re-link if needed. Thanks!

@babakks babakks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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
}{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 thread pkg/cmd/pr/checks/output_test.go Outdated
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")
})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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>
@s3onghyun

Copy link
Copy Markdown
Author

Thanks @babakks! Addressed both:

  • TestPrintSummary is now a table test covering every summary branch: no checks, all successful, some failed, some pending, and cancelled.
  • Removed the separate cancelled-only is not silently empty subtest — the table's "only cancelled" case (which fails on the pre-fix code) covers that regression.

go test ./pkg/cmd/pr/checks/ is green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team ready-for-review unmet-requirements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants