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 dead action plan topology field

rcourtman8e1f83236428
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 0ee4709d16..c330133416 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -236,6 +236,10 @@ The canonical resource-change kind, source type, and source adapter labels
now also come from the shared change presentation helper, so the resource
summary card and drawer history use the same badge vocabulary instead of
hardcoding their own labels.
+Action-plan stale-plan protection now keys the durable audit payload on the
+canonical `resourceVersion`, `policyVersion`, and `planHash` fields only,
+so the audit record stays on the minimal deterministic contract instead of
+carrying a separate topology version.
Resource-only incident context should follow the same rule: if an alert
timeline is absent, the incident prompt path should fall back to the canonical
unified-resource timeline rather than depending only on patrol-local change
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index de44a43ea8..52ff72a821 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -191,6 +191,10 @@ export history endpoints live in `internal/api/activity_audit_handlers.go` and
`internal/api/router_routes_licensing.go`, and the contract tests now pin their
response shapes so the execution trail remains queryable through the governed
API surface rather than only through the underlying store.
+Action-plan stale-plan protection on those audit records now uses the canonical
+`resourceVersion`, `policyVersion`, and `planHash` fields only, so the
+response contract stays deterministic without a separate topology-version
+alias.
The same API contract now also owns the dedicated frontend resource facet
client in `frontend-modern/src/api/resources.ts`, which fetches the governed
capability, relationship, and timeline surfaces from `internal/api/resources.go`
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index b316e42dd5..4b8fd03f04 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -547,6 +547,10 @@ recent-change slice plus facet counts it actually renders. The store now also
owns a `resource_changes` persistence table with `RecordChange` and
`GetRecentChanges` methods so change history is queryable by canonical ID and
time window.
+Action plans in `actions.go` now keep stale-plan protection to the canonical
+`resourceVersion`, `policyVersion`, and `planHash` fields, so the durable
+audit record stays minimal and does not need a separate topology-version
+field.
The shared change presentation helper also owns the canonical kind, source
type, and source adapter labels for those timeline entries, so summary cards
and drawer history surfaces both read the same badge vocabulary instead of
diff --git a/internal/ai/tools/action_audit.go b/internal/ai/tools/action_audit.go
index 516cd6dd4f..8e08a2131b 100644
--- a/internal/ai/tools/action_audit.go
+++ b/internal/ai/tools/action_audit.go
@@ -52,7 +52,6 @@ func (e *PulseToolExecutor) executeCommandWithAudit(
ExpiresAt: now.Add(5 * time.Minute),
ResourceVersion: "",
PolicyVersion: "",
- GraphVersion: "",
PlanHash: actionPlanHash(actionID, requestCorrelationID, capabilityName, resourceID, payload, reason),
Message: reason,
}
diff --git a/internal/ai/tools/control_run_command_test.go b/internal/ai/tools/control_run_command_test.go
index 0a1e7ea899..d2cfded3f7 100644
--- a/internal/ai/tools/control_run_command_test.go
+++ b/internal/ai/tools/control_run_command_test.go
@@ -215,6 +215,17 @@ func TestPulseToolExecutor_ExecuteRunCommand(t *testing.T) {
require.Len(t, audits, 1)
assert.Equal(t, "pulse_control", audits[0].Request.CapabilityName)
assert.Contains(t, audits[0].Plan.Message, "run command \"uptime\"")
+ assert.Empty(t, audits[0].Plan.ResourceVersion)
+ assert.Empty(t, audits[0].Plan.PolicyVersion)
+ assert.NotEmpty(t, audits[0].Plan.PlanHash)
+
+ planJSON, err := json.Marshal(audits[0].Plan)
+ require.NoError(t, err)
+ planMap := mustParseJSONMap(t, string(planJSON))
+ _, hasRelationshipVersion := planMap["relationshipVersion"]
+ assert.False(t, hasRelationshipVersion)
+ _, hasGraphVersion := planMap["graphVersion"]
+ assert.False(t, hasGraphVersion)
events, err := store.GetActionLifecycleEvents(audits[0].ID, time.Time{}, 10)
require.NoError(t, err)
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 3a1f9b7ba3..056cfa48d4 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -4383,7 +4383,6 @@ func TestContract_UnifiedActionAuditsJSONSnapshot(t *testing.T) {
ExpiresAt: now.Add(5 * time.Minute),
ResourceVersion: "rv-1",
PolicyVersion: "pv-1",
- GraphVersion: "gv-1",
PlanHash: "hash-1",
},
Approvals: []unifiedresources.ActionApprovalRecord{
@@ -4435,7 +4434,6 @@ func TestContract_UnifiedActionAuditsJSONSnapshot(t *testing.T) {
"expiresAt":"2026-03-18T16:05:00Z",
"resourceVersion":"rv-1",
"policyVersion":"pv-1",
- "graphVersion":"gv-1",
"planHash":"hash-1"
},
"approvals":[
diff --git a/internal/unifiedresources/actions.go b/internal/unifiedresources/actions.go
index cecba19750..23d5c07d71 100644
--- a/internal/unifiedresources/actions.go
+++ b/internal/unifiedresources/actions.go
@@ -67,8 +67,7 @@ type ActionPlan struct {
ExpiresAt time.Time `json:"expiresAt"`
ResourceVersion string `json:"resourceVersion"` // Hash of the resource state at planning time
PolicyVersion string `json:"policyVersion"` // Version of the capability/policy when planned
- GraphVersion string `json:"graphVersion"` // Enforces blast-radius hasn't drifted
- PlanHash string `json:"planHash"` // Hash verifying params and relationships haven't drifted
+ PlanHash string `json:"planHash"` // Hash verifying params and resource state haven't drifted
}
// ExecutionResult captures the output of the native capability driver.
diff --git a/internal/unifiedresources/store_test.go b/internal/unifiedresources/store_test.go
index f4578ae4d1..ee59a17ad2 100644
--- a/internal/unifiedresources/store_test.go
+++ b/internal/unifiedresources/store_test.go
@@ -928,7 +928,6 @@ func TestActionAuditRecord_RoundTrip(t *testing.T) {
ExpiresAt: expires,
ResourceVersion: "rv-1",
PolicyVersion: "pv-1",
- GraphVersion: "gv-1",
PlanHash: "plan-hash-1",
},
Approvals: []ActionApprovalRecord{
@@ -962,7 +961,7 @@ func TestActionAuditRecord_RoundTrip(t *testing.T) {
if got.Request.RequestID != record.Request.RequestID || got.Request.RequestedBy != record.Request.RequestedBy {
t.Fatalf("request round-trip failed: %+v", got.Request)
}
- if got.Plan.PolicyVersion != record.Plan.PolicyVersion || got.Plan.GraphVersion != record.Plan.GraphVersion {
+ if got.Plan.ResourceVersion != record.Plan.ResourceVersion || got.Plan.PolicyVersion != record.Plan.PolicyVersion || got.Plan.PlanHash != record.Plan.PlanHash {
t.Fatalf("plan round-trip failed: %+v", got.Plan)
}
if len(got.Approvals) != 1 || got.Approvals[0].Actor != record.Approvals[0].Actor || got.Approvals[0].Outcome != record.Approvals[0].Outcome {