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.

Remove resource intelligence policy posture

rcourtman249df06149cc
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 1a8370e60d..bf2e74812f 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -112,12 +112,9 @@ That governed context should also surface the canonical routing posture and
redaction hints that were derived from the shared policy model, so prompts
reflect the same sensitivity, routing, and scrub decisions that the runtime
uses for export boundaries instead of rebuilding privacy posture locally.
-The same shared policy presenter also owns the `Allowed`/`Blocked` routing
-decision labels shown in the resource drawer, so the policy state wording
-stays canonical instead of being rendered inline by the consumer.
-That same presenter also owns the drawer's `Cloud Summary` routing row, so
-the AI-facing resource policy view does not rebuild the row layout or
-decision labels locally.
+The same shared policy presenter also owns the routing-scope labels used in
+the AI-facing policy surfaces, so the policy wording stays canonical instead
+of being rendered inline by the consumer.
That same policy boundary now applies to chat structured-mention prefetch and
resource-summary formatting: mention resolution must consume canonical
unified-resource policy metadata, skip discovery fan-out when governed
@@ -332,9 +329,11 @@ The frontend unified-resource hook now trusts backend canonical `policy` and
`aiSafeSummary` values directly, so the canonical summary and policy posture
stay aligned with the same resource-policy boundary that governs
policy-aware routing and redaction without any frontend-local re-normalization.
-The resource-intelligence payload used by the resource drawer also carries
-the same canonical policy posture snapshot, so the detail surface can show
-governed posture context without inventing a second posture contract.
+The per-resource intelligence payload returned from
+`/api/ai/intelligence?resource_id=...` now carries recent changes,
+dependencies, dependents, correlations, and knowledge only; policy posture
+stays on the system-wide intelligence summary and the Patrol governance card
+instead of riding the resource-detail payload.
That same resource-intelligence payload also carries dependency and
dependent correlation context from unified-resource correlations, so the drawer
can show canonical correlation relationships without reconstructing them from the
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index e42c269564..b7df2699b4 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -214,10 +214,11 @@ state.
That store now also owns the dashboard load bundle used by the Patrol page,
so the page refresh path stays aligned on one store-owned orchestration layer
instead of re-encoding the AI bundle inline.
-The AI summary page and resource drawer now also share the canonical
+The AI summary page now also renders the canonical
`frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsx`
card for policy posture, so sensitivity, routing, and redaction counts are
-presented through one governed frontend component instead of two copies.
+presented through one governed frontend component while the resource drawer
+keeps only the per-resource policy lines.
The unified action, lifecycle, and export audit reads now also clamp oversized
`limit` requests to the governed maximum of `1000`, so the control-plane audit
surface stays bounded even when callers ask for arbitrarily large history
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index ac5d757e63..b0d2dbcbe9 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -119,13 +119,11 @@ That Patrol summary card now also includes the canonical data-governance
posture snapshot from the shared AI summary payload, so the visible page can
show the same sensitivity, routing, and redaction distribution that the
runtime derives from unified resources.
-The resource drawer now carries the same canonical posture snapshot through
-the resource-intelligence payload, so the resource-level AI card can show the
-org posture context without introducing a separate posture endpoint.
-That same resource-intelligence payload also carries canonical dependency and
-dependent correlation context plus canonical correlation evidence, so the resource
-drawer can surface relationship reachability and learned edge patterns
-directly from the AI contract instead of inventing a second correlation summary.
+The resource drawer now carries canonical dependency and dependent
+correlation context plus canonical correlation evidence through the
+resource-intelligence payload, so the resource-level AI card can surface
+relationship reachability and learned edge patterns directly from the AI
+contract instead of inventing a second correlation summary.
The Patrol intelligence page now also consumes the learned correlation list
from the canonical AI correlations endpoint through the shared
`frontend-modern/src/stores/aiIntelligence.ts` store, so the global summary
@@ -151,10 +149,11 @@ cards now own the canonical Infrastructure resource-link default, so the
Patrol page and resource drawer inherit resource-filter href construction
through the shared summary cards instead of rebuilding local wrappers in each
surface.
-The Patrol intelligence page and resource drawer now also share the canonical
+The Patrol intelligence page now also renders the canonical
`frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsx`
card, so the data-governance posture counts stay rendered from one governed
-frontend component across both surfaces.
+frontend component on the page instead of being duplicated in the resource
+drawer.
The Patrol page and resource drawer now also share the canonical
`frontend-modern/src/utils/resourceChangePresentation.ts` formatter so
recent-change kind and headline wording stays aligned wherever the canonical
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx
index d1e41c6893..25f2874e75 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.identity-runtime.test.tsx
@@ -72,20 +72,6 @@ vi.mock('@/api/ai', () => ({
description: 'Disk pressure often precedes restarts',
},
],
- policy_posture: {
- total_resources: 2,
- sensitivity_counts: {
- public: 1,
- internal: 1,
- },
- routing_counts: {
- 'cloud-summary': 1,
- 'local-first': 1,
- },
- redaction_counts: {
- hostname: 1,
- },
- },
note_count: 3,
}),
},
diff --git a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts b/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
index ba599dbf3e..3e0b01b676 100644
--- a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
+++ b/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts
@@ -134,6 +134,7 @@ describe('aiIntelligenceStore', () => {
});
expect(aiIntelligenceStore.intelligenceSummary?.recent_changes).toHaveLength(1);
expect(aiIntelligenceStore.intelligenceSummary?.learning.correlations_learned).toBe(1);
+ expect(aiIntelligenceStore.intelligenceSummary?.policy_posture?.sensitivity_counts?.public).toBe(1);
expect(aiIntelligenceStore.intelligenceSummary?.policy_posture?.routing_counts?.['local-only']).toBe(1);
});
diff --git a/frontend-modern/src/types/aiIntelligence.ts b/frontend-modern/src/types/aiIntelligence.ts
index 2f0d468ad6..48237e884d 100644
--- a/frontend-modern/src/types/aiIntelligence.ts
+++ b/frontend-modern/src/types/aiIntelligence.ts
@@ -139,6 +139,5 @@ export interface ResourceIntelligence {
dependents?: string[];
correlations?: ResourceCorrelation[];
recent_changes?: ResourceChange[];
- policy_posture?: IntelligencePolicyPostureSummary;
note_count: number;
}
diff --git a/internal/ai/intelligence.go b/internal/ai/intelligence.go
index 75d010f252..31b6364cf4 100644
--- a/internal/ai/intelligence.go
+++ b/internal/ai/intelligence.go
@@ -57,22 +57,21 @@ type HealthScore struct {
// ResourceIntelligence aggregates all AI knowledge about a single resource
type ResourceIntelligence struct {
- ResourceID string `json:"resource_id"`
- ResourceName string `json:"resource_name,omitempty"`
- ResourceType string `json:"resource_type,omitempty"`
- Health HealthScore `json:"health"`
- ActiveFindings []*Finding `json:"active_findings,omitempty"`
- Predictions []patterns.FailurePrediction `json:"predictions,omitempty"`
- Dependencies []string `json:"dependencies,omitempty"` // Resources this depends on
- Dependents []string `json:"dependents,omitempty"` // Resources that depend on this
- Correlations []*correlation.Correlation `json:"correlations,omitempty"`
- Baselines map[string]*baseline.FlatBaseline `json:"baselines,omitempty"`
- Anomalies []AnomalyReport `json:"anomalies,omitempty"`
- RecentIncidents []*memory.Incident `json:"recent_incidents,omitempty"`
- RecentChanges []unifiedresources.ResourceChange `json:"recent_changes,omitempty"`
- PolicyPosture *unifiedresources.PolicyPostureSummary `json:"policy_posture,omitempty"`
- Knowledge *knowledge.GuestKnowledge `json:"knowledge,omitempty"`
- NoteCount int `json:"note_count"`
+ ResourceID string `json:"resource_id"`
+ ResourceName string `json:"resource_name,omitempty"`
+ ResourceType string `json:"resource_type,omitempty"`
+ Health HealthScore `json:"health"`
+ ActiveFindings []*Finding `json:"active_findings,omitempty"`
+ Predictions []patterns.FailurePrediction `json:"predictions,omitempty"`
+ Dependencies []string `json:"dependencies,omitempty"` // Resources this depends on
+ Dependents []string `json:"dependents,omitempty"` // Resources that depend on this
+ Correlations []*correlation.Correlation `json:"correlations,omitempty"`
+ Baselines map[string]*baseline.FlatBaseline `json:"baselines,omitempty"`
+ Anomalies []AnomalyReport `json:"anomalies,omitempty"`
+ RecentIncidents []*memory.Incident `json:"recent_incidents,omitempty"`
+ RecentChanges []unifiedresources.ResourceChange `json:"recent_changes,omitempty"`
+ Knowledge *knowledge.GuestKnowledge `json:"knowledge,omitempty"`
+ NoteCount int `json:"note_count"`
}
// AnomalyReport describes a metric that's deviating from baseline
@@ -287,7 +286,6 @@ func (i *Intelligence) GetSummary() *IntelligenceSummary {
// GetResourceIntelligence returns aggregated intelligence for a specific resource
func (i *Intelligence) GetResourceIntelligence(resourceID string) *ResourceIntelligence {
i.mu.RLock()
- unifiedResourceProvider := i.unifiedResourceProvider
defer i.mu.RUnlock()
intel := &ResourceIntelligence{
@@ -342,12 +340,6 @@ func (i *Intelligence) GetResourceIntelligence(resourceID string) *ResourceIntel
intel.RecentChanges = recentChanges
}
- if unifiedResourceProvider != nil {
- intel.PolicyPosture = unifiedresources.SummarizePolicyPosture(
- unifiedresources.RefreshCanonicalMetadataSlice(unifiedResourceProvider.GetAll()),
- )
- }
-
// Knowledge
if i.knowledge != nil {
if k, err := i.knowledge.GetKnowledge(resourceID); err == nil && k != nil {
diff --git a/internal/ai/intelligence_coverage_test.go b/internal/ai/intelligence_coverage_test.go
index 4923f746fd..5767692379 100644
--- a/internal/ai/intelligence_coverage_test.go
+++ b/internal/ai/intelligence_coverage_test.go
@@ -677,15 +677,6 @@ func TestIntelligence_GetResourceIntelligence_WithAllSubsystems(t *testing.T) {
if res.RecentChanges[0].Kind != ur.ChangeRestart {
t.Fatalf("expected restart change kind, got %s", res.RecentChanges[0].Kind)
}
- if res.PolicyPosture == nil {
- t.Fatal("expected policy posture summary")
- }
- if res.PolicyPosture.TotalResources != 2 {
- t.Fatalf("expected 2 governed resources, got %d", res.PolicyPosture.TotalResources)
- }
- if got := res.PolicyPosture.SensitivityCounts[ur.ResourceSensitivityPublic]; got != 1 {
- t.Fatalf("expected 1 public resource, got %d", got)
- }
if res.Knowledge == nil || res.NoteCount == 0 {
t.Error("expected knowledge")
}
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 805d638bf8..39ee19750b 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -362,12 +362,8 @@ func TestContract_ResourceIntelligenceIncludesRecentChanges(t *testing.T) {
if len(recentChanges) != 1 {
t.Fatalf("expected 1 recent change, got %d", len(recentChanges))
}
- policyPosture, ok := payload["policy_posture"].(map[string]interface{})
- if !ok {
- t.Fatalf("expected policy_posture object in response, got %T", payload["policy_posture"])
- }
- if got := int(policyPosture["total_resources"].(float64)); got != 2 {
- t.Fatalf("expected total_resources=2, got %d", got)
+ if _, ok := payload["policy_posture"]; ok {
+ t.Fatal("did not expect policy_posture in resource intelligence response")
}
dependencies, ok := payload["dependencies"].([]interface{})
if !ok {