Distinguish PBS listing volume from snapshot coverage (#5184)

Show per-datastore completed snapshot responses beside distinct groups
in the same memory sampling window. A repeat adds fixture work without
expanding coverage; a missing count is not zero. Keep the Proxmox estate
advisory and preserve the existing RSS observations.

---
Fleet candidate `20261126T020303Z-delivery-trust` from the
`delivery-trust` lane. Reviewed tip
`087efc14caedafcbb5c669314f2fc697448ff195` on `main`.

[How Pulse handles
triage](https://github.com/rcourtman/Pulse/blob/main/docs/AI_TRANSPARENCY.md)
This commit is contained in:
pulse-triage[bot]
2026-11-26 02:36:37 +00:00
committed by GitHub
5 changed files with 78 additions and 20 deletions

View File

@@ -279,10 +279,12 @@ in the steady RSS window, with the longest gap per datastore including both
edges. A single status response or a gap longer than half that window limits
the comparison even when every datastore responded. This describes the
coverage of the observation, not a required poll cadence or a backup alarm.
Snapshot responses completed within that same window are shown
separately per datastore, so full coverage earlier in the run or a current
status response cannot stand in for a current snapshot listing. A zero does
not mean a backup failure or require cached snapshots to be requested again.
The same window shows per-datastore distinct snapshot groups and completed
nonempty snapshot responses separately. Repeat listings count as traffic, not
as new groups, so equal coverage can still hide different work. Coverage from
warmup or a current status response cannot stand in for a current listing.
A zero does not mean a backup failure or require cached snapshots to be
requested again; an older report without response counts shows `n/a`.
An unfinished window has no steady observation. If sampling or a worker fails,
the summary and `result.json` still retain available Proxmox traffic separately
from the failed RSS comparison. A recorded zero stays distinct from unavailable

View File

@@ -179,10 +179,14 @@ class SnapshotCoverage:
expected_groups: int
served_groups: set[tuple[str, str]] = field(default_factory=set)
steady_groups: set[tuple[str, str]] = field(default_factory=set)
steady_responses: int = 0
def counts(self, *, steady: bool = False) -> dict[str, int]:
groups = self.steady_groups if steady else self.served_groups
return {"expected_groups": self.expected_groups, "served_groups": len(groups)}
result = {"expected_groups": self.expected_groups, "served_groups": len(groups)}
if steady:
result["completed_responses"] = self.steady_responses
return result
def missing_snapshot_coverage(coverage: dict[str, dict[str, dict[str, int]]]) -> list[str]:
@@ -716,9 +720,9 @@ def make_pbs_handler(
snapshots = snaps_by_key.get((ds, btype, bid), [])
self.send_json(snapshots)
if snapshots:
# Count only a completed, nonempty response. Retries
# for the same group do not cover another group, and
# a warmup response does not cover the RSS window.
# Count only completed, nonempty fixture responses.
# A repeat contributes traffic, not another group;
# warmup does not count in the RSS window.
in_window = (observation_window is not None and len(parts) == 5
and observation_window.includes(time.time_ns() // 1_000_000))
with lock:
@@ -727,6 +731,7 @@ def make_pbs_handler(
row.served_groups.add(group)
if in_window:
row.steady_groups.add(group)
row.steady_responses += 1
return
if ep == "rrd":
return self.send_json([])

View File

@@ -237,7 +237,9 @@ def pbs_steady_datastore_status(stats: dict) -> str:
return f"{seen}/{len(stores)} with a response; longest gap {longest:g} s in {coverage['window_s']} s"
def pbs_steady_snapshot_groups(stats: dict | None, window_s: int) -> dict[tuple[str, str], tuple[int, int]]:
def pbs_steady_snapshot_listings(
stats: dict | None, window_s: int,
) -> dict[tuple[str, str], tuple[int, int, int | None]]:
coverage = (stats or {}).get("pbs_steady_snapshot_group_coverage")
if not isinstance(coverage, dict) or coverage.get("window_s") != window_s:
return {}
@@ -253,33 +255,47 @@ def pbs_steady_snapshot_groups(stats: dict | None, window_s: int) -> dict[tuple[
continue
served, expected = row.get("served_groups"), row.get("expected_groups")
if type(served) is int and type(expected) is int and 0 <= served <= expected:
counts[instance, store] = (served, expected)
responses = row.get("completed_responses")
if (type(responses) is not int or responses < served
or (served == 0 and responses != 0)):
responses = None
counts[instance, store] = (served, expected, responses)
return counts
def pbs_snapshot_window_lines(baseline: dict | None, candidate: dict | None, window_s: int) -> list[str]:
base = pbs_steady_snapshot_groups(baseline, window_s)
cand = pbs_steady_snapshot_groups(candidate, window_s)
base = pbs_steady_snapshot_listings(baseline, window_s)
cand = pbs_steady_snapshot_listings(candidate, window_s)
lines = ["", f"**PBS snapshot groups served/configured in the {window_s} s RSS window**", ""]
if not base and not cand:
return [*lines, "No same-window snapshot-listing evidence is available."]
lines += [
"Each group counts once per datastore after a nonempty fixture response completes. "
"Completed response counts include repeats of the same group. "
"This is not a freshness check. "
"Zero means no matching listing completed in the window, not a backup failure; "
"Pulse may use cached data. `n/a` means evidence was unavailable.",
"",
"| PBS datastore | Baseline | Candidate |",
"|---|---:|---:|",
"| PBS datastore | Baseline groups | Candidate groups | Baseline responses | Candidate responses |",
"|---|---:|---:|---:|---:|",
]
groups_differ = responses_differ = False
for instance, store in sorted(base.keys() | cand.keys()):
key = (instance, store)
cells = [f"{counts[key][0]}/{counts[key][1]}" if key in counts else "n/a" for counts in (base, cand)]
lines.append(f"| {instance}/{store} | {cells[0]} | {cells[1]} |")
if base != cand:
rows = [side.get((instance, store)) for side in (base, cand)]
group_counts = [row[:2] if row is not None else None for row in rows]
groups = [f"{count[0]}/{count[1]}" if count is not None else "n/a" for count in group_counts]
responses = [row[2] if row is not None else None for row in rows]
counts = [str(count) if count is not None else "n/a" for count in responses]
lines.append(f"| {instance}/{store} | {' | '.join(groups + counts)} |")
groups_differ |= group_counts[0] != group_counts[1]
responses_differ |= None not in responses and responses[0] != responses[1]
if groups_differ:
lines += ["", "**PBS snapshot-listing evidence differs between builds.** "
"These observations do not establish equivalent backup-listing work for an RSS comparison."]
if responses_differ:
lines += ["", "**PBS completed snapshot response counts differ between builds.** "
"Matching group counts do not establish equivalent backup-listing traffic."]
return lines

View File

@@ -274,6 +274,7 @@ class ProxmoxMemoryLoadTests(unittest.TestCase):
request(fast_vm, 0)
request(fast_vm, 300)
request(archive_vm, 301)
request(fast_vm.replace("?", "/extra?"), 20) # not the snapshot listing path
handler.send_json.side_effect = BrokenPipeError
with self.assertRaises(BrokenPipeError):
request(fast_ct, 15)
@@ -283,8 +284,8 @@ class ProxmoxMemoryLoadTests(unittest.TestCase):
self.assertEqual(window.snapshot_report({"pbs1": stores}, END), {
"window_s": 300,
"datastores": {"pbs1": {
"store-fast": {"expected_groups": 2, "served_groups": 1},
"store-archive": {"expected_groups": 1, "served_groups": 0},
"store-fast": {"expected_groups": 2, "served_groups": 1, "completed_responses": 2},
"store-archive": {"expected_groups": 1, "served_groups": 0, "completed_responses": 0},
}},
})
self.assertEqual(stores["store-fast"].counts(), {"expected_groups": 2, "served_groups": 2})

View File

@@ -470,6 +470,40 @@ class ReleaseMemorySummaryTests(unittest.TestCase):
_, _, text = compare(baseline["pbs_steady_snapshot_group_coverage"])
self.assertNotIn("PBS snapshot-listing evidence differs", text)
def test_pbs_snapshot_response_counts_disambiguate_equal_group_coverage(self):
def traffic(fast_count, archive_count):
return {
"pve_nodes": 1, "guests": 2, "pbs_instances": 1, "total_pbs_snapshots": 150,
"snapshots_per_group": 50, "pve_requests": 90, "pbs_requests": 50,
"dashboard": {"connects": 1, "messages": 60, "bytes": 1024},
"pbs_steady_snapshot_group_coverage": {"window_s": 300, "datastores": {"pbs1": {
"store-fast": {"expected_groups": 2, "served_groups": 2, "completed_responses": fast_count},
"store-archive": {"expected_groups": 1, "served_groups": 0, "completed_responses": archive_count},
}}},
}
full = samples(131072, 25, 0)
for fast_count, count_cell, differs in ((5, "5", True), (2, "2", False),
(None, "n/a", False), (1, "n/a", False),
(True, "n/a", False)):
with self.subTest(fast_count=fast_count):
baseline, candidate = traffic(2, 0), traffic(fast_count, 0)
if fast_count is None:
del candidate["pbs_steady_snapshot_group_coverage"]["datastores"]["pbs1"]["store-fast"][
"completed_responses"]
code, result, text = self.run_summary(
full, full, estate="proxmox", proxmox={"baseline": baseline, "candidate": candidate},
env={"PULSE_MEMORY_GATE": "0"}, wait_statuses=(0, 0),
)
self.assertEqual(code, 0)
self.assertEqual(result["status"], "measured")
self.assertFalse(result["gated"])
self.assertEqual(result["candidate_proxmox"], candidate)
self.assertIn(f"| pbs1/store-fast | 2/2 | 2/2 | 2 | {count_cell} |", text)
self.assertIn("| pbs1/store-archive | 0/1 | 0/1 | 0 | 0 |", text)
self.assertNotIn("PBS snapshot-listing evidence differs", text)
self.assertEqual("PBS completed snapshot response counts differ" in text, differs)
def test_proxmox_unavailable_traffic_does_not_erase_adverse_rss(self):
code, result, text = self.run_summary(
samples(131072, 25, 0), samples(174080, 25, 0), estate="proxmox",