Files
geointel/backend/tests/test_sprint122_model_asset_activation_guardrails.py
T
Jens b76cd1837b
GeoIntel release gates / Compile, test, contracts and builds (push) Canceled after 0s
GeoIntel release gates / Python and npm vulnerability policy (push) Canceled after 0s
GeoIntel release gates / GIS image, SBOM and container scan (push) Canceled after 0s
fix(ai): bind model scope to immutable geometry
2026-08-09 10:54:52 +02:00

45 lines
1.9 KiB
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
def test_detection_workflow_selects_only_the_active_runtime_model_asset_automatically() -> None:
hook = (ROOT / "frontend" / "src" / "hooks" / "useDetectionWorkflow.ts").read_text(encoding="utf-8")
assert "const activeAsset = assetResponse.items.find((asset) => asset.active) ?? null" in hook
assert "const selectedAssetStillAvailable" in hook
assert "activeAsset?.model_asset_id ?? ''" in hook
assert "setSelectedModelAssetId(nextAssetId)" in hook
assert "setSelectedModelAssetId(assetResponse.items[0]" not in hook
assert "getYoloPreflight({ model_asset_id: nextAssetId || null })" in hook
def test_detection_lab_explains_explicit_model_asset_and_threshold_selection() -> None:
lab = "\n".join(
(
(ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx").read_text(encoding="utf-8"),
(ROOT / "frontend" / "src" / "components" / "detection" / "DetectionModelManagement.tsx").read_text(encoding="utf-8"),
)
)
assert "Lokaal modelbestand" in lab
assert "GeoIntel kiest automatisch het actieve lokale model" in lab
assert "Historische YOLO-controleprofielen" in lab
assert "DETECTION_OPERATOR_PROFILES" in lab
assert "historisch, geen releasebewijs" in lab
assert "will_download_models" in lab
def test_detection_run_readiness_requires_explicit_asset_when_local_assets_exist() -> None:
lab = "\n".join(
(
(ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx").read_text(encoding="utf-8"),
(ROOT / "frontend" / "src" / "components" / "detection" / "DetectionModelManagement.tsx").read_text(encoding="utf-8"),
)
)
assert "detectionHasExplicitModelAsset" in lab
assert "Kies een lokaal modelbestand onder beheer" in lab
assert "Lokale modelkeuze" in lab