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.

Keep incomplete backup evidence distinct from absent backups

pulse-triage[bot]353d8afb581c
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index f5707eac6b..4efbe0dfa2 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -74,6 +74,18 @@ an unaffected completed sibling. Its opt-in
frames feed the actual existing Backups consumer at desktop/narrow widths for
interaction and native pixel proof. Fixtures perform only local GETs.
+### Unprotected does not mean an empty backup inventory
+
+When complete readable history supplies no qualifying success, the posture
+explanation says no successful, completed backup was found, not that no backup
+exists. Running, failed and uncertain artifacts remain inspectable evidence;
+they supply neither a successful-point time nor protection. Snapshot-only,
+partial/unavailable history and all state, freshness, verification and policy
+rules remain unchanged. `TestProtectionExplanationDoesNotEraseUnsuccessfulBackupEvidence`
+checks all non-success outcomes through the real point/observation builder.
+The ordinary PBS writer lifecycle checks the same explanation alongside live
+and durable artifact outcomes and feeds desktop/narrow Backups pixel proof.
+
### Coverage dates are inspectable without hover
Open Coverage evidence retains each point’s exact reported date as wrapping
diff --git a/internal/monitoring/pbs_writer_inventory_test.go b/internal/monitoring/pbs_writer_inventory_test.go
index 8fae2f77ba..cba17555fc 100644
--- a/internal/monitoring/pbs_writer_inventory_test.go
+++ b/internal/monitoring/pbs_writer_inventory_test.go
@@ -130,6 +130,7 @@ func TestPBSWriterInventoryDoesNotInventTerminalFailure(t *testing.T) {
for _, p := range postures {
if p.SubjectResourceID == f.ids[0] && i != 5 {
require.NotEqual(t, recovery.ProtectionStateProtected, p.State, "incomplete artifact cannot claim protection")
+ require.Contains(t, p.Explanation, "no successful, completed backup", "incomplete evidence is not an absent artifact")
}
}
frames[label] = map[string]any{
@@ -142,7 +143,7 @@ func TestPBSWriterInventoryDoesNotInventTerminalFailure(t *testing.T) {
require.Zero(t, writes.Load())
if dir := os.Getenv("PULSE_PBS_WRITER_FRAMES"); dir != "" && invalid.name == "duplicate-data" && family == "syncjob" {
hashes := map[string]string{}
- for _, file := range []string{"monitor_backups.go", "backup_guard.go", "../../pkg/pbs/client.go", "../../pkg/pbs/backup_inventory_response.go"} {
+ for _, file := range []string{"monitor_backups.go", "backup_guard.go", "../recovery/posture.go", "../../pkg/pbs/client.go", "../../pkg/pbs/backup_inventory_response.go"} {
content, err := os.ReadFile(file)
require.NoError(t, err)
hashes[file] = fmt.Sprintf("%x", sha256.Sum256(content))
diff --git a/internal/recovery/posture.go b/internal/recovery/posture.go
index 22ed6218ba..bd6559d181 100644
--- a/internal/recovery/posture.go
+++ b/internal/recovery/posture.go
@@ -613,7 +613,7 @@ func DeriveProtectionPostureAt(
if hasSnapshotsOnly {
posture.Explanation = "Only snapshots were found. A snapshot is not a separate backup, so it does not count."
} else {
- posture.Explanation = "Pulse can see the full backup history and found no backup for this resource."
+ posture.Explanation = "Pulse can see the full backup history, but found no successful, completed backup for this resource."
}
default:
posture.State = ProtectionStateUnknown
diff --git a/internal/recovery/posture_test.go b/internal/recovery/posture_test.go
index d595b5b2bf..f1eb046496 100644
--- a/internal/recovery/posture_test.go
+++ b/internal/recovery/posture_test.go
@@ -398,7 +398,7 @@ func TestBuildProtectionPostureDoesNotTreatSuccessfulTaskAsAvailableBackup(t *te
if got.LastSuccessfulPointAt != nil {
t.Fatalf("last successful point = %v, want nil for task-only evidence", got.LastSuccessfulPointAt)
}
- if !strings.Contains(got.Explanation, "found no backup") {
+ if !strings.Contains(got.Explanation, "found no successful, completed backup") {
t.Fatalf("explanation = %q, want no qualifying backup", got.Explanation)
}
}
@@ -698,3 +698,43 @@ func TestProtectionPostureFuturePointsRetainAccessBoundaries(t *testing.T) {
})
}
}
+
+// A complete inventory with no successful backup need not be empty. Existing
+// running/failed/uncertain artifacts remain evidence without supplying a usable
+// completed backup, a success time or a protected state.
+func TestProtectionExplanationDoesNotEraseUnsuccessfulBackupEvidence(t *testing.T) {
+ t.Parallel()
+ now := time.Date(2026, 10, 31, 9, 0, 0, 0, time.UTC)
+ started := now.Add(-time.Hour)
+ for _, outcome := range []Outcome{OutcomeRunning, OutcomeFailed, OutcomeWarning, OutcomeUnknown} {
+ t.Run(string(outcome), func(t *testing.T) {
+ point := RecoveryPoint{
+ ID: "pbs-backup:observed", Provider: ProviderProxmoxPBS,
+ Kind: KindBackup, Mode: ModeLocal, Outcome: outcome,
+ StartedAt: &started, SubjectResourceID: "resource:vm-100", ProviderScope: "pbs-main",
+ }
+ envelope, err := NewRecoveryPointEvidence(point, "pbs-backup-inventory", now)
+ if err != nil {
+ t.Fatal(err)
+ }
+ point.Evidence = envelope
+ observation, err := NewProtectionProviderObservation(ProviderProxmoxPBS,
+ "pbs-backup-enumeration", "pbs-main", OutcomeSuccess, ProtectionHistoryComplete,
+ operationaltrust.EvidencePermissionsSufficient, false, now, now, nil)
+ if err != nil {
+ t.Fatal(err)
+ }
+ got := BuildProtectionPostureFromPointsAt(point.SubjectResourceID, []RecoveryPoint{point},
+ []ProtectionProviderObservation{observation}, DefaultProtectionPosturePolicy, now)
+ if got.State != ProtectionStateUnprotected || got.Coverage != ProtectionCoverageNone || got.LastSuccessfulPointAt != nil {
+ t.Fatalf("non-successful point changed protection/success: %+v", got)
+ }
+ if len(got.ProviderStates) != 1 || len(got.EvidenceIDs) != 2 || len(got.ProviderStates[0].EvidenceIDs) != 2 {
+ t.Fatalf("observed backup evidence lost: %+v", got)
+ }
+ if !strings.Contains(got.Explanation, "no successful, completed backup") || strings.Contains(got.Explanation, "found no backup") {
+ t.Fatalf("retained %s artifact described as absent: %q", outcome, got.Explanation)
+ }
+ })
+ }
+}