From 04bf457a8bdf0bb02f72a2bcfafca9f3a7bfe4f7 Mon Sep 17 00:00:00 2001 From: amarcozzi Date: Wed, 26 Aug 2026 15:26:46 -0600 Subject: [PATCH] Give leaflux/fosberg grid fixtures valid bands so the wildcard list can serialize them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The leaflux and fosberg router-test `grid_factory` fixtures wrote source-grid documents straight to Firestore with bands shaped `{"key": key}` — missing the required `index` and `type` fields. Under pytest-xdist these fixtures are briefly alive in the shared test owner's collection while, on another worker, `TestListGridsWildcard` calls `list_grids_cross_domain`, which does `Grid(**doc.to_dict())` over every one of the owner's grids with no error handling. Serializing a fixture band with no `index` raised a Pydantic ValidationError, so the wildcard-list endpoint returned 500 and the test failed (assert 500 == 200). The failure was flaky/latent before but became a consistent post-deploy CI failure once more fixture grids were added. Build the fixtures' bands with an enumerated `index` and `type: continuous` (every band these fixtures use is continuous), so a concurrent cross-domain list serializes them cleanly. Test-only; no product change. Verified against a live server serially and under 4-worker xdist (the parallel mode that triggered the flake). --- .../grids/fuel_moisture/dead/fosberg/test_router.py | 5 ++++- .../resources/grids/solar/irradiance/leaflux/test_router.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/services/api/tests/resources/grids/fuel_moisture/dead/fosberg/test_router.py b/services/api/tests/resources/grids/fuel_moisture/dead/fosberg/test_router.py index 8951d76e..1ee35f5a 100644 --- a/services/api/tests/resources/grids/fuel_moisture/dead/fosberg/test_router.py +++ b/services/api/tests/resources/grids/fuel_moisture/dead/fosberg/test_router.py @@ -33,7 +33,10 @@ def _make( transform=TRANSFORM, ): data = make_grid_data(domain_id=domain_id, name="source grid", status=status) - data["bands"] = [{"key": key} for key in bands] + data["bands"] = [ + {"key": key, "type": "continuous", "index": i} + for i, key in enumerate(bands) + ] data["georeference"] = { "crs": crs, "transform": list(transform), diff --git a/services/api/tests/resources/grids/solar/irradiance/leaflux/test_router.py b/services/api/tests/resources/grids/solar/irradiance/leaflux/test_router.py index c331c291..db25b8ef 100644 --- a/services/api/tests/resources/grids/solar/irradiance/leaflux/test_router.py +++ b/services/api/tests/resources/grids/solar/irradiance/leaflux/test_router.py @@ -44,7 +44,10 @@ def _make( transform=TRANSFORM, ): data = make_grid_data(domain_id=domain_id, name="source grid", status=status) - data["bands"] = [{"key": key} for key in bands] + data["bands"] = [ + {"key": key, "type": "continuous", "index": i} + for i, key in enumerate(bands) + ] data["georeference"] = { "crs": crs, "transform": list(transform),