Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(acceptance): hide iteration history for first execution (#19891)

AmAzing-d35eefd357d2
diff --git a/src/features/Acceptance/Viewer/Checks/CheckRow.tsx b/src/features/Acceptance/Viewer/Checks/CheckRow.tsx
index 517138cadaf..7b48eb11162 100644
--- a/src/features/Acceptance/Viewer/Checks/CheckRow.tsx
+++ b/src/features/Acceptance/Viewer/Checks/CheckRow.tsx
@@ -56,7 +56,7 @@ import {
} from './CheckHistory';
import { shouldCollapseAfterReview, userReviewState } from './checkState';
import { STATE_META } from './checkStatus';
-import { splitCheckReviews } from './readPresentation';
+import { hasCheckHistory, splitCheckReviews } from './readPresentation';
import { checkRowDisclosure } from './rowDisclosure';
import { styles } from './styles';
import type { AcceptanceCheck, CheckReviewInput, ProposalDismissInput } from './types';
@@ -145,7 +145,7 @@ export const AcceptanceCheckRow = memo<{
});
return map.size > 0 ? map : undefined;
}, [proposalOpen, check.prediction]);
- const hasHistory = check.revisions > 1 || historyReviews.length > 0;
+ const hasHistory = hasCheckHistory(check, historyReviews);
// Collaboration: threads circled on this check's evidence. Only inside the
// viewer — the row also renders in hosts with no acceptance scope.
diff --git a/src/features/Acceptance/Viewer/Checks/readPresentation.test.ts b/src/features/Acceptance/Viewer/Checks/readPresentation.test.ts
index 8393d011002..df18d76e451 100644
--- a/src/features/Acceptance/Viewer/Checks/readPresentation.test.ts
+++ b/src/features/Acceptance/Viewer/Checks/readPresentation.test.ts
@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';
import {
collectGroupFeedback,
+ hasCheckHistory,
historicalEvidenceContext,
splitCheckReviews,
} from './readPresentation';
@@ -54,6 +55,36 @@ describe('read-only check presentation', () => {
expect(splitCheckReviews(check)).toEqual({ historyReviews: reviews });
});
+ it.each([
+ { expected: false, label: 'not executed', rounds: [] },
+ { expected: false, label: 'first execution', rounds: [1] },
+ { expected: false, label: 'first execution in a later round', rounds: [3] },
+ { expected: true, label: 'two executions with a skipped round', rounds: [1, 3] },
+ ])('shows history only for prior results: $label', ({ expected, rounds }) => {
+ const check = {
+ revisions: rounds.length,
+ // The backend includes the current result, not just previous results.
+ timeline: rounds.map((roundIndex) => ({ roundIndex })),
+ } as AcceptanceCheck;
+
+ expect(hasCheckHistory(check, [])).toBe(expected);
+ });
+
+ it.each([
+ { expected: false, label: 'only the standing verdict', stale: false },
+ { expected: true, label: 'feedback consumed without rerunning the check', stale: true },
+ ])('preserves review-only history: $label', ({ expected, stale }) => {
+ const check = {
+ reviews: [{ id: 'review', roundIndex: 1 }],
+ revisions: 1,
+ timeline: [{ roundIndex: 1 }],
+ userReview: { action: 'reject', stale },
+ } as AcceptanceCheck;
+ const { historyReviews } = splitCheckReviews(check);
+
+ expect(hasCheckHistory(check, historyReviews)).toBe(expected);
+ });
+
it('resolves a replaced region to its original evidence and round', () => {
const oldEvidence = { id: 'old-image', type: 'screenshot' };
const check = {
diff --git a/src/features/Acceptance/Viewer/Checks/readPresentation.ts b/src/features/Acceptance/Viewer/Checks/readPresentation.ts
index 8789d79ea21..3794f9dcf18 100644
--- a/src/features/Acceptance/Viewer/Checks/readPresentation.ts
+++ b/src/features/Acceptance/Viewer/Checks/readPresentation.ts
@@ -26,6 +26,11 @@ export const splitCheckReviews = (
};
};
+export const hasCheckHistory = (
+ check: AcceptanceCheck,
+ historyReviews: AcceptanceCheckReviewEntry[],
+): boolean => check.revisions > 1 || historyReviews.length > 0;
+
export const historicalEvidenceContext = (
check: AcceptanceCheck,
evidenceId: string | null | undefined,
diff --git a/src/features/Acceptance/Viewer/ReadOnly/Checks.tsx b/src/features/Acceptance/Viewer/ReadOnly/Checks.tsx
index 356b7669261..1f29871ef16 100644
--- a/src/features/Acceptance/Viewer/ReadOnly/Checks.tsx
+++ b/src/features/Acceptance/Viewer/ReadOnly/Checks.tsx
@@ -14,6 +14,7 @@ import { checkHeadMeta } from '../Checks/checkStatus';
import { GroupFeedbackTrail } from '../Checks/GroupFeedbackTrail';
import {
collectGroupFeedback,
+ hasCheckHistory,
historicalEvidenceContext,
splitCheckReviews,
} from '../Checks/readPresentation';
@@ -83,7 +84,7 @@ const ReadCheck = ({
const visualization = readVisualizationManifest(check.result?.metadata);
const evidenceById = collectEvidenceById(check);
const { activeReview, historyReviews } = splitCheckReviews(check);
- const hasHistory = check.timeline.length > 0 || historyReviews.length > 0;
+ const hasHistory = hasCheckHistory(check, historyReviews);
return (
<details