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.

Route resource IP summaries through policy helper

rcourtmanf12d6b2838c4
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 0f580fed10..6362b2c209 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -171,6 +171,10 @@ redacted values stay consistent without AI-local presentation shims.
Those same paths also use the shared resource display-name helper, so the
name-or-ID fallback stays aligned across chat extraction, resource context,
and unified adapter presentation.
+The unified resource context's IP summaries now also route through the shared
+policy redaction helper, so the local "IPs" line follows the same governed
+redaction decision and label vocabulary as the rest of the policy-aware
+resource presentation layer.
The policy-posture aggregate itself now also comes from
`internal/unifiedresources/policy_posture.go`, so AI summaries and resource
context reuse the same canonical sensitivity, routing, and redaction counts
diff --git a/internal/ai/resource_context.go b/internal/ai/resource_context.go
index 9bca25a7b6..8b704403c6 100644
--- a/internal/ai/resource_context.go
+++ b/internal/ai/resource_context.go
@@ -571,13 +571,10 @@ func unifiedResourceContextIPSummary(r unifiedresources.Resource, limit int) str
if len(ips) == 0 {
return ""
}
- if unifiedresources.ResourcePolicyRedacts(r.Policy, unifiedresources.ResourceRedactionIPAddress) {
- return " - IPs " + unifiedresources.ResourcePolicyRedactedLabel
- }
if limit > 0 && len(ips) > limit {
ips = ips[:limit]
}
- return " - " + strings.Join(ips, ", ")
+ return " - IPs " + unifiedresources.ResourcePolicyRedactedValue(strings.Join(ips, ", "), r.Policy, unifiedresources.ResourceRedactionIPAddress)
}
func normalizeUnifiedResourceContextSlice(resources []unifiedresources.Resource) []unifiedresources.Resource {
diff --git a/internal/ai/resource_context_test.go b/internal/ai/resource_context_test.go
index 504811ea58..f57cb2abbd 100644
--- a/internal/ai/resource_context_test.go
+++ b/internal/ai/resource_context_test.go
@@ -409,6 +409,35 @@ func TestUnifiedResourceDisplayNameUsesSharedHelper(t *testing.T) {
}
}
+func TestUnifiedResourceContextIPSummaryUsesSharedHelper(t *testing.T) {
+ sensitive := unifiedresources.Resource{
+ Policy: &unifiedresources.ResourcePolicy{
+ Sensitivity: unifiedresources.ResourceSensitivitySensitive,
+ Routing: unifiedresources.ResourceRoutingPolicy{
+ Scope: unifiedresources.ResourceRoutingScopeLocalFirst,
+ Redact: []unifiedresources.ResourceRedactionHint{
+ unifiedresources.ResourceRedactionIPAddress,
+ },
+ },
+ },
+ Identity: unifiedresources.ResourceIdentity{
+ IPAddresses: []string{"10.0.0.10", "10.0.0.11"},
+ },
+ }
+ if got := unifiedResourceContextIPSummary(sensitive, 10); got != " - IPs redacted by policy" {
+ t.Fatalf("unifiedResourceContextIPSummary() = %q, want redacted summary", got)
+ }
+
+ public := unifiedresources.Resource{
+ Identity: unifiedresources.ResourceIdentity{
+ IPAddresses: []string{"10.0.0.10", "10.0.0.11"},
+ },
+ }
+ if got := unifiedResourceContextIPSummary(public, 10); got != " - IPs 10.0.0.10, 10.0.0.11" {
+ t.Fatalf("unifiedResourceContextIPSummary() = %q, want IP list", got)
+ }
+}
+
func TestBuildUnifiedResourceContext_UnifiedPath(t *testing.T) {
clusterID := "k8s-cluster-1"
k8sCluster := unifiedresources.Resource{