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.

Centralize governed mention copy

rcourtman3c063730f1e9
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index ec10dab891..d629226228 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -122,6 +122,9 @@ and redaction labels used by the AI summary and resource drawer.
The decision to show that governed mention block now comes from the shared
unified-resource policy helper as well, so the local gate stays aligned with
the same routing and redaction rules as the rendered summary itself.
+The governed mention preamble and footer text now also come from the shared
+policy presenter, so the warning copy around the block does not drift from the
+canonical policy wording.
The same governed-context rule also applies to the main unified AI resource
overview: infrastructure, workload, alert-label, and top-consumer summaries
must not leak raw resource names, cluster labels, IP addresses, or unresolved
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index bfb9201a4e..54dc54d2c7 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -206,6 +206,8 @@ instead of rebuilding them in lane-local helpers.
The same helper now also owns the governed-summary gate for mention
prefetching, so the decision to surface the block follows the same canonical
local-only and redaction rules as the rendered policy text.
+The same helper also owns the governed-mention preamble and footer copy, so
+the warning language around the block stays centralized with the policy model.
The same shared policy helper also owns the `aiSafeSummary` decision and
redaction predicates used by AI chat knowledge extraction and resource
context rendering, so governed labels and summary selection stay rooted in
diff --git a/internal/ai/chat/context_prefetch.go b/internal/ai/chat/context_prefetch.go
index 28b10bbdc8..1f7530129c 100644
--- a/internal/ai/chat/context_prefetch.go
+++ b/internal/ai/chat/context_prefetch.go
@@ -731,7 +731,8 @@ func (p *ContextPrefetcher) formatContextSummary(mentions []ResourceMention, dis
var sb strings.Builder
sb.WriteString("=== PULSE MONITORING DATA (AUTHORITATIVE) ===\n")
sb.WriteString("This is verified data from Pulse agents. Canonical resource policy is enforced below.\n")
- sb.WriteString("Raw hostnames, paths, and local identifiers are withheld when governed resource policy requires redaction.\n\n")
+ sb.WriteString(unifiedresources.ResourcePolicyGovernedSummaryPreamble())
+ sb.WriteString("\n\n")
// Create a map for quick discovery lookup
discoveryMap := make(map[string]*tools.ResourceDiscoveryInfo)
@@ -918,7 +919,8 @@ func formatGovernedMentionSummary(sb *strings.Builder, mention ResourceMention)
sb.WriteString(line)
sb.WriteString("\n")
}
- sb.WriteString("Raw routing coordinates, bind mounts, hostnames, and discovery file paths withheld by canonical resource policy.\n\n")
+ sb.WriteString(unifiedresources.ResourcePolicyGovernedSummaryFooter())
+ sb.WriteString("\n\n")
}
// extractWords extracts words (3+ characters) from a message for matching
diff --git a/internal/ai/chat/context_prefetch_additional_test.go b/internal/ai/chat/context_prefetch_additional_test.go
index e25564012a..f7d2a7ff9c 100644
--- a/internal/ai/chat/context_prefetch_additional_test.go
+++ b/internal/ai/chat/context_prefetch_additional_test.go
@@ -410,6 +410,9 @@ func TestContextPrefetcher_PrefetchRestrictedMentionSkipsDiscoveryAndPaths(t *te
if !strings.Contains(ctx.Summary, "local-only context") {
t.Fatalf("expected aiSafeSummary local-only wording, got %q", ctx.Summary)
}
+ if !strings.Contains(ctx.Summary, unifiedresources.ResourcePolicyGovernedSummaryPreamble()) {
+ t.Fatalf("expected governed summary preamble, got %q", ctx.Summary)
+ }
if !strings.Contains(ctx.Summary, "routing=Local Only") {
t.Fatalf("expected policy routing in summary, got %q", ctx.Summary)
}
@@ -481,6 +484,9 @@ func TestContextPrefetcher_FormatContextSummary_GovernedMention(t *testing.T) {
if !strings.Contains(summary, "Redactions: Hostname, Alias, Path") {
t.Fatalf("expected canonical redaction list, got %q", summary)
}
+ if !strings.Contains(summary, unifiedresources.ResourcePolicyGovernedSummaryFooter()) {
+ t.Fatalf("expected governed summary footer, got %q", summary)
+ }
if strings.Contains(summary, "customer-db") {
t.Fatalf("expected governed formatter to avoid raw name, got %q", summary)
}
diff --git a/internal/unifiedresources/code_standards_test.go b/internal/unifiedresources/code_standards_test.go
index d2e46c6895..d229fab2f1 100644
--- a/internal/unifiedresources/code_standards_test.go
+++ b/internal/unifiedresources/code_standards_test.go
@@ -363,6 +363,8 @@ func TestResourcePolicyLabelHelpersUsedByAIConsumers(t *testing.T) {
},
filepath.Join("..", "ai", "chat", "context_prefetch.go"): {
"unifiedresources.ResourcePolicyRequiresGovernedSummary(m.Policy)",
+ "unifiedresources.ResourcePolicyGovernedSummaryPreamble()",
+ "unifiedresources.ResourcePolicyGovernedSummaryFooter()",
},
filepath.Join("..", "ai", "resource_export.go"): {
"unifiedresources.ResourceRedactionLabelsFromHints(redactionHints)",
@@ -382,6 +384,8 @@ func TestResourcePolicyLabelHelpersUsedByAIConsumers(t *testing.T) {
"const ResourcePolicyRedactedLabel = \"redacted by policy\"",
"func ResourceRedactionLabelsFromHints(hints []ResourceRedactionHint) []string",
"func ResourcePolicyRequiresGovernedSummary(policy *ResourcePolicy) bool",
+ "func ResourcePolicyGovernedSummaryPreamble() string",
+ "func ResourcePolicyGovernedSummaryFooter() string",
"func ResourceDisplayName(resource Resource) string",
},
}
diff --git a/internal/unifiedresources/policy_metadata_test.go b/internal/unifiedresources/policy_metadata_test.go
index 4565823735..55ba9da3a3 100644
--- a/internal/unifiedresources/policy_metadata_test.go
+++ b/internal/unifiedresources/policy_metadata_test.go
@@ -179,6 +179,15 @@ func TestResourcePolicySummaryLines(t *testing.T) {
}
}
+func TestResourcePolicyGovernedSummaryGuidance(t *testing.T) {
+ if got := ResourcePolicyGovernedSummaryPreamble(); got != "Raw hostnames, paths, and local identifiers are withheld when governed resource policy requires redaction." {
+ t.Fatalf("ResourcePolicyGovernedSummaryPreamble() = %q", got)
+ }
+ if got := ResourcePolicyGovernedSummaryFooter(); got != "Raw routing coordinates, bind mounts, hostnames, and discovery file paths withheld by canonical resource policy." {
+ t.Fatalf("ResourcePolicyGovernedSummaryFooter() = %q", got)
+ }
+}
+
func TestResourcePolicyRedactsAndUsesAISafeSummary(t *testing.T) {
policy := &ResourcePolicy{
Sensitivity: ResourceSensitivitySensitive,
diff --git a/internal/unifiedresources/policy_presentation.go b/internal/unifiedresources/policy_presentation.go
index 512262766b..3672693948 100644
--- a/internal/unifiedresources/policy_presentation.go
+++ b/internal/unifiedresources/policy_presentation.go
@@ -202,6 +202,18 @@ func ResourcePolicySummaryLines(policy *ResourcePolicy) []string {
return lines
}
+// ResourcePolicyGovernedSummaryPreamble returns the canonical opening guidance
+// used for governed mention and prompt summaries.
+func ResourcePolicyGovernedSummaryPreamble() string {
+ return "Raw hostnames, paths, and local identifiers are withheld when governed resource policy requires redaction."
+}
+
+// ResourcePolicyGovernedSummaryFooter returns the canonical closing guidance
+// used for governed mention summaries.
+func ResourcePolicyGovernedSummaryFooter() string {
+ return "Raw routing coordinates, bind mounts, hostnames, and discovery file paths withheld by canonical resource policy."
+}
+
// ResourcePolicyRedacts reports whether the policy redacts any of the provided hints.
func ResourcePolicyRedacts(policy *ResourcePolicy, hints ...ResourceRedactionHint) bool {
if policy == nil {