Harden detection model asset selection
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled

This commit is contained in:
Codex
2026-07-08 04:03:50 +02:00
parent 48ffcd0991
commit 0ed71c6f1e
7 changed files with 153 additions and 9 deletions
@@ -0,0 +1,37 @@
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
def test_detection_workflow_does_not_auto_select_runtime_model_assets() -> None:
hook = (ROOT / "frontend" / "src" / "hooks" / "useDetectionWorkflow.ts").read_text(encoding="utf-8")
assert "const activeAsset = assetResponse.items.find" not in hook
assert "setSelectedModelAssetId(activeAsset?.model_asset_id ?? '')" not in hook
assert "setSelectedModelAssetId(assetResponse.items[0]" not in hook
assert "setSelectedModelAssetId('')" in hook
def test_detection_lab_explains_explicit_model_asset_and_threshold_selection() -> None:
lab = (ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx").read_text(
encoding="utf-8"
)
assert "Explicit model asset" in lab
assert "No model file is selected automatically" in lab
assert "Current benchmark candidate" in lab
assert "geointel-building-yolov8s-hardneg160r4e50-pt" in lab
assert "Recommended starting threshold" in lab
assert "0.25" in lab
assert "will_download_models" in lab
def test_detection_run_readiness_requires_explicit_asset_when_local_assets_exist() -> None:
lab = (ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx").read_text(
encoding="utf-8"
)
assert "detectionHasExplicitModelAsset" in lab
assert "Select a local model asset deliberately" in lab
assert "local model asset" in lab