From d5609a2dc37ec157d3ce98e956af964e1a736708 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sat, 11 Jul 2026 10:40:20 +0100 Subject: [PATCH] Re-pin frontend tests to the Patrol typed-action vocabulary The Patrol lifecycle work renamed the queued-fix copy (Review fix -> Recover action, proposed fix -> typed action, and the waiting-for- approval summaries) and reshaped ApprovalSection's badge constant, but the unit tests still asserted the old strings and identifiers, leaving build-and-test red on main since last night. Expectations now match the shipped source. ApprovalSection kept MetadataBadge and shared Button variants, so the primitive guardrails re-pin to its current shape (BADGE_PROPS, no warningSolid variant) rather than flagging a real regression. --- .../components/AI/__tests__/FindingsPanel.test.ts | 2 +- .../shared/SharedPrimitives.guardrails.test.ts | 3 +-- .../aiFindingPresentation.coverage2.test.ts | 12 ++++++------ .../src/utils/__tests__/aiFindingWorkType.test.ts | 4 ++-- .../__tests__/frontendResourceTypeBoundaries.test.ts | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts index db610e7293..27d8a24f2d 100644 --- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts +++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts @@ -1363,7 +1363,7 @@ describe('aiFindingPresentation', () => { ), ).toMatchObject({ stage: 'approval', - label: 'Review fix', + label: 'Recover action', tone: 'warning', }); }); diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts index 22e8ddcaaa..afbbb2acec 100644 --- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts +++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts @@ -2506,7 +2506,7 @@ describe('shared primitive guardrails', () => { expect(approvalBannerSource).toContain('APPROVAL_BANNER_BADGE_PROPS'); expect(approvalBannerSource).not.toContain('firstApprovalRisk()!.badgeClass'); expect(approvalSectionSource).toContain('MetadataBadge'); - expect(approvalSectionSource).toContain('APPROVAL_SECTION_BADGE_PROPS'); + expect(approvalSectionSource).toContain('BADGE_PROPS'); expect(approvalSectionSource).not.toContain('approvalRisk.badgeClass'); expect(approvalSectionSource).not.toContain('fixRisk.badgeClass'); expect(findingsPanelSource).toContain('MetadataBadge'); @@ -3377,7 +3377,6 @@ describe('shared primitive guardrails', () => { expect(approvalSectionSource).toContain('@/components/shared/Button'); expect(approvalSectionSource).toContain(' { expect(result?.stage).toBe('recorded'); }); - it('returns the approval stage with "Review fix" for fix_queued without a live approval', () => { + it('returns the approval stage with "Recover action" for fix_queued without a live approval', () => { const result = getFindingPatrolWorkflowPresentation( makeFinding({ id: 'f1', source: 'ai-patrol', status: 'active', resourceId: 'vm:1', investigationOutcome: 'fix_queued' }), ); expect(result?.stage).toBe('approval'); - expect(result?.label).toBe('Review fix'); + expect(result?.label).toBe('Recover action'); }); it('returns the verification stage for fix_executed', () => { @@ -740,7 +740,7 @@ describe('getPatrolFindingVerificationSummary (via getPatrolFindingRowScaffold)' it('reports waiting-for-approval for fix_queued', () => { expect(verificationValue({ investigationOutcome: 'fix_queued' })).toBe( - 'Waiting for approval before any fix runs.', + 'Waiting for the governed action record before any change runs.', ); }); @@ -853,15 +853,15 @@ describe('getPatrolFindingWorkflowSummary (via getPatrolFindingRowScaffold)', () expect( workflowValue({ id: 'f1' }, [liveApproval('f1')]), ).toBe( - 'Review evidence first; no change runs until the proposed fix is approved, then Patrol verifies the outcome.', + 'Review evidence first; no change runs until the typed action is approved, then Patrol verifies the outcome.', ); }); - it('returns the recover-queued-fix message for fix_queued without a live approval (Review fix stage)', () => { + it('returns the recover-queued-fix message for fix_queued without a live approval (Recover action stage)', () => { expect( workflowValue({ investigationOutcome: 'fix_queued' }), ).toBe( - 'Recover the queued fix before any action can run, then verify the outcome after a decision.', + 'Recover the queued action before any change can run, then verify the outcome after a decision.', ); }); diff --git a/frontend-modern/src/utils/__tests__/aiFindingWorkType.test.ts b/frontend-modern/src/utils/__tests__/aiFindingWorkType.test.ts index a85b20d3aa..f4cd889f56 100644 --- a/frontend-modern/src/utils/__tests__/aiFindingWorkType.test.ts +++ b/frontend-modern/src/utils/__tests__/aiFindingWorkType.test.ts @@ -182,7 +182,7 @@ describe('getPatrolFindingRowScaffold', () => { id: 'workflow', label: 'Safe workflow', value: - 'Review evidence first; no change runs until the proposed fix is approved, then Patrol verifies the outcome.', + 'Review evidence first; no change runs until the typed action is approved, then Patrol verifies the outcome.', }); expect( getPatrolFindingRowScaffold( @@ -196,7 +196,7 @@ describe('getPatrolFindingRowScaffold', () => { ).toContainEqual({ id: 'verification', label: 'Verification', - value: 'Waiting for approval before any fix runs.', + value: 'Waiting for the governed action record before any change runs.', }); }); diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts index 3dcc01f98a..94d0b238ad 100644 --- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts +++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts @@ -2055,7 +2055,7 @@ describe('frontend resource type boundaries', () => { expect(approvalBannerSource).toContain('APPROVAL_BANNER_BADGE_PROPS'); expect(approvalBannerSource).not.toContain('firstApprovalRisk()!.badgeClass'); expect(approvalSectionSource).toContain('MetadataBadge'); - expect(approvalSectionSource).toContain('APPROVAL_SECTION_BADGE_PROPS'); + expect(approvalSectionSource).toContain('BADGE_PROPS'); expect(approvalSectionSource).not.toContain('approvalRisk.badgeClass'); expect(approvalSectionSource).not.toContain('fixRisk.badgeClass'); expect(securityWarningSource).not.toContain('bg-red-50 dark:bg-red-900');