mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 02:17:31 +00:00
fix(source-control): say when the review lookup failed instead of "not ready" (#36458)
A ready branch whose MR/PR lookup failed was told it wasn't ready, hiding the real problem. Refs #35632
This commit is contained in:
+26
@@ -532,6 +532,32 @@ describe('resolvePrimaryAction Create PR intent', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('names a failed review lookup instead of calling a ready branch not ready', () => {
|
||||
expect(
|
||||
resolveCreatePrHeaderAction(
|
||||
inputs({
|
||||
upstreamStatus: upstreamInSync,
|
||||
hostedReviewCreation: {
|
||||
provider: 'gitlab',
|
||||
review: null,
|
||||
reviewLookupOutcome: 'unavailable',
|
||||
defaultBaseRef: 'origin/main',
|
||||
head: 'feature',
|
||||
canCreate: false,
|
||||
blockedReason: null,
|
||||
nextAction: null
|
||||
}
|
||||
})
|
||||
)
|
||||
).toEqual({
|
||||
kind: 'create_pr',
|
||||
label: 'Create MR',
|
||||
title:
|
||||
'Create MR failed: Orca could not confirm whether this branch already has a merge request. Retry once the GitLab lookup succeeds.',
|
||||
disabled: true
|
||||
})
|
||||
})
|
||||
|
||||
it('returns a clickable Create PR header notice path when the branch has nothing to publish yet', () => {
|
||||
expect(
|
||||
resolveCreatePrHeaderAction(
|
||||
|
||||
+12
-6
@@ -11,7 +11,10 @@ import type {
|
||||
} from '../../../../../../shared/hosted-review'
|
||||
import type { PrimaryAction, PrimaryActionInputs } from '../../source-control-primary-action-types'
|
||||
import { resolveCreatePrIntentEligibility } from './create-pr-intent-state'
|
||||
import { canClickBlockedCreateReviewReason } from '../../source-control-create-review-blocked-action'
|
||||
import {
|
||||
canClickBlockedCreateReviewReason,
|
||||
resolveBlockedCreateReviewNoticeMessage
|
||||
} from '../../source-control-create-review-blocked-action'
|
||||
|
||||
export function resolveProvisionalHostedReviewProvider(input: {
|
||||
hostedReview?: Pick<HostedReviewInfo, 'provider'> | null
|
||||
@@ -175,11 +178,14 @@ export function resolveDisabledCreatePrHeaderAction(
|
||||
case 'unsupported_provider':
|
||||
case 'base_not_on_remote':
|
||||
case null:
|
||||
title = translate(
|
||||
'auto.components.right.sidebar.source.control.primary.action.f0c6e2a581',
|
||||
'This branch is not ready for a {{value0}} yet.',
|
||||
{ value0: copy.reviewLabel }
|
||||
)
|
||||
// A failed review lookup is not a branch problem, so name it instead.
|
||||
title =
|
||||
resolveBlockedCreateReviewNoticeMessage(hostedReviewCreation) ??
|
||||
translate(
|
||||
'auto.components.right.sidebar.source.control.primary.action.f0c6e2a581',
|
||||
'This branch is not ready for a {{value0}} yet.',
|
||||
{ value0: copy.reviewLabel }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user