Prefer current orthophoto source version
GeoIntel CI / docs-smoke (push) Canceled after 0s
GeoIntel CI / contract-smoke (push) Canceled after 0s

This commit is contained in:
Codex
2026-07-16 15:09:33 +02:00
parent 1e0e7b6499
commit c76244bb85
2 changed files with 40 additions and 16 deletions
@@ -133,6 +133,30 @@ def test_source_freshness_requires_dataset_version_and_marks_temporal_series() -
assert item.integrity.missing_version_count == 1
def test_rolling_orthophoto_prefers_explicit_current_snapshot_over_historical_observation() -> None:
current = _dataset(
"digitaal_vlaanderen_orthophoto",
imported_at=NOW - timedelta(days=2),
observed_at=None,
source_version="most_recent_at_2026-07-14",
)
historical = _dataset(
"digitaal_vlaanderen_orthophoto",
imported_at=NOW - timedelta(days=1),
observed_at=datetime(2020, 6, 1, tzinfo=timezone.utc),
source_version="2020",
)
report = SourceFreshnessService.build_report(
current.project_id,
[current, historical],
[_version(current), _version(historical)],
now=NOW,
)
assert report.items[0].latest_source_version == "most_recent_at_2026-07-14"
def test_source_freshness_route_returns_canonical_envelope(monkeypatch) -> None:
from app.api.routes import datasets as dataset_routes