Add AI lab action guardrails
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
def test_detection_lab_distinguishes_configured_model_from_ui_runnable_action() -> None:
|
||||
lab = (ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
|
||||
assert "detectionModelUiRunnable" in lab
|
||||
assert "selectedDetectionModelId !== 'manual-fixture-detector'" in lab
|
||||
assert "detectionRunBlockedReason" in lab
|
||||
assert "Fixture model is explicit test/demo-only" in lab
|
||||
assert "Run action" in lab
|
||||
assert "disabled={runningDetection || !detectionRunReady}" in lab
|
||||
|
||||
|
||||
def test_segmentation_lab_distinguishes_configured_model_from_ui_runnable_action() -> None:
|
||||
lab = (ROOT / "frontend" / "src" / "components" / "segmentation" / "SegmentationLab.tsx").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
|
||||
assert "segmentationModelUiRunnable" in lab
|
||||
assert "selectedSegmentationModelId !== 'fixture-segmenter'" in lab
|
||||
assert "segmentationRunBlockedReason" in lab
|
||||
assert "Fixture segmenter is explicit test/demo-only" in lab
|
||||
assert "Run action" in lab
|
||||
assert "disabled={runningSegmentation || !segmentationRunReady}" in lab
|
||||
|
||||
|
||||
def test_ai_lab_guardrail_styles_remain_compact() -> None:
|
||||
css = (ROOT / "frontend" / "src" / "styles" / "app.css").read_text(encoding="utf-8")
|
||||
|
||||
assert ".lab-action-guardrail" in css
|
||||
assert ".lab-action-guardrail-ready" in css
|
||||
assert "overflow-wrap: anywhere;" in css
|
||||
Reference in New Issue
Block a user