AI web starter: bands, review split pane, approve gate, server stub (checkpoint)
React + Vite + Tailwind starter with the no-AI shell, band legend, review split pane with drafts and verify, and a server stub that refuses approval while flagged fields are unverified. Band self-check and AI page check. Both page checks share one Chromium via tests/conftest.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3eb3fdf00e
commit
d4d3f83fb1
24 files changed
+3429
-73
No files matched your search
@@ -0,0 +1,41 @@
|
||||
"""Confidence bands: thresholds, the worst-word rule and the blank-mandatory flag (spec: Banding)."""
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
|
||||
BANDS = Path(__file__).resolve().parents[1] / "rpa-dashboard-ai" / "templates" / "web" / "bands.py"
|
||||
spec = importlib.util.spec_from_file_location("bands", BANDS)
|
||||
bands = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(bands)
|
||||
|
||||
|
||||
def test_thresholds():
|
||||
assert bands.band_of(1.0) == "green"
|
||||
assert bands.band_of(0.95) == "green"
|
||||
assert bands.band_of(0.9499) == "amber"
|
||||
assert bands.band_of(0.90) == "amber"
|
||||
assert bands.band_of(0.8999) == "red"
|
||||
assert bands.band_of(0.0) == "red"
|
||||
|
||||
|
||||
def test_field_takes_its_worst_word():
|
||||
assert bands.field_band([0.99, 0.97, 0.98], "ACME Office Supply") == "green"
|
||||
assert bands.field_band([0.99, 0.93, 0.98], "ACME Office Supply") == "amber"
|
||||
assert bands.field_band([0.99, 0.97, 0.62], "ACME Office Supply") == "red"
|
||||
|
||||
|
||||
def test_blank_mandatory_field_is_always_flagged():
|
||||
assert bands.field_band([1.0], "", mandatory=True) == "blank"
|
||||
assert bands.field_band([], " ", mandatory=True) == "blank"
|
||||
assert bands.field_band(None, None, mandatory=True) == "blank"
|
||||
assert bands.needs_review("blank")
|
||||
# An optional blank is graded like any other field.
|
||||
assert bands.field_band([1.0], "", mandatory=False) == "green"
|
||||
|
||||
|
||||
def test_no_scores_means_unscored():
|
||||
assert bands.field_band([], "INV-1001") == "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"])
|
||||
Reference in new issue
Block a user