Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Extract AI intelligence summary model owner

rcourtmana9a5bf1a5d27
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index e97bc8dd63..9ae28fd4a4 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -106,7 +106,7 @@ Own canonical runtime payload shapes between backend and frontend.
4. Route unified resource sensitivity, routing, and `aiSafeSummary` payload changes through `internal/api/resources.go`, `internal/api/contract_test.go`, and the canonical frontend resource consumer proofs together; resource governance metadata must not ship as an API-only or frontend-only heuristic
5. Route unified-resource action, lifecycle, and export audit reads through `internal/api/activity_audit_handlers.go`, `internal/api/router_routes_licensing.go`, and `internal/api/contract_test.go` together so the control-plane execution trail stays on a governed API contract instead of a store-only shape
6. Route dedicated unified-resource timeline and facet-bundle reads through `frontend-modern/src/api/resources.ts`, `internal/api/resources.go`, and `internal/api/contract_test.go` together so the backend facet contract and the frontend client stay aligned on one timeline-first surface, while capability and relationship detail stays backend-owned for AI correlation and change detection
-7. Route canonical AI intelligence summary and resource-intelligence reads through `frontend-modern/src/api/ai.ts`, `frontend-modern/src/stores/aiIntelligence.ts`, `frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts`, `frontend-modern/src/features/patrol/PatrolIntelligenceSurface.tsx`, the Patrol-owned section files under `frontend-modern/src/features/patrol/`, `frontend-modern/src/pages/AIIntelligence.tsx`, `internal/api/ai_handlers.go`, and `internal/api/contract_test.go` together so the summary card, runtime hook, feature shell, section owners, route shell, and backend payload stay aligned on one governed surface, including the canonical recent-changes slice
+7. Route canonical AI intelligence summary and resource-intelligence reads through `frontend-modern/src/api/ai.ts`, `frontend-modern/src/stores/aiIntelligence.ts`, `frontend-modern/src/stores/aiIntelligenceSummaryModel.ts`, `frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts`, `frontend-modern/src/features/patrol/PatrolIntelligenceSurface.tsx`, the Patrol-owned section files under `frontend-modern/src/features/patrol/`, `frontend-modern/src/pages/AIIntelligence.tsx`, `internal/api/ai_handlers.go`, and `internal/api/contract_test.go` together so the summary card, store normalization owner, runtime hook, feature shell, section owners, route shell, and backend payload stay aligned on one governed surface, including the canonical recent-changes slice
while keeping the learning counters backend-only coverage, so the summary page keeps Patrol health and findings primary and renders timeline, correlation, and policy-posture data as secondary investigation context rather than as a separate headline product metric
and the shared `frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx` card, so canonical recent-change timelines stay rendered through one governed frontend card instead of separate page-local list loops
and the shared `frontend-modern/src/utils/resourceChangePresentation.ts` formatter used by the summary page and resource drawer, so canonical change wording does not drift across surfaces
@@ -117,6 +117,7 @@ Own canonical runtime payload shapes between backend and frontend.
and the shared dashboard-load bundle inside `frontend-modern/src/stores/aiIntelligence.ts`, so the page orchestration stays on the store-owned bundle instead of enumerating the AI fetches inline
and the shared `frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsx` card, so the AI summary page renders the governed policy-posture counts while the resource drawer stays on per-resource policy lines instead of carrying duplicate posture UI loops
and the dedicated `frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts` owner, so recent-change, learned-correlation, and governed-resource summary text stays derived from the canonical AI payload in one place instead of as hook-local count and pluralization logic
+ and the dedicated `frontend-modern/src/stores/aiIntelligenceSummaryModel.ts` owner, so recent-change counts and governed policy-posture fallbacks normalize once at the shared store boundary instead of as Patrol-hook-local payload repair
and the shared `frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx` card, so learned correlations and correlation context stay rendered through one governed frontend card instead of separate page-local list loops
and the same shared correlation card's ordering and truncation rule, so callers pass raw correlations instead of encoding their own top-N sort behavior
and the shared `frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx` and `frontend-modern/src/components/Infrastructure/ResourceCorrelationSummary.tsx` cards' infrastructure resource-link default, so the Patrol page, resource drawer, and problem-resource dashboard panels inherit the canonical resource-filter path construction instead of rebuilding infrastructure URLs inline
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 4cbc626c05..0aaade1365 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -622,7 +622,9 @@ or polling lifecycle. The Patrol feature is the current reference shape:
`frontend-modern/src/features/patrol/PatrolIntelligenceSurface.tsx` stays the
feature shell, `frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts`
owns the runtime state machine, `frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts`
-owns the pure investigation-context summary derivation, and the Patrol-owned
+owns the pure investigation-context summary derivation,
+`frontend-modern/src/stores/aiIntelligenceSummaryModel.ts` owns canonical AI
+summary normalization at the shared store boundary, and the Patrol-owned
header/banner/summary/workspace section files under
`frontend-modern/src/features/patrol/` own the heavy render surfaces. Shared
shell governance should reinforce that pattern instead of letting feature render
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 2308fbf552..0aa702f2fc 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -30,18 +30,19 @@ Patrol-specific presentation helpers.
7. `frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts`
8. `frontend-modern/src/pages/AIIntelligence.tsx`
9. `frontend-modern/src/stores/aiIntelligence.ts`
-10. `frontend-modern/src/types/aiIntelligence.ts`
-11. `frontend-modern/src/components/AI/FindingsPanel.tsx`
-12. `frontend-modern/src/components/Brand/PulsePatrolLogo.tsx`
-13. `frontend-modern/src/components/patrol/`
-14. `frontend-modern/src/utils/aiFindingPresentation.ts`
-15. `frontend-modern/src/utils/approvalRiskPresentation.ts`
-16. `frontend-modern/src/utils/findingAlertIdentity.ts`
-17. `frontend-modern/src/utils/patrolEmptyStatePresentation.ts`
-18. `frontend-modern/src/utils/patrolFormat.ts`
-19. `frontend-modern/src/utils/patrolRunPresentation.ts`
-20. `frontend-modern/src/utils/patrolSummaryPresentation.ts`
-21. `frontend-modern/src/utils/textPresentation.ts`
+10. `frontend-modern/src/stores/aiIntelligenceSummaryModel.ts`
+11. `frontend-modern/src/types/aiIntelligence.ts`
+12. `frontend-modern/src/components/AI/FindingsPanel.tsx`
+13. `frontend-modern/src/components/Brand/PulsePatrolLogo.tsx`
+14. `frontend-modern/src/components/patrol/`
+15. `frontend-modern/src/utils/aiFindingPresentation.ts`
+16. `frontend-modern/src/utils/approvalRiskPresentation.ts`
+17. `frontend-modern/src/utils/findingAlertIdentity.ts`
+18. `frontend-modern/src/utils/patrolEmptyStatePresentation.ts`
+19. `frontend-modern/src/utils/patrolFormat.ts`
+20. `frontend-modern/src/utils/patrolRunPresentation.ts`
+21. `frontend-modern/src/utils/patrolSummaryPresentation.ts`
+22. `frontend-modern/src/utils/textPresentation.ts`
## Shared Boundaries
@@ -49,7 +50,7 @@ Patrol-specific presentation helpers.
## Extension Points
-1. Add or change Patrol page orchestration through `frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts`, keep `frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts` as the canonical investigation-context derivation owner, keep `frontend-modern/src/features/patrol/PatrolIntelligenceSurface.tsx` as the feature shell, keep the Patrol-owned section files under `frontend-modern/src/features/patrol/` as the heavy render owners, keep `frontend-modern/src/pages/AIIntelligence.tsx` as the route shell, and update `frontend-modern/src/stores/aiIntelligence.ts` together
+1. Add or change Patrol page orchestration through `frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts`, keep `frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts` as the canonical investigation-context derivation owner, keep `frontend-modern/src/features/patrol/PatrolIntelligenceSurface.tsx` as the feature shell, keep the Patrol-owned section files under `frontend-modern/src/features/patrol/` as the heavy render owners, keep `frontend-modern/src/pages/AIIntelligence.tsx` as the route shell, keep `frontend-modern/src/stores/aiIntelligenceSummaryModel.ts` as the canonical AI summary normalization owner, and update `frontend-modern/src/stores/aiIntelligence.ts` together
2. Add or change Patrol findings, approvals, investigation, or run-history presentation through `frontend-modern/src/components/AI/FindingsPanel.tsx` and `frontend-modern/src/components/patrol/`
3. Keep Patrol and chat identifier-label presentation aligned through the shared `frontend-modern/src/utils/textPresentation.ts`
4. Keep Patrol and chat stream-matching / mention dedupe aligned through the shared `frontend-modern/src/utils/chatIdentifiers.ts`
@@ -88,6 +89,10 @@ workspace render surfaces, and
`frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts` owns Patrol
state, transport, polling, and effect lifecycle. The shell and section surfaces
must not re-accumulate Patrol API calls, timer orchestration, or store refresh
+semantics, and `frontend-modern/src/stores/aiIntelligenceSummaryModel.ts` now
+owns the canonical summary normalization so Patrol consumers inherit one
+governed recent-change and policy-posture snapshot instead of reintroducing
+hook-local fallback logic.
flow inline.
Patrol finding state must now also consume the canonical camelCase
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index ab40f9e55d..172fd4474e 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -2573,6 +2573,7 @@
"frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts",
"frontend-modern/src/pages/AIIntelligence.tsx",
"frontend-modern/src/stores/aiIntelligence.ts",
+ "frontend-modern/src/stores/aiIntelligenceSummaryModel.ts",
"frontend-modern/src/types/aiIntelligence.ts",
"frontend-modern/src/utils/aiFindingPresentation.ts",
"frontend-modern/src/utils/approvalRiskPresentation.ts",
@@ -2588,7 +2589,8 @@
"exact_files": [
"frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts",
"frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx",
- "frontend-modern/src/stores/__tests__/aiIntelligence.test.ts"
+ "frontend-modern/src/stores/__tests__/aiIntelligence.test.ts",
+ "frontend-modern/src/stores/__tests__/aiIntelligenceSummaryModel.test.ts"
],
"require_explicit_path_policy_coverage": true,
"path_policies": [
@@ -2608,6 +2610,7 @@
"frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts",
"frontend-modern/src/pages/AIIntelligence.tsx",
"frontend-modern/src/stores/aiIntelligence.ts",
+ "frontend-modern/src/stores/aiIntelligenceSummaryModel.ts",
"frontend-modern/src/types/aiIntelligence.ts"
],
"allow_same_subsystem_tests": false,
@@ -2617,6 +2620,7 @@
"frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx",
"frontend-modern/src/stores/__tests__/aiIntelligence.test.ts",
+ "frontend-modern/src/stores/__tests__/aiIntelligenceSummaryModel.test.ts",
"frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts"
]
},
diff --git a/frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts b/frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts
index 24a89c5c09..b9409d9f7b 100644
--- a/frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts
+++ b/frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts
@@ -451,8 +451,7 @@ export function usePatrolIntelligenceState() {
const policyPosture = createMemo(() => intelligenceSummary()?.policy_posture);
const investigationContext = createMemo(() =>
buildPatrolInvestigationContextSummary({
- recentChangesCount:
- intelligenceSummary()?.recent_changes_count ?? intelligenceSummary()?.recent_changes?.length,
+ recentChangesCount: intelligenceSummary()?.recent_changes_count,
correlations: aiIntelligenceStore.correlations,
policyPosture: policyPosture(),
}),
diff --git a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts b/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
index 3e0b01b676..afb7f662f2 100644
--- a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
+++ b/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
@@ -138,6 +138,68 @@ describe('aiIntelligenceStore', () => {
expect(aiIntelligenceStore.intelligenceSummary?.policy_posture?.routing_counts?.['local-only']).toBe(1);
});
+ it('normalizes the canonical intelligence summary at the store boundary', async () => {
+ vi.mocked(AIAPI.getIntelligenceSummary).mockResolvedValueOnce({
+ timestamp: '2026-03-01T00:00:00Z',
+ overall_health: {
+ score: 87,
+ grade: 'B',
+ trend: 'stable',
+ factors: [],
+ prediction: 'Stable',
+ },
+ findings_count: {
+ critical: 0,
+ warning: 0,
+ watch: 0,
+ info: 0,
+ total: 0,
+ },
+ predictions_count: 0,
+ recent_changes_count: Number.NaN,
+ recent_changes: [
+ {
+ id: 'change-1',
+ observedAt: '2026-03-01T00:00:00Z',
+ resourceId: 'vm-100',
+ kind: 'config_update',
+ sourceType: 'pulse_diff',
+ confidence: 'high',
+ },
+ ],
+ policy_posture: {
+ total_resources: Number.NaN,
+ sensitivity_counts: {
+ public: Number.NaN,
+ },
+ routing_counts: {
+ 'cloud-summary': 1,
+ 'local-only': 1,
+ },
+ },
+ learning: {
+ resources_with_knowledge: 0,
+ total_notes: 0,
+ resources_with_baselines: 0,
+ patterns_detected: 0,
+ correlations_learned: 0,
+ incidents_tracked: 0,
+ },
+ });
+
+ await aiIntelligenceStore.loadIntelligenceSummary();
+
+ expect(aiIntelligenceStore.intelligenceSummary?.recent_changes_count).toBe(1);
+ expect(aiIntelligenceStore.intelligenceSummary?.policy_posture).toEqual({
+ total_resources: 2,
+ sensitivity_counts: {},
+ routing_counts: {
+ 'cloud-summary': 1,
+ 'local-only': 1,
+ },
+ });
+ });
+
it('loads the canonical correlations response', async () => {
vi.mocked(AIAPI.getCorrelations).mockResolvedValueOnce({
correlations: [
diff --git a/frontend-modern/src/stores/__tests__/aiIntelligenceSummaryModel.test.ts b/frontend-modern/src/stores/__tests__/aiIntelligenceSummaryModel.test.ts
new file mode 100644
index 0000000000..cb485f20b5
--- /dev/null
+++ b/frontend-modern/src/stores/__tests__/aiIntelligenceSummaryModel.test.ts
@@ -0,0 +1,110 @@
+import { describe, expect, it } from 'vitest';
+
+import { normalizeIntelligenceSummary } from '@/stores/aiIntelligenceSummaryModel';
+
+describe('aiIntelligenceSummaryModel', () => {
+ it('normalizes recent change count and governed policy posture fallbacks', () => {
+ const summary = normalizeIntelligenceSummary({
+ timestamp: '2026-03-01T00:00:00Z',
+ overall_health: {
+ score: 87,
+ grade: 'B',
+ trend: 'stable',
+ factors: [],
+ prediction: 'Stable',
+ },
+ findings_count: {
+ critical: 1,
+ warning: 2,
+ watch: 0,
+ info: 4,
+ total: 7,
+ },
+ predictions_count: 3,
+ recent_changes_count: Number.NaN,
+ recent_changes: [
+ {
+ id: 'change-1',
+ observedAt: '2026-03-01T00:00:00Z',
+ resourceId: 'vm-100',
+ kind: 'config_update',
+ sourceType: 'pulse_diff',
+ confidence: 'high',
+ },
+ ],
+ policy_posture: {
+ total_resources: Number.NaN,
+ sensitivity_counts: {
+ public: Number.NaN,
+ },
+ routing_counts: {
+ 'cloud-summary': 2,
+ 'local-only': 1,
+ },
+ },
+ learning: {
+ resources_with_knowledge: 4,
+ total_notes: 11,
+ resources_with_baselines: 3,
+ patterns_detected: 2,
+ correlations_learned: 1,
+ incidents_tracked: 5,
+ },
+ });
+
+ expect(summary.recent_changes_count).toBe(1);
+ expect(summary.recent_changes).toHaveLength(1);
+ expect(summary.policy_posture).toEqual({
+ total_resources: 3,
+ sensitivity_counts: {},
+ routing_counts: {
+ 'cloud-summary': 2,
+ 'local-only': 1,
+ },
+ });
+ });
+
+ it('keeps the canonical summary count when the backend already supplies it', () => {
+ const summary = normalizeIntelligenceSummary({
+ timestamp: '2026-03-01T00:00:00Z',
+ overall_health: {
+ score: 92,
+ grade: 'A',
+ trend: 'improving',
+ factors: [],
+ prediction: 'Improving',
+ },
+ findings_count: {
+ critical: 0,
+ warning: 1,
+ watch: 0,
+ info: 2,
+ total: 3,
+ },
+ predictions_count: 1,
+ recent_changes_count: 4,
+ recent_changes: [
+ {
+ id: 'change-2',
+ observedAt: '2026-03-01T00:00:00Z',
+ resourceId: 'vm-200',
+ kind: 'restart',
+ sourceType: 'platform_event',
+ confidence: 'medium',
+ },
+ ],
+ learning: {
+ resources_with_knowledge: 3,
+ total_notes: 8,
+ resources_with_baselines: 2,
+ patterns_detected: 1,
+ correlations_learned: 1,
+ incidents_tracked: 2,
+ },
+ });
+
+ expect(summary.recent_changes_count).toBe(4);
+ expect(summary.recent_changes).toHaveLength(1);
+ expect(summary.policy_posture).toBeUndefined();
+ });
+});
diff --git a/frontend-modern/src/stores/aiIntelligence.ts b/frontend-modern/src/stores/aiIntelligence.ts
index 961f4098d3..97873442b4 100644
--- a/frontend-modern/src/stores/aiIntelligence.ts
+++ b/frontend-modern/src/stores/aiIntelligence.ts
@@ -29,6 +29,7 @@ import type {
CorrelationsResponse,
IntelligenceSummary,
} from '@/types/aiIntelligence';
+import { normalizeIntelligenceSummary } from './aiIntelligenceSummaryModel';
// ============================================
// Enum validation helpers
@@ -535,7 +536,7 @@ export const aiIntelligenceStore = {
async loadIntelligenceSummary() {
try {
const summary = await AIAPI.getIntelligenceSummary();
- setIntelligenceSummary(summary);
+ setIntelligenceSummary(normalizeIntelligenceSummary(summary));
return summary;
} catch (e) {
logger.error('Failed to load intelligence summary:', e);
diff --git a/frontend-modern/src/stores/aiIntelligenceSummaryModel.ts b/frontend-modern/src/stores/aiIntelligenceSummaryModel.ts
new file mode 100644
index 0000000000..b0a95cdb85
--- /dev/null
+++ b/frontend-modern/src/stores/aiIntelligenceSummaryModel.ts
@@ -0,0 +1,70 @@
+import type {
+ IntelligencePolicyPostureSummary,
+ IntelligenceSummary,
+} from '@/types/aiIntelligence';
+import type {
+ ResourceRedactionHint,
+ ResourceRoutingScope,
+ ResourceSensitivity,
+} from '@/types/resource';
+
+function normalizeNonNegativeCount(value: number | undefined): number | null {
+ if (typeof value !== 'number' || !Number.isFinite(value) || value < 0) {
+ return null;
+ }
+
+ return Math.trunc(value);
+}
+
+function normalizeCountMap<T extends string>(
+ counts: Partial<Record<T, number>> | undefined,
+): Partial<Record<T, number>> {
+ const normalized: Partial<Record<T, number>> = {};
+
+ for (const [key, value] of Object.entries(counts ?? {})) {
+ const normalizedValue = normalizeNonNegativeCount(value);
+ if (normalizedValue !== null) {
+ normalized[key as T] = normalizedValue;
+ }
+ }
+
+ return normalized;
+}
+
+function sumCountMap<T extends string>(counts: Partial<Record<T, number>>): number {
+ return Object.values(counts).reduce((total, count) => total + (count ?? 0), 0);
+}
+
+function normalizePolicyPosture(
+ posture: IntelligencePolicyPostureSummary | undefined,
+): IntelligencePolicyPostureSummary | undefined {
+ if (!posture) {
+ return undefined;
+ }
+
+ const sensitivityCounts = normalizeCountMap<ResourceSensitivity>(posture.sensitivity_counts);
+ const routingCounts = normalizeCountMap<ResourceRoutingScope>(posture.routing_counts);
+ const redactionCounts = normalizeCountMap<ResourceRedactionHint>(posture.redaction_counts);
+ const totalResources =
+ normalizeNonNegativeCount(posture.total_resources) ??
+ Math.max(sumCountMap(sensitivityCounts), sumCountMap(routingCounts));
+
+ return {
+ total_resources: totalResources,
+ sensitivity_counts: sensitivityCounts,
+ routing_counts: routingCounts,
+ ...(posture.redaction_counts !== undefined ? { redaction_counts: redactionCounts } : {}),
+ };
+}
+
+export function normalizeIntelligenceSummary(summary: IntelligenceSummary): IntelligenceSummary {
+ const recentChanges = summary.recent_changes ?? [];
+
+ return {
+ ...summary,
+ recent_changes: recentChanges,
+ recent_changes_count:
+ normalizeNonNegativeCount(summary.recent_changes_count) ?? recentChanges.length,
+ policy_posture: normalizePolicyPosture(summary.policy_posture),
+ };
+}
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index c9f8033e33..38392ad8b5 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -581,6 +581,8 @@ import aiRuntimeControlsSectionSource from '@/components/Settings/AIRuntimeContr
import aiSettingsStatusAndActionsSource from '@/components/Settings/AISettingsStatusAndActions.tsx?raw';
import aiSettingsStateSource from '@/components/Settings/useAISettingsState.ts?raw';
import aiIntelligenceSource from '@/pages/AIIntelligence.tsx?raw';
+import aiIntelligenceStoreSource from '@/stores/aiIntelligence.ts?raw';
+import aiIntelligenceSummaryModelSource from '@/stores/aiIntelligenceSummaryModel.ts?raw';
import patrolIntelligenceBannersSource from '@/features/patrol/PatrolIntelligenceBanners.tsx?raw';
import patrolIntelligenceHeaderSource from '@/features/patrol/PatrolIntelligenceHeader.tsx?raw';
import patrolIntelligenceSummarySource from '@/features/patrol/PatrolIntelligenceSummary.tsx?raw';
@@ -4325,9 +4327,20 @@ describe('frontend resource type boundaries', () => {
expect(patrolIntelligenceStateSource).toContain('getPatrolStatus');
expect(patrolIntelligenceStateSource).toContain('usePatrolStream');
expect(patrolIntelligenceStateSource).toContain('trackPaywallViewed');
+ expect(aiIntelligenceStoreSource).toContain(
+ "import { normalizeIntelligenceSummary } from './aiIntelligenceSummaryModel';",
+ );
+ expect(aiIntelligenceStoreSource).toContain(
+ 'setIntelligenceSummary(normalizeIntelligenceSummary(summary));',
+ );
+ expect(aiIntelligenceStoreSource).not.toContain('setIntelligenceSummary(summary);');
+ expect(aiIntelligenceSummaryModelSource).toContain(
+ 'export function normalizeIntelligenceSummary',
+ );
expect(patrolIntelligenceStateSource).toContain(
"import { buildPatrolInvestigationContextSummary } from './patrolInvestigationContextModel';",
);
+ expect(patrolIntelligenceStateSource).not.toContain('recent_changes?.length');
expect(patrolIntelligenceStateSource).not.toContain('governed resource${');
expect(patrolInvestigationContextModelSource).toContain(
'export function buildPatrolInvestigationContextSummary',
diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.py
index ac506a618e..918a20adbc 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -3526,6 +3526,7 @@ class SubsystemLookupTest(unittest.TestCase):
"frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx",
"frontend-modern/src/stores/__tests__/aiIntelligence.test.ts",
+ "frontend-modern/src/stores/__tests__/aiIntelligenceSummaryModel.test.ts",
"frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts",
],
)
@@ -3560,6 +3561,7 @@ class SubsystemLookupTest(unittest.TestCase):
"frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx",
"frontend-modern/src/stores/__tests__/aiIntelligence.test.ts",
+ "frontend-modern/src/stores/__tests__/aiIntelligenceSummaryModel.test.ts",
"frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts",
],
)
@@ -3594,6 +3596,7 @@ class SubsystemLookupTest(unittest.TestCase):
"frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts",
"frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx",
"frontend-modern/src/stores/__tests__/aiIntelligence.test.ts",
+ "frontend-modern/src/stores/__tests__/aiIntelligenceSummaryModel.test.ts",
"frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts",
],
)
@@ -3621,6 +3624,34 @@ class SubsystemLookupTest(unittest.TestCase):
"patrol-page-and-state",
)
+ def test_lookup_paths_assigns_ai_intelligence_summary_model_to_patrol_intelligence(
+ self,
+ ) -> None:
+ result = lookup_paths(
+ ["frontend-modern/src/stores/aiIntelligenceSummaryModel.ts"]
+ )
+ self.assertEqual(result["unowned_runtime_files"], [])
+ self.assertEqual(
+ {item["subsystem"] for item in result["impacted_subsystems"]},
+ {"patrol-intelligence"},
+ )
+ file_entry = result["files"][0]
+ self.assertEqual(file_entry["classification"], "runtime")
+ self.assertEqual(
+ {match["subsystem"] for match in file_entry["matches"]},
+ {"patrol-intelligence"},
+ )
+ match = file_entry["matches"][0]
+ self.assertEqual(
+ match["contract"],
+ "docs/release-control/v6/internal/subsystems/patrol-intelligence.md",
+ )
+ self.assertEqual(match["lane_context"]["lane_id"], "L6")
+ self.assertEqual(
+ match["verification_requirement"]["id"],
+ "patrol-page-and-state",
+ )
+
def test_lookup_paths_assigns_findings_panel_to_patrol_intelligence(self) -> None:
result = lookup_paths(["frontend-modern/src/components/AI/FindingsPanel.tsx"])
self.assertEqual(result["unowned_runtime_files"], [])