From b85c4473e86d0552aaef96261d3c374b7ec17c71 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Mon, 23 Mar 2026 10:10:20 +0000 Subject: [PATCH] Hide empty investigation context --- .../internal/subsystems/unified-resources.md | 5 +++++ .../ResourceDetailDrawer.history.test.tsx | 22 +++++++++++++++---- .../useResourceDetailDrawerDerivedState.ts | 21 ++++++++++++++++-- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md index 862b7bf76..1dd5d2386 100644 --- a/docs/release-control/v6/internal/subsystems/unified-resources.md +++ b/docs/release-control/v6/internal/subsystems/unified-resources.md @@ -213,6 +213,11 @@ The drawer investigation summary line also follows that boundary now: default `Cloud Summary` routing is not repeated in the collapsed summary text, while non-default routing still appears when it materially changes how the operator should read the resource. +The drawer now also suppresses the investigation-context section entirely when +Patrol returns only generic baseline health with no notes, changes, +correlations, dependencies, or other non-default governance signal. The +canonical resource surface should not advertise AI context unless there is +actual investigative value to show. The shared routing policy itself now stays intentionally minimal: it carries only the routing scope and the redaction hints derived from canonical sensitivity, and the cloud-summary decision is derived from that scope diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx index 8b8e4f53e..889aa3dc4 100644 --- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx +++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx @@ -354,6 +354,22 @@ describe('ResourceDetailDrawer change history section', () => { }); it('keeps default internal cloud-summary posture out of the investigation context drawer block', async () => { + aiIntelligenceMock.getResourceIntelligence.mockResolvedValueOnce({ + resource_id: 'agent-default-policy', + health: { + score: 100, + grade: 'A', + trend: 'stable', + factors: [], + prediction: '', + }, + dependencies: [], + dependents: [], + correlations: [], + recent_changes: [], + note_count: 0, + }); + const resource = baseResource({ id: 'agent-default-policy', name: 'default-policy-host', @@ -369,10 +385,8 @@ describe('ResourceDetailDrawer change history section', () => { render(() => ); - await screen.findByText('Investigation context'); - expect(screen.queryByText('Routing Cloud Summary')).toBeNull(); - fireEvent.click(screen.getByRole('button', { name: 'Show context' })); - + await screen.findByText('Current state'); + expect(screen.queryByText('Investigation context')).toBeNull(); expect(screen.queryByText('Data Governance')).toBeNull(); expect(screen.queryByText('AI-Safe Summary')).toBeNull(); expect(screen.queryByText('Routing Cloud Summary')).toBeNull(); diff --git a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts index cc9fc8d53..57d738561 100644 --- a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts +++ b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts @@ -181,6 +181,22 @@ export const useResourceDetailDrawerDerivedState = ( const resourceDependencies = createMemo(() => resourceIntelligence()?.dependencies ?? []); const resourceDependents = createMemo(() => resourceIntelligence()?.dependents ?? []); const resourceCorrelations = createMemo(() => resourceIntelligence()?.correlations ?? []); + const hasMeaningfulResourceIntelligence = createMemo(() => { + const intel = resourceIntelligence(); + if (!intel) return false; + + return ( + (intel.health.score ?? 100) < 100 || + intel.health.trend !== 'stable' || + (intel.health.prediction?.trim() ?? '') !== '' || + (intel.health.factors?.length ?? 0) > 0 || + (intel.note_count ?? 0) > 0 || + (intel.recent_changes?.length ?? 0) > 0 || + resourceDependencies().length > 0 || + resourceDependents().length > 0 || + resourceCorrelations().length > 0 + ); + }); const hasCorrelationContext = createMemo( () => resourceDependencies().length > 0 || @@ -188,13 +204,13 @@ export const useResourceDetailDrawerDerivedState = ( resourceCorrelations().length > 0, ); const hasInvestigationContext = createMemo( - () => Boolean(resourceIntelligence()) || hasGovernanceData(), + () => hasMeaningfulResourceIntelligence() || hasGovernanceData(), ); const investigationContextSummary = createMemo(() => { const intel = resourceIntelligence(); const summary: string[] = []; - if (intel) { + if (intel && hasMeaningfulResourceIntelligence()) { summary.push(`AI health ${intel.health.grade} ยท ${Math.round(intel.health.score)}/100`); } if (resourceCorrelations().length > 0) { @@ -555,6 +571,7 @@ export const useResourceDetailDrawerDerivedState = ( resourceDependents, resourceCorrelations, hasCorrelationContext, + hasMeaningfulResourceIntelligence, hasInvestigationContext, investigationContextSummary, pbsData,