refactor: share check status mapping between host-service and desktop
Summary
Host-service and the desktop pull request view each had a copy of two functions:
- GitHub check run status and conclusion →
success / failure / pending / skipped / cancelled - a list of checks → one overall status
The copies drifted. The desktop mapped STARTUP_FAILURE to failure, host-service did not, so a check that never started kept a PR pending (#8962, fixed in #8963).
This moves both functions to a new @superset/shared/pull-request-checks module and uses it from:
packages/host-service/.../pull-request-mappers.ts(parseCheckContexts),pull-requests.ts, andtrpc/router/pull-requests/pull-request-checks.tsapps/desktop/.../pull-requests/utils/toPullRequestDetail.ts
Host-service's local ChecksStatus and PullRequestCheck types now come from @superset/shared/pull-request. They have the same values, so the tRPC output does not change.
Not changed on purpose
- v2 workspace
computeChecksRollup: it also counts checks, rolls up all-skipped tonone, and maps unknown conclusions tofailure. Sharing it would change what the UI shows. - Mobile
effectiveCheckStatus: a different vocabulary (needs-action,ignored, neutral counts as passed). - v1
pr-resolution.ts: v1 is being sunset.
Tests
- The aggregate tests moved from host-service into
pull-request-checks.test.ts, plus one table test over every conclusion. Removing theSTARTUP_FAILUREcase makes it fail (7 pass, 1 fail). packages/sharedpull-request-checks: 8 pass.packages/host-servicepull-requests: 187 pass.apps/desktoppull-requests: 66 pass.tscpasses inpackages/sharedandpackages/host-service. Desktoptsclocally reports only TS1149 path-casing errors inpackages/chat-runtimecaused by my worktree path, none in changed files; CI will confirm.biome checkclean on the changed files.
Summary by cubic
Consolidates the GitHub check status and aggregate rollup logic that was duplicated between host-service and the desktop pull request view into a new @superset/shared/pull-request-checks module.
The copies had drifted: the desktop mapped STARTUP_FAILURE to failure, host-service did not, so a check that never started kept a PR pending indefinitely. Both packages now import checkRunStatus and computeChecksStatus from the shared module, and host-service's ChecksStatus and PullRequestCheck types come from @superset/shared/pull-request with identical values, so the tRPC output is unchanged.
Not shared on purpose
- The v2 workspace
computeChecksRollupand mobileeffectiveCheckStatusstay local because they count checks differently (skipped/neutral handling, additional statuses likeneeds-action). - Test coverage for both functions moved into
pull-request-checks.test.ts, including a table test over every GitHub conclusion.
Summary by CodeRabbit
- Bug Fixes
- Pull request check summaries now consistently reflect failed, cancelled, pending, and successful checks.
- Skipped checks are treated as successful when determining the overall status; an empty check list is shown as having no status.