mirror of
https://github.com/stablyai/orca.git
synced 2026-10-20 00:03:45 +00:00
fix(checks): preserve refresh precedence and budget
This commit is contained in:
@@ -957,7 +957,8 @@ export default function ChecksPanel(): React.JSX.Element {
|
||||
const checksPanelReviewLookup = checksPanelReviewLookupResult.state
|
||||
const hasUnrenderedReviewEvidence =
|
||||
checksPanelReviewLookup === 'positive_unresolved' ||
|
||||
hostedReviewCreation?.blockedReason === 'existing_review'
|
||||
(checksPanelReviewLookup !== 'found' &&
|
||||
hostedReviewCreation?.blockedReason === 'existing_review')
|
||||
const unrenderedReviewEvidenceIdentity =
|
||||
linkedReviewNumber ??
|
||||
hostedReview?.number ??
|
||||
|
||||
@@ -167,6 +167,17 @@ describe('getChecksPanelReviewState — precedence', () => {
|
||||
expect(state.title).toBe('No upstream configured')
|
||||
})
|
||||
|
||||
it('a safety blocker still owns the copy over positive evidence and an in-flight fetch', () => {
|
||||
const state = getChecksPanelReviewState(
|
||||
input({
|
||||
eligibilityBlockedReason: 'dirty',
|
||||
reviewLookup: 'positive_unresolved',
|
||||
refresh: { status: 'in-flight' }
|
||||
})
|
||||
)
|
||||
expect(state.title).toBe('Commit changes first')
|
||||
})
|
||||
|
||||
it('hard refresh error hides the composer', () => {
|
||||
const state = getChecksPanelReviewState(
|
||||
input({ refresh: { status: 'error', errorType: 'auth' } })
|
||||
|
||||
@@ -74,12 +74,14 @@ export function getChecksPanelReviewState(
|
||||
|
||||
const blockedReason = input.eligibilityBlockedReason
|
||||
|
||||
// 1.5 Keep active positive-review lookups self-updating; concurrent branch blockers still own their guidance.
|
||||
// 1.5 Keep active positive-review lookups self-updating without hiding stronger safety guidance.
|
||||
const reviewFetchInFlight =
|
||||
input.refresh?.status === 'queued' || input.refresh?.status === 'in-flight'
|
||||
const hasPendingReviewEvidence =
|
||||
input.reviewLookup === 'positive_unresolved' || blockedReason === 'existing_review'
|
||||
if (reviewFetchInFlight && hasPendingReviewEvidence && !isBranchBlocker(blockedReason)) {
|
||||
const pendingReviewLookupOwnsState =
|
||||
blockedReason === undefined || blockedReason === 'existing_review'
|
||||
if (reviewFetchInFlight && hasPendingReviewEvidence && pendingReviewLookupOwnsState) {
|
||||
return {
|
||||
renderReview: false,
|
||||
title: translate(
|
||||
|
||||
@@ -45,6 +45,17 @@ describe('resolveChecksPanelPRRefreshRequest', () => {
|
||||
).toEqual({ reason: 'swr', priority: 30 })
|
||||
})
|
||||
|
||||
it('does not force provider work when review details are already cached', () => {
|
||||
expect(
|
||||
resolveChecksPanelPRRefreshRequest({
|
||||
cachedHasPR: true,
|
||||
cachedFetchedAt: 100,
|
||||
panelVisibleSince: 200,
|
||||
hasUnrenderedReviewEvidence: true
|
||||
})
|
||||
).toEqual({ reason: 'swr', priority: 30 })
|
||||
})
|
||||
|
||||
it('keeps populated or unknown cache entries on the background path', () => {
|
||||
expect(
|
||||
resolveChecksPanelPRRefreshRequest({
|
||||
|
||||
@@ -22,10 +22,12 @@ export function resolveChecksPanelPRRefreshRequest(
|
||||
input.cachedFetchedAt !== null &&
|
||||
input.panelVisibleSince !== null &&
|
||||
input.cachedFetchedAt < input.panelVisibleSince
|
||||
const unresolvedEvidenceNeedsForeground =
|
||||
input.hasUnrenderedReviewEvidence && input.cachedHasPR !== true
|
||||
|
||||
if (
|
||||
!input.hasRequestedForegroundRefresh &&
|
||||
(cachedMissPredatesVisiblePanel || input.hasUnrenderedReviewEvidence)
|
||||
(cachedMissPredatesVisiblePanel || unresolvedEvidenceNeedsForeground)
|
||||
) {
|
||||
// A stale miss or new positive evidence needs one foreground lookup to recover.
|
||||
return { reason: 'active', priority: 80 }
|
||||
|
||||
Reference in New Issue
Block a user