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.

Prioritize Unraid parity-loss summaries

rcourtmanc68d4b8ed37b
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 45f349cfc3..c79db9f8c2 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -166,6 +166,11 @@ assembly branch.
`internal/unifiedresources/registry.go` so matcher seeding, manual links,
and merge semantics stay unified-resource-owned instead of being rebuilt in
consumers.
+ Operator-facing storage posture wording is part of that same ownership:
+ when multiple storage-risk reasons exist, shared posture helpers must prefer
+ the most decision-useful protection loss summary such as lost parity over a
+ generic disk-count aggregate, so resource drawers and incidents do not hide
+ the actual protection boundary behind a broader count phrase.
6. Add canonical governed name-resolution or policy-aware resource lookup behavior through `internal/unifiedresources/resolve.go` and `internal/unifiedresources/resolve_context.go`
7. Add or change resource drawer timeline/facet presentation through `frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx`, `frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx`, `frontend-modern/src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx`, `frontend-modern/src/components/Infrastructure/useResourceDetailDrawerState.ts`, `frontend-modern/src/components/Infrastructure/ResourceFacetSummary.tsx`, `frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts`, and the governed `internal/api/resources.go` facet/timeline contract together
8. Add or change discovery-support runtime under the resource drawer through `frontend-modern/src/components/Discovery/DiscoveryTab.tsx` for shell/presentation ownership and `frontend-modern/src/components/Discovery/useDiscoveryTabState.ts` for fetch, websocket-progress, and notes-mutation ownership
diff --git a/internal/unifiedresources/registry_test.go b/internal/unifiedresources/registry_test.go
index 6138b78c8d..d9ba0e634f 100644
--- a/internal/unifiedresources/registry_test.go
+++ b/internal/unifiedresources/registry_test.go
@@ -175,6 +175,23 @@ func TestResourceRegistry_IngestResourcesSeedsMatcherForOverlayRecords(t *testin
}
}
+func TestStorageRiskSemanticsPrefersUnraidParitySummaryOverGenericDiskCounts(t *testing.T) {
+ risk := &StorageRisk{
+ Reasons: []StorageRiskReason{
+ {Code: "unraid_disabled_disks", Severity: storagehealth.RiskCritical, Summary: "Unraid array reports 1 disabled disk(s)"},
+ {Code: "unraid_parity_unavailable", Severity: storagehealth.RiskCritical, Summary: "Unraid parity protection is unavailable"},
+ },
+ }
+
+ _, protectionReduced, _, protectionSummary, _ := StorageRiskSemantics(risk)
+ if !protectionReduced {
+ t.Fatal("expected protectionReduced=true")
+ }
+ if protectionSummary != "Unraid parity protection is unavailable" {
+ t.Fatalf("protectionSummary = %q, want %q", protectionSummary, "Unraid parity protection is unavailable")
+ }
+}
+
func TestResourceRegistry_MergesPhysicalDiskTemperatureAggregate(t *testing.T) {
rr := NewRegistry(nil)
now := time.Date(2026, 3, 29, 12, 0, 0, 0, time.UTC)
diff --git a/internal/unifiedresources/storage_posture.go b/internal/unifiedresources/storage_posture.go
index a0705ad4da..320e1d5ce2 100644
--- a/internal/unifiedresources/storage_posture.go
+++ b/internal/unifiedresources/storage_posture.go
@@ -110,6 +110,7 @@ func StorageRiskSemantics(risk *StorageRisk) ([]string, bool, bool, string, stri
rebuildInProgress := false
protectionSummary := ""
rebuildSummary := ""
+ protectionPriority := -1
for _, reason := range risk.Reasons {
code := strings.TrimSpace(reason.Code)
if code != "" {
@@ -118,8 +119,9 @@ func StorageRiskSemantics(risk *StorageRisk) ([]string, bool, bool, string, stri
switch code {
case "raid_degraded", "raid_unavailable", "unraid_invalid_disks", "unraid_disabled_disks", "unraid_missing_disks", "unraid_parity_unavailable", "unraid_no_parity", "zfs_pool_state":
protectionReduced = true
- if protectionSummary == "" {
+ if priority := protectionSummaryPriority(code); protectionSummary == "" || priority > protectionPriority {
protectionSummary = strings.TrimSpace(reason.Summary)
+ protectionPriority = priority
}
case "raid_rebuilding", "unraid_sync_active":
rebuildInProgress = true
@@ -132,6 +134,23 @@ func StorageRiskSemantics(risk *StorageRisk) ([]string, bool, bool, string, stri
return codes, protectionReduced, rebuildInProgress, protectionSummary, rebuildSummary
}
+func protectionSummaryPriority(code string) int {
+ switch strings.TrimSpace(code) {
+ case "unraid_parity_unavailable":
+ return 100
+ case "unraid_no_parity":
+ return 90
+ case "raid_unavailable":
+ return 80
+ case "raid_degraded", "zfs_pool_state":
+ return 70
+ case "unraid_invalid_disks", "unraid_disabled_disks", "unraid_missing_disks":
+ return 60
+ default:
+ return 0
+ }
+}
+
func summarizeDependentConsumerImpact(count int, names []string) string {
if count <= 0 {
return ""
diff --git a/internal/unifiedresources/storage_posture_test.go b/internal/unifiedresources/storage_posture_test.go
index 857141461a..13bc35fb74 100644
--- a/internal/unifiedresources/storage_posture_test.go
+++ b/internal/unifiedresources/storage_posture_test.go
@@ -162,6 +162,23 @@ func TestStorageRiskSemantics_UnraidCodes(t *testing.T) {
}
}
+func TestStorageRiskSemantics_UnraidParitySummaryPreferredOverGenericDiskCounts(t *testing.T) {
+ risk := &StorageRisk{
+ Reasons: []StorageRiskReason{
+ {Code: "unraid_disabled_disks", Severity: storagehealth.RiskCritical, Summary: "Unraid array reports 1 disabled disk(s)"},
+ {Code: "unraid_parity_unavailable", Severity: storagehealth.RiskCritical, Summary: "Unraid parity protection is unavailable"},
+ },
+ }
+
+ _, protReduced, _, protSummary, _ := StorageRiskSemantics(risk)
+ if !protReduced {
+ t.Fatal("expected protectionReduced=true")
+ }
+ if protSummary != "Unraid parity protection is unavailable" {
+ t.Fatalf("expected parity summary to take precedence, got %q", protSummary)
+ }
+}
+
func TestStorageRiskSemantics_ZFSPoolState(t *testing.T) {
risk := &StorageRisk{
Reasons: []StorageRiskReason{