Check page band legends against bands.py; amber is verified, not sampled

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
VasanthandClaude Opus 5.5 committed 2026-10-16 15:52:26 +05:30
1 parent 4ad9d96fb9
commit 7ad73c1fda
3 files changed
+19 -5

No files matched your search

+11
View File
@@ -1,5 +1,6 @@
"""Confidence bands: thresholds, the worst-word rule and the blank-mandatory flag (spec: Banding)."""
import importlib.util
import re
from pathlib import Path
BANDS = Path(__file__).resolve().parents[1] / "rpa-dashboard-ai" / "templates" / "web" / "bands.py"
@@ -39,3 +40,13 @@ def test_no_scores_means_unscored():
def test_only_green_skips_review():
assert not bands.needs_review("green")
assert all(bands.needs_review(b) for b in ["amber", "red", "blank", "unscored"])
def test_page_legends_use_the_bands_py_cut_points():
"""The legend labels are hard-coded in the pages; they must say what bands.py decides."""
green, floor = bands.GREEN_THRESHOLD, bands.CONFIDENCE_THRESHOLD
for page in [BANDS.parents[1] / "web" / "src" / "ai.ts", BANDS.parents[1] / "desktop" / "ai_sections.html"]:
m = re.search(r"Clean ≥([\d.]+).*?Check ([\d.]+)–([\d.]+).*?Review <([\d.]+)",
page.read_text(encoding="utf-8"), re.S)
assert m, f"{page.name}: band legend labels not found"
assert tuple(map(float, m.groups())) == (green, floor, green, floor), page.name