fix(desktop,shared): keep the checks summary pending while checks still run
What & why
Fixes #8814.
The checks rollup put a cancelled check above pending checks, so a cancelled check made the summary red even while other checks were still running. A common cause is concurrency: cancel-in-progress: a new run on the same commit cancels the older one while the rest of CI keeps going.
The screenshot in the issue shows this. The sidebar hover card shows × 1/5 checks with four running rows and one passed row. ChecksList and ChecksSummary hide cancelled rows, so the check that turned the header red is not in the list.
Order of the rollup now:
- A real failure (
failure/ERROR/TIMED_OUT) is red at once, as before. - Any pending check is pending.
- A cancelled check is red once nothing is pending, as before.
- Otherwise success.
Only the case "cancelled and pending, no real failure" changes, from failure to pending. A PR whose only non-passing check is cancelled still goes red when CI settles, so #5667 does not come back.
The three rollups change together so the sidebar dots, the Review tab and the v1 sidebar agree:
packages/shared/src/pull-request-checkscomputeChecksStatus, shared by host-service and the desktop PR view since #9161 (storedchecksStatus: sidebar and board dots, hover card header)apps/desktop/.../v2-workspace/$workspaceId/utils/computeChecksStatuscomputeChecksRollup(Review tab, PR status group).failureCountstill includes cancelled checks, so "N of M checks failing" does not change once the checks settle.apps/desktop/.../workspaces/utils/github/pr-resolution.tscomputeChecksStatus(v1ghpath)
Note: GitHub's own statusCheckRollup.state reports FAILURE for a cancelled check while another check is still pending (for example sveltejs/svelte#19070: one CANCELLED check run plus one PENDING status context gives FAILURE). This PR does not follow that rule, because a cancelled run is not a verdict on the code, and the issue asks for yellow while checks still run. For real failures, the rollup still matches GitHub: a FAILURE beats IN_PROGRESS.
How I tested it
I wrote the tests first. Each package gets one regression test, pending beats cancelled while other checks still run (success + pending + cancelled gives pending). Before the fix all three failed with Expected: "pending", Received: "failure". The two existing tests that kept the old order ("cancelled beats pending") are replaced by it.
packages/shared:bun test src/pull-request-checks: 8 pass, 0 fail (after the rebase onto #9161, which moved the host-service rollup here)apps/desktop:bun test src/lib/trpc/routers/workspaces/utils/github 'src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/utils/computeChecksStatus': 54 pass, 0 failbun run typecheckinpackages/host-serviceandapps/desktop: no errorsbiome check .(Biome 2.4.2, same asbun run lint): no diagnostics
The full package suites were run on Windows. They have failures that are not related to this change: symlinks, POSIX permissions, PATH and real-git timeouts, and a source-path scan in pullRequestLinkSurfaces.test.ts that fails the same way on main. No failing test touches the rollups.
Not checked in the running app, so there is no screenshot. The change is limited to the three pure rollup functions.
Checklist
- PR title follows conventional commits (
type(scope): subject) -
bun run lintandbun run typecheckpass (CI fails on lint warnings too) - "Allow edits from maintainers" is checked on fork PRs
Summary by CodeRabbit
- Bug Fixes
- Pull request check status now remains pending when checks include both pending and cancelled results, unless a failed check is present.
- Failed checks take precedence over pending and cancelled checks. Cancelled checks still count toward the failure total, and result in a failure status when there are no failed or pending checks.