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.

Pin graph provenance in API proofs

rcourtman33b169334c83
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 7f327781f1..5b496baade 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -3456,7 +3456,8 @@ func TestContract_ResourceListCarriesTimelineAndCapabilityContracts(t *testing.T
ObservedAt: now,
LastSeenAt: now,
Metadata: map[string]any{
- "source": "live",
+ "source": "live",
+ "cluster": "pve-prod",
},
},
},
@@ -3476,6 +3477,7 @@ func TestContract_ResourceListCarriesTimelineAndCapabilityContracts(t *testing.T
Reason: "vm started",
Metadata: map[string]any{
"source": "snapshot",
+ "ticket": "INC-1234",
},
},
},
@@ -3543,7 +3545,7 @@ func TestContract_ResourceListCarriesTimelineAndCapabilityContracts(t *testing.T
"discoverer":"proxmox_adapter",
"observedAt":"2026-03-18T12:00:00Z",
"lastSeenAt":"2026-03-18T12:00:00Z",
- "metadata":{"source":"live"}
+ "metadata":{"cluster":"pve-prod","source":"live"}
}
],
"recentChanges":[
@@ -3560,7 +3562,7 @@ func TestContract_ResourceListCarriesTimelineAndCapabilityContracts(t *testing.T
"confidence":"high",
"relatedResources":["node-1"],
"reason":"vm started",
- "metadata":{"source":"snapshot"}
+ "metadata":{"source":"snapshot","ticket":"INC-1234"}
}
],
"facetCounts":{
@@ -3634,6 +3636,10 @@ func TestContract_ResourceRelationshipsJSONSnapshot(t *testing.T) {
Discoverer: "proxmox_adapter",
ObservedAt: now,
LastSeenAt: now,
+ Metadata: map[string]any{
+ "source": "live",
+ "cluster": "pve-prod",
+ },
},
},
Count: 1,
@@ -3655,7 +3661,8 @@ func TestContract_ResourceRelationshipsJSONSnapshot(t *testing.T) {
"active":true,
"discoverer":"proxmox_adapter",
"observedAt":"2026-03-18T17:00:00Z",
- "lastSeenAt":"2026-03-18T17:00:00Z"
+ "lastSeenAt":"2026-03-18T17:00:00Z",
+ "metadata":{"cluster":"pve-prod","source":"live"}
}
],
"count":1
@@ -3686,7 +3693,7 @@ func TestContract_ResourceTimelineJSONSnapshot(t *testing.T) {
Confidence: unifiedresources.ConfidenceHigh,
RelatedResources: []string{"node-1"},
Reason: "vm started",
- Metadata: map[string]any{"source": "snapshot"},
+ Metadata: map[string]any{"source": "snapshot", "ticket": "INC-1234"},
},
},
Count: 1,
@@ -3713,7 +3720,7 @@ func TestContract_ResourceTimelineJSONSnapshot(t *testing.T) {
"confidence":"high",
"relatedResources":["node-1"],
"reason":"vm started",
- "metadata":{"source":"snapshot"}
+ "metadata":{"source":"snapshot","ticket":"INC-1234"}
}
],
"count":1
@@ -3754,6 +3761,10 @@ func TestContract_ResourceFacetsJSONSnapshot(t *testing.T) {
Discoverer: "proxmox_adapter",
ObservedAt: now,
LastSeenAt: now,
+ Metadata: map[string]any{
+ "source": "live",
+ "cluster": "pve-prod",
+ },
},
},
RecentChanges: []unifiedresources.ResourceChange{
@@ -3768,6 +3779,10 @@ func TestContract_ResourceFacetsJSONSnapshot(t *testing.T) {
SourceType: unifiedresources.SourcePlatformEvent,
SourceAdapter: unifiedresources.AdapterProxmox,
Confidence: unifiedresources.ConfidenceHigh,
+ Metadata: map[string]any{
+ "source": "snapshot",
+ "ticket": "INC-1234",
+ },
},
},
Counts: struct {
@@ -3805,7 +3820,8 @@ func TestContract_ResourceFacetsJSONSnapshot(t *testing.T) {
"active":true,
"discoverer":"proxmox_adapter",
"observedAt":"2026-03-18T17:00:00Z",
- "lastSeenAt":"2026-03-18T17:00:00Z"
+ "lastSeenAt":"2026-03-18T17:00:00Z",
+ "metadata":{"cluster":"pve-prod","source":"live"}
}
],
"recentChanges":[
@@ -3819,7 +3835,8 @@ func TestContract_ResourceFacetsJSONSnapshot(t *testing.T) {
"to":"online",
"sourceType":"platform_event",
"sourceAdapter":"proxmox_adapter",
- "confidence":"high"
+ "confidence":"high",
+ "metadata":{"source":"snapshot","ticket":"INC-1234"}
}
],
"counts":{
diff --git a/internal/api/resources_test.go b/internal/api/resources_test.go
index 18316235e5..df5ba4b5fd 100644
--- a/internal/api/resources_test.go
+++ b/internal/api/resources_test.go
@@ -917,6 +917,10 @@ func TestResourceGetFacetsAndTimeline(t *testing.T) {
Discoverer: "proxmox_adapter",
ObservedAt: now,
LastSeenAt: now,
+ Metadata: map[string]any{
+ "source": "live",
+ "cluster": "pve-prod",
+ },
},
},
}
@@ -945,7 +949,7 @@ func TestResourceGetFacetsAndTimeline(t *testing.T) {
Confidence: unified.ConfidenceHigh,
Reason: "vm started",
RelatedResources: []string{"node-1"},
- Metadata: map[string]any{"source": "snapshot"},
+ Metadata: map[string]any{"source": "snapshot", "ticket": "INC-1234"},
}); err != nil {
t.Fatalf("RecordChange: %v", err)
}
@@ -991,6 +995,12 @@ func TestResourceGetFacetsAndTimeline(t *testing.T) {
if payload.Counts.Capabilities != 1 || payload.Counts.Relationships != 1 {
t.Fatalf("unexpected facet counts: %#v", payload.Counts)
}
+ if got := payload.Relationships[0].Metadata["cluster"]; got != "pve-prod" {
+ t.Fatalf("unexpected relationship metadata: %#v", payload.Relationships[0].Metadata)
+ }
+ if got := payload.RecentChanges[0].Metadata["ticket"]; got != "INC-1234" {
+ t.Fatalf("unexpected change metadata: %#v", payload.RecentChanges[0].Metadata)
+ }
})
t.Run("capabilities", func(t *testing.T) {
@@ -1031,6 +1041,9 @@ func TestResourceGetFacetsAndTimeline(t *testing.T) {
if payload.ResourceID != "vm:42" || payload.Count != 1 || len(payload.Relationships) != 1 {
t.Fatalf("unexpected relationships payload: %#v", payload)
}
+ if got := payload.Relationships[0].Metadata["cluster"]; got != "pve-prod" {
+ t.Fatalf("unexpected relationship metadata: %#v", payload.Relationships[0].Metadata)
+ }
})
t.Run("timeline", func(t *testing.T) {
@@ -1054,6 +1067,9 @@ func TestResourceGetFacetsAndTimeline(t *testing.T) {
if payload.RecentChanges[0].ID != "chg-42" {
t.Fatalf("unexpected timeline change: %#v", payload.RecentChanges[0])
}
+ if got := payload.RecentChanges[0].Metadata["ticket"]; got != "INC-1234" {
+ t.Fatalf("unexpected timeline metadata: %#v", payload.RecentChanges[0].Metadata)
+ }
})
}