mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 10:58:10 +00:00
Distinguish cancelled PR checks from failures (#37789)
Show cancelled PR checks as Cancelled with separate counts on desktop and mobile, preserving genuine failures, pending checks, existing action permissions and older-client fallback. Carry complete provider summaries through caches and presentation; preserve Azure source completeness, folder attention priority and muted cancellation details. Tracked in #15847 and STA-5102.
This commit is contained in:
@@ -70,7 +70,9 @@ export async function getFallbackPRListForBranch(
|
||||
{ ...ghOptions, ...githubHostExecOptions(prRepo) }
|
||||
)
|
||||
const list = JSON.parse(stdout) as PullRequestLookupData[]
|
||||
return preferOpenPullRequest(list) ?? null
|
||||
const pr = preferOpenPullRequest(list)
|
||||
// Branch lists paginate PRs, not their nested check contexts.
|
||||
return pr ? { ...pr, checksUnavailable: true } : null
|
||||
}
|
||||
|
||||
export async function hydrateBranchLookupWithExactPR(
|
||||
@@ -186,8 +188,12 @@ export async function lookupPRByBranchName(args: {
|
||||
['pr', 'view', args.branchName, '--json', PR_LOOKUP_JSON_FIELDS],
|
||||
args.ghOptions
|
||||
)
|
||||
const parsedData: PullRequestLookupData = JSON.parse(stdout)
|
||||
const lookup = {
|
||||
data: normalizePullRequestLookupData(JSON.parse(stdout) as PullRequestLookupData),
|
||||
data: normalizePullRequestLookupData({
|
||||
...parsedData,
|
||||
checksUnavailable: false
|
||||
}),
|
||||
dataRepo: null
|
||||
}
|
||||
return !args.policy || (await args.policy.accepts(lookup.data, null))
|
||||
|
||||
@@ -97,6 +97,7 @@ export async function getPRByNumber(
|
||||
{
|
||||
...knownPullRequestData,
|
||||
...exactData,
|
||||
checksUnavailable: false,
|
||||
...(knownPullRequestData?.stack ? { stack: knownPullRequestData.stack } : {})
|
||||
},
|
||||
ghOptions,
|
||||
@@ -169,8 +170,12 @@ export async function lookupPRByNumber(args: {
|
||||
['pr', 'view', String(args.number), '--json', PR_LOOKUP_JSON_FIELDS],
|
||||
args.ghOptions
|
||||
)
|
||||
const parsedData: PullRequestLookupData = JSON.parse(stdout)
|
||||
const lookup = {
|
||||
data: normalizePullRequestLookupData(JSON.parse(stdout) as PullRequestLookupData),
|
||||
data: normalizePullRequestLookupData({
|
||||
...parsedData,
|
||||
checksUnavailable: false
|
||||
}),
|
||||
dataRepo: null
|
||||
}
|
||||
return !args.policy || (await args.policy.accepts(lookup.data, null))
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { summarizePRCheckRollup } from '../../../../shared/pr-check-status'
|
||||
import type { PRRefreshOutcome } from '../../../../shared/github/pull-request-refresh-types'
|
||||
import type {
|
||||
PRConflictSummary,
|
||||
PRMergeableState,
|
||||
GitHubPRStack
|
||||
} from '../../../../shared/github/pull-request-types'
|
||||
import { deriveCheckStatus, mapPRState } from '../../mappers'
|
||||
import { mapPRState } from '../../mappers'
|
||||
import type { OwnerRepo } from '../../gh-utils'
|
||||
import type { PullRequestLookupData } from './pull-request-lookup-data'
|
||||
|
||||
@@ -30,6 +31,7 @@ export function assemblePRRefreshFoundOutcome(args: {
|
||||
headDivergedFromMergedPRAtOid,
|
||||
conflictSummary
|
||||
} = args
|
||||
const checksSummary = summarizePRCheckRollup(data.statusCheckRollup)
|
||||
return {
|
||||
kind: 'found',
|
||||
fetchedAt: Date.now(),
|
||||
@@ -38,7 +40,8 @@ export function assemblePRRefreshFoundOutcome(args: {
|
||||
title: data.title,
|
||||
state: mapPRState(data.state, data.isDraft),
|
||||
url: data.url,
|
||||
checksStatus: deriveCheckStatus(data.statusCheckRollup),
|
||||
checksStatus: checksSummary.state === 'none' ? 'neutral' : checksSummary.state,
|
||||
...(data.checksUnavailable === false ? { checksSummary } : {}),
|
||||
updatedAt: data.updatedAt,
|
||||
mergeable,
|
||||
...(data.reviewDecision !== undefined ? { reviewDecision: data.reviewDecision } : {}),
|
||||
|
||||
@@ -24,6 +24,7 @@ export type PullRequestLookupData = {
|
||||
state: string
|
||||
url: string
|
||||
statusCheckRollup: unknown[]
|
||||
checksUnavailable?: boolean
|
||||
updatedAt: string
|
||||
isDraft?: boolean
|
||||
mergeable: string
|
||||
@@ -131,6 +132,7 @@ export function mapRestPullRequest(pr: RestPullRequest): PullRequestLookupData {
|
||||
state: pr.merged_at ? 'MERGED' : pr.state,
|
||||
url: pr.html_url ?? pr.url ?? '',
|
||||
statusCheckRollup: [],
|
||||
checksUnavailable: true,
|
||||
updatedAt: pr.updated_at ?? '',
|
||||
isDraft: pr.draft,
|
||||
mergeable: mapRestPRMergeable(pr),
|
||||
|
||||
@@ -249,6 +249,7 @@ export async function readPullRequestSidebarQuery(
|
||||
baseRefOid: pr.baseRefOid ?? undefined,
|
||||
headRefOid: pr.headRefOid ?? undefined,
|
||||
statusCheckRollup,
|
||||
checksUnavailable: false,
|
||||
stackMetadataChecked,
|
||||
stack:
|
||||
stackMetadataChecked && validStack
|
||||
|
||||
Reference in New Issue
Block a user