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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Canonicalize export redaction labels
rcourtmanf6a06866ccdc
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 74b2ac9ebe..0f580fed10 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -145,6 +145,10 @@ That export decision must come from the shared unified-resource privacyhelpers, so sensitivity floors and redaction-triggered routing stay alignedwith the canonical policy contract instead of being recomputed in AI-localcode.+The export audit should also record canonical human-readable redaction labels+from the shared policy presentation helper, so the audit trail and the+resource-context surfaces speak the same governed redaction language instead+of reformatting hint names locally.The same AI runtime boundary now also consumes the canonical unified-resourcetimeline when it assembles rich resource or incident context. Recent-changecontext should come from the shared resource store first so AI prompts reflectdiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 83ce98d436..e1871dfbde 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -448,6 +448,10 @@ Shared privacy helpers also own the export sensitivity floor and routedecision derived from those canonical policy counts, so AI export audits androute decisions reuse the same governed boundary logic instead of rebuildingit in consumer packages.+That same export path now records canonical human-readable redaction labels+through the shared policy presentation helper, so audit records and prompt+context stay aligned on the same redaction vocabulary instead of duplicating+hint-to-label conversion in AI-local code.The AI runtime now also uses the canonical policy presentation helpers tosurface those routing and redaction labels in shared context output, so thesame policy model is reflected in prompt summaries instead of beingdiff --git a/internal/ai/resource_export.go b/internal/ai/resource_export.goindex 03985080cc..3a5815bb3a 100644--- a/internal/ai/resource_export.go+++ b/internal/ai/resource_export.go@@ -5,7 +5,6 @@ import ("encoding/hex""encoding/json""fmt"- "sort""strings""time"@@ -42,16 +41,7 @@ func (s *Service) recordUnifiedResourceExport(destinationModel, summary string,return}- redactions := make([]string, 0, len(redactionHints))- for _, hint := range redactionHints {- redaction := strings.TrimSpace(string(hint))- if redaction == "" {- continue- }- redactions = append(redactions, redaction)- }- sort.Strings(redactions)- redactions = uniqueStrings(redactions)+ redactions := unifiedresources.ResourceRedactionLabelsFromHints(redactionHints)sensitivityFloor := unifiedresources.ExportSensitivityFloor(sensitivityCounts)decision, reason := unifiedresources.ExportDecisionForContext(sensitivityFloor, localOnlyCount, len(redactions))@@ -122,19 +112,3 @@ func (s *Service) recordUnifiedResourceExport(destinationModel, summary string,Msg("failed to persist unified resource export audit")}}--func uniqueStrings(values []string) []string {- if len(values) <= 1 {- return values- }- out := make([]string, 0, len(values))- last := ""- for _, value := range values {- if value == "" || value == last {- continue- }- out = append(out, value)- last = value- }- return out-}diff --git a/internal/ai/resource_export_test.go b/internal/ai/resource_export_test.goindex fa40b28a5d..18940f4e25 100644--- a/internal/ai/resource_export_test.go+++ b/internal/ai/resource_export_test.go@@ -42,7 +42,7 @@ func TestRecordUnifiedResourceExport_UsesCanonicalPrivacyHelpers(t *testing.T) {},wantDecision: unifiedresources.ExportRedacted,wantReason: "governed unified resource context exported in redacted form",- wantRedactions: []string{"hostname", "path"},+ wantRedactions: []string{"Hostname", "Path"},},}diff --git a/internal/unifiedresources/code_standards_test.go b/internal/unifiedresources/code_standards_test.goindex 52b15b6534..1f51a1a69b 100644--- a/internal/unifiedresources/code_standards_test.go+++ b/internal/unifiedresources/code_standards_test.go@@ -346,6 +346,9 @@ func TestResourcePolicyLabelHelpersUsedByAIConsumers(t *testing.T) {"unifiedresources.ResourcePolicyLabel(","unifiedresources.ResourcePolicyRedactedValue(",},+ filepath.Join("..", "ai", "resource_export.go"): {+ "unifiedresources.ResourceRedactionLabelsFromHints(redactionHints)",+ },filepath.Join("..", "ai", "resource_context.go"): {"unifiedresources.ResourcePolicyLabel(","unifiedresources.ResourcePolicyRedactedValue(",@@ -359,6 +362,7 @@ func TestResourcePolicyLabelHelpersUsedByAIConsumers(t *testing.T) {"func ResourcePolicyLabel(name, aiSafeSummary string, policy *ResourcePolicy) string","func ResourcePolicyRedactedValue(value string, policy *ResourcePolicy, hints ...ResourceRedactionHint) string","const ResourcePolicyRedactedLabel = \"redacted by policy\"",+ "func ResourceRedactionLabelsFromHints(hints []ResourceRedactionHint) []string","func ResourceDisplayName(resource Resource) string",},}diff --git a/internal/unifiedresources/policy_metadata_test.go b/internal/unifiedresources/policy_metadata_test.goindex b0c76b09c3..b0e5dd1235 100644--- a/internal/unifiedresources/policy_metadata_test.go+++ b/internal/unifiedresources/policy_metadata_test.go@@ -236,6 +236,24 @@ func TestResourcePolicyLabelHelpers(t *testing.T) {}}+func TestResourceRedactionLabelsFromHints(t *testing.T) {+ got := ResourceRedactionLabelsFromHints([]ResourceRedactionHint{+ ResourceRedactionPath,+ ResourceRedactionHostname,+ ResourceRedactionHostname,+ ResourceRedactionAlias,+ })+ want := []string{"Hostname", "Alias", "Path"}+ if len(got) != len(want) {+ t.Fatalf("labels = %#v, want %#v", got, want)+ }+ for i := range want {+ if got[i] != want[i] {+ t.Fatalf("labels[%d] = %q, want %q", i, got[i], want[i])+ }+ }+}+func TestResourceDisplayName(t *testing.T) {if got := ResourceDisplayName(Resource{Name: " node-a ",diff --git a/internal/unifiedresources/policy_presentation.go b/internal/unifiedresources/policy_presentation.goindex 62d86a2977..5992da9976 100644--- a/internal/unifiedresources/policy_presentation.go+++ b/internal/unifiedresources/policy_presentation.go@@ -97,6 +97,18 @@ func ResourcePolicyRedactionLabels(policy *ResourcePolicy) []string {return ResourcePolicyRedactionLabelsFromCounts(counts)}+// ResourceRedactionLabelsFromHints returns canonical human-readable labels for a hint slice.+func ResourceRedactionLabelsFromHints(hints []ResourceRedactionHint) []string {+ if len(hints) == 0 {+ return nil+ }+ counts := make(map[ResourceRedactionHint]int, len(hints))+ for _, hint := range hints {+ counts[hint]+++ }+ return ResourcePolicyRedactionLabelsFromCounts(counts)+}+// ResourcePolicyRedactionLabelsFromCounts returns the canonical labels for the// redaction hints present in the provided count map.func ResourcePolicyRedactionLabelsFromCounts(counts map[ResourceRedactionHint]int) []string {