Files
geointel/backend/tests/test_sprint123_raster_detection_handoff_operational.py
T
Codex 46204edbf4
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled
Harden raster detection manifest handoff
2026-07-08 12:04:21 +02:00

47 lines
2.0 KiB
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
def test_raster_workflow_exposes_structured_tile_manifest_handoff() -> None:
hook = (ROOT / "frontend" / "src" / "hooks" / "useDatasetWorkflow.ts").read_text(encoding="utf-8")
types = (ROOT / "frontend" / "src" / "types.ts").read_text(encoding="utf-8")
assert "interface RasterTileHandoff" in types
assert "latestRasterTileManifest" in hook
assert "toRasterTileHandoff(job)" in hook
assert "setLatestRasterTileManifest(manifest)" in hook
assert "manifest.manifest_path" in hook
def test_raster_controls_show_manifest_details_and_ai_handoff_action() -> None:
controls = (ROOT / "frontend" / "src" / "components" / "datasets" / "RasterControls.tsx").read_text(
encoding="utf-8"
)
assert "latestRasterTileManifest" in controls
assert "Tile count" in controls
assert "Tile size" in controls
assert "Overlap" in controls
assert "Use manifest in Detection Lab" in controls
assert "Use manifest in Segmentation Lab" in controls
def test_detection_handoff_opens_ai_lab_preflights_manifest_and_keeps_asset_explicit() -> None:
app = (ROOT / "frontend" / "src" / "App.tsx").read_text(encoding="utf-8")
lab = (ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx").read_text(
encoding="utf-8"
)
assert "setDetectionTileManifestPath(manifestPath)" in app
assert "setSelectedDetectionDatasetId(selectedDataset.id)" in app
assert "setSelectedDetectionModelId('yolo-configured')" in app
assert "setDetectionConfidenceThreshold(0.25)" in app
assert "loadYoloPreflight(manifestPath).catch(() => null)" in app
assert "setSelectedModelAssetId(" not in app[app.index("const useRasterTileManifestForDetection"):app.index("const {", app.index("const useRasterTileManifestForDetection"))]
assert "Linked tile manifest" in lab
assert "Tile manifest validation" in lab
assert "Tile count" in lab
assert "will_run_inference" in lab