Harden golden QA readiness gate
This commit is contained in:
@@ -23,6 +23,19 @@ datasets, vector FeatureCollection content, vector feature summary, persisted
|
||||
QA/QC metrics, creates metadata/report/vector GeoJSON exports, lists exports
|
||||
and downloads the JSON/GeoJSON/HTML artifacts through the frontend proxy.
|
||||
|
||||
Verify the deterministic QA/QC golden benchmark:
|
||||
|
||||
```bash
|
||||
bash scripts/verify_golden_qa_benchmark.sh
|
||||
python scripts/run_golden_qa_benchmark.py --json
|
||||
```
|
||||
|
||||
The benchmark uses only explicit local fixtures under `fixtures/golden`,
|
||||
executes the existing QA/QC matching logic, verifies the expected precision,
|
||||
recall, F1, mean IoU and false-positive/false-negative counts, and checks that
|
||||
`QualityCheck` plus `Metric` rows would be persisted. The main readiness gate
|
||||
runs this benchmark so QA metric drift fails before a release.
|
||||
|
||||
Verify a configured local YOLO model without running inference:
|
||||
|
||||
```bash
|
||||
|
||||
@@ -35,6 +35,7 @@ ${PYTHON_BIN} scripts/smoke_contracts.py
|
||||
${PYTHON_BIN} scripts/preimplementation_audit.py
|
||||
${PYTHON_BIN} scripts/validate_m13_codex_assets.py
|
||||
${PYTHON_BIN} scripts/validate_m14_launch_assets.py
|
||||
${PYTHON_BIN} scripts/run_golden_qa_benchmark.py --json >/dev/null
|
||||
${PYTHON_BIN} -m py_compile scripts/gis_import_smoke.py
|
||||
${PYTHON_BIN} -m py_compile scripts/seed_demo_workflow.py
|
||||
${PYTHON_BIN} -m py_compile scripts/yolo_preflight.py
|
||||
@@ -50,4 +51,5 @@ bash -n scripts/live_migration_smoke.sh
|
||||
bash -n scripts/verify_browser_runtime.sh
|
||||
bash -n scripts/verify_demo_export_workflow.sh
|
||||
bash -n scripts/verify_gis_runtime.sh
|
||||
bash -n scripts/verify_golden_qa_benchmark.sh
|
||||
echo "== Run readiness check passed =="
|
||||
|
||||
@@ -1,9 +1,38 @@
|
||||
from pathlib import Path
|
||||
import json
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
fixture_dir=ROOT/"fixtures"/"geojson"
|
||||
if not fixture_dir.exists(): raise SystemExit("fixtures/geojson missing")
|
||||
for path in fixture_dir.glob("*.geojson"):
|
||||
data=json.loads(path.read_text(encoding="utf-8"))
|
||||
if data.get("type") != "FeatureCollection": raise SystemExit(f"{path} is not a FeatureCollection")
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def _validate_feature_collection(path: Path) -> None:
|
||||
data = json.loads(path.read_text(encoding="utf-8"))
|
||||
if data.get("type") != "FeatureCollection":
|
||||
raise SystemExit(f"{path} is not a FeatureCollection")
|
||||
features = data.get("features")
|
||||
if not isinstance(features, list):
|
||||
raise SystemExit(f"{path} has no feature list")
|
||||
for index, feature in enumerate(features):
|
||||
geometry = feature.get("geometry") if isinstance(feature, dict) else None
|
||||
if not isinstance(geometry, dict) or not geometry.get("type"):
|
||||
raise SystemExit(f"{path} feature {index} has no geometry")
|
||||
|
||||
|
||||
def _validate_fixture_dir(relative_path: str) -> None:
|
||||
fixture_dir = ROOT / relative_path
|
||||
if not fixture_dir.exists():
|
||||
raise SystemExit(f"{relative_path} missing")
|
||||
for path in fixture_dir.glob("*.geojson"):
|
||||
_validate_feature_collection(path)
|
||||
|
||||
|
||||
_validate_fixture_dir("fixtures/geojson")
|
||||
_validate_fixture_dir("fixtures/golden")
|
||||
|
||||
expected_path = ROOT / "fixtures" / "golden" / "expected_qa_metrics.json"
|
||||
expected = json.loads(expected_path.read_text(encoding="utf-8"))
|
||||
for key in ("candidate_fixture", "reference_fixture"):
|
||||
fixture_path = ROOT / expected[key]
|
||||
if not fixture_path.exists():
|
||||
raise SystemExit(f"Golden QA fixture missing: {fixture_path}")
|
||||
|
||||
print("Fixture validation OK")
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
if [ -z "${PYTHON_BIN:-}" ]; then
|
||||
PYTHON_BIN=""
|
||||
for candidate in python3 python.exe python; do
|
||||
if command -v "${candidate}" >/dev/null 2>&1 && "${candidate}" -c "import sys" >/dev/null 2>&1; then
|
||||
PYTHON_BIN="${candidate}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -z "${PYTHON_BIN:-}" ]; then
|
||||
echo "No usable python interpreter found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "== GeoIntel golden QA/QC benchmark =="
|
||||
"${PYTHON_BIN}" scripts/run_golden_qa_benchmark.py --json
|
||||
Reference in New Issue
Block a user