Accept official Statbel archive member layout
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

This commit is contained in:
Codex
2026-07-19 03:23:14 +02:00
parent d3eed89844
commit 720494e5c1
2 changed files with 20 additions and 3 deletions
@@ -107,6 +107,7 @@ def geometry_archive(
date: str = "2025-01-01",
municipality_mismatch: bool = False,
repairable_invalid: bool = False,
include_crs_token_in_member: bool = True,
) -> bytes:
payload = {
"type": "FeatureCollection",
@@ -133,10 +134,14 @@ def geometry_archive(
}
payload["features"][0]["properties"]["ms_area_ha"] = 2.0
buffer = io.BytesIO()
member_stem = (
"sh_statbel_statistical_sectors_31370_20250101"
if include_crs_token_in_member
else "sh_statbel_statistical_sectors_20250101"
)
with zipfile.ZipFile(buffer, "w", compression=zipfile.ZIP_DEFLATED) as archive:
archive.writestr(
"sh_statbel_statistical_sectors_31370_20250101.geojson/"
"sh_statbel_statistical_sectors_31370_20250101.geojson",
f"{member_stem}.geojson/{member_stem}.geojson",
json.dumps(payload),
)
return buffer.getvalue()
@@ -225,6 +230,18 @@ def test_preflight_supports_the_complete_national_scope() -> None:
assert accounting["accounted_population_total"] == 243
def test_preflight_accepts_real_archive_member_without_repeated_crs_token(tmp_path: Path) -> None:
result = validate(
tmp_path,
geometry_content=geometry_archive(include_crs_token_in_member=False),
)
assert result.manifest["status"] == "passed"
assert result.manifest["artifacts"]["geometry"]["member"].endswith(
"/sh_statbel_statistical_sectors_20250101.geojson"
)
def test_national_preflight_rejects_an_unscoped_baseline(tmp_path: Path) -> None:
with pytest.raises(PREFLIGHT.StatbelPreflightError) as exc_info:
PREFLIGHT.validate_statbel_release(