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.

Name verified source in browser coverage failures

pulse-triage[bot]38f324736f67
diff --git a/scripts/release_control/browser_verification_guard.py b/scripts/release_control/browser_verification_guard.py
index 71dd877d3c..c437fc7669 100644
--- a/scripts/release_control/browser_verification_guard.py
+++ b/scripts/release_control/browser_verification_guard.py
@@ -462,7 +462,7 @@ def range_receipt_coverage(
head: str,
*,
repo_root: Path = REPO_ROOT,
-) -> tuple[dict[str, set[str]], list[str], list[str]]:
+) -> tuple[dict[str, dict[str, list[str]]], list[str], list[str]]:
"""Content digests verified by valid receipts authored inside base..head.
Each receipt is validated exactly as the per-commit guard validates it at
@@ -475,7 +475,9 @@ def range_receipt_coverage(
(recreated, or kept while resolving a merge with the main that deleted
it), or a commit that both records and deletes receipts.
"""
- covered: dict[str, set[str]] = {}
+ # Keep provenance beside each admitted digest so a failed composition
+ # names what actually passed, without rereading or trusting invalid proof.
+ covered: dict[str, dict[str, list[str]]] = {}
diagnostics: list[str] = []
violations: list[str] = []
if LEGACY_RECEIPT_PATH in blob_ids(head, [LEGACY_RECEIPT_PATH], repo_root=repo_root):
@@ -535,7 +537,8 @@ def range_receipt_coverage(
diagnostics.append(f"{label}: receipt is invalid: " + "; ".join(errors))
continue
for path, digest in payload["content_sha256"].items():
- covered.setdefault(path, set()).add(digest)
+ origins = covered.setdefault(path, {}).setdefault(digest, [])
+ origins.append(f"{commit}:{receipt_path} (parent {commit_base})")
return covered, diagnostics, violations
@@ -561,13 +564,28 @@ def range_coverage_errors(
"""
covered, diagnostics, violations = range_receipt_coverage(base, head, repo_root=repo_root)
final = content_sha256(changed_paths, commit=head, repo_root=repo_root)
- uncovered = [path for path in changed_paths if final[path] not in covered.get(path, set())]
+ uncovered = [path for path in changed_paths if final[path] not in covered.get(path, {})]
if not uncovered:
return [], violations
- errors = [
- f"{path} final content {final[path][:12]} is not verified by any valid receipt in the range"
- for path in uncovered
- ]
+ errors: list[str] = []
+ for path in uncovered:
+ errors.append(
+ f"{path} final content {final[path]} is not verified by any valid receipt in the range"
+ )
+ prior = sorted(
+ (digest, origin)
+ for digest, origins in covered.get(path, {}).items()
+ for origin in origins
+ )
+ if not prior:
+ errors.append(f"{path}: no valid in-range receipt names this path")
+ continue
+ # A long-lived branch can contain many earlier browser passes. Bound
+ # hints, not admission: every valid digest still contributes coverage.
+ for digest, origin in prior[:3]:
+ errors.append(f"{path}: different verified content {digest} at {origin}")
+ if len(prior) > 3:
+ errors.append(f"{path}: {len(prior) - 3} further valid receipt(s) omitted from hints")
errors.extend(diagnostics)
return errors, violations
@@ -881,7 +899,9 @@ def check_range(paths: Sequence[str], *, base: str, head: str, repo_root: Path =
advice=[
"Content changed after its browser pass (a correction, a conflict resolution, "
"or two changes to one file) needs a fresh receipt for the final content, "
- "committed in its own non-merge commit and bound to that commit's parent."
+ "committed in its own non-merge commit and bound to that commit's parent.",
+ "Keep earlier receipts and reviewed history unchanged. Changing a receipt's "
+ "hash or parent is not a browser pass for the final content.",
],
)
if violations:
diff --git a/scripts/release_control/browser_verification_guard_test.py b/scripts/release_control/browser_verification_guard_test.py
index 1ea81ef175..1be6526b75 100644
--- a/scripts/release_control/browser_verification_guard_test.py
+++ b/scripts/release_control/browser_verification_guard_test.py
@@ -618,6 +618,68 @@ class IntegrationRangeTest(GuardRepoTestCase):
self.assertIn(CHANGED_PATH, stderr)
self.assertNotIn(OTHER_PATH, stderr)
+ def test_stale_stylesheet_reports_verified_source_and_final_digest(self) -> None:
+ path = "frontend-modern/src/index.css"
+ old = ".alert-history { min-width: 20rem; }\n"
+ final = old + ".form-select { background-position: right 0.5rem center; }\n"
+ verified = self.verified_change(path, old, "verified alert stylesheet")
+ (receipt,) = self.receipts_in_tree()
+ self.write(path, final)
+ self.commit("compose select styling without a new browser pass")
+
+ status, stderr = self.run_range()
+
+ self.assertEqual(status, 1)
+ self.assertIn(f"{path} final content {hashlib.sha256(final.encode()).hexdigest()}", stderr)
+ self.assertIn(f"different verified content {hashlib.sha256(old.encode()).hexdigest()}", stderr)
+ self.assertIn(f"{verified}:{receipt} (parent {self.base})", stderr)
+ self.assertIn("Changing a receipt's hash or parent is not a browser pass", stderr)
+ # A real follow-up receipt, not editing the stale one, covers the
+ # composed bytes while preserving the original reviewed source.
+ self.write_receipt([path])
+ self.commit("record browser proof of final composed stylesheet")
+ self.assertEqual(self.run_range(), (0, ""))
+ self.git("merge-base", "--is-ancestor", verified, "HEAD")
+
+ def test_missing_receipt_is_distinct_from_a_valid_receipt_for_different_bytes(self) -> None:
+ self.write(CHANGED_PATH, "export const a = 1;\n")
+ self.commit("unverified frontend change")
+
+ status, stderr = self.run_range()
+
+ self.assertEqual(status, 1)
+ self.assertIn(f"{CHANGED_PATH}: no valid in-range receipt names this path", stderr)
+ self.assertNotIn("different verified content", stderr)
+
+ def test_invalid_receipt_never_contributes_a_verified_source_hint(self) -> None:
+ self.write(CHANGED_PATH, "export const a = 1;\n")
+ self.write_receipt([CHANGED_PATH], base="b" * 40)
+ self.commit("invalid parent binding")
+ self.write(CHANGED_PATH, "export const a = 2;\n")
+ self.commit("later frontend change")
+
+ status, stderr = self.run_range()
+
+ self.assertEqual(status, 1)
+ self.assertIn("base_sha must match", stderr)
+ self.assertIn("no valid in-range receipt names this path", stderr)
+ self.assertNotIn("different verified content", stderr)
+
+ def test_verified_source_hints_are_bounded_without_limiting_coverage(self) -> None:
+ for version in range(1, 5):
+ self.verified_change(CHANGED_PATH, f"export const a = {version};\n", f"pass {version}")
+ # The fourth pass is admitted even though a blocked diagnostic would
+ # display at most three earlier sources.
+ self.assertEqual(self.run_range(), (0, ""))
+ self.write(CHANGED_PATH, "export const a = 5;\n")
+ self.commit("unverified later frontend change")
+
+ status, stderr = self.run_range()
+
+ self.assertEqual(status, 1)
+ self.assertEqual(stderr.count("different verified content"), 3)
+ self.assertIn("1 further valid receipt(s) omitted from hints", stderr)
+
def test_merge_resolution_receipt_is_not_evidence(self) -> None:
# A conflict resolution that changes source and rewrites the receipt
# inside the merge commit has no browser run behind it.