Epic: #51 · S1 · depends on #61 (S0) · story implementation
Problem (C-34)
Nothing asserts how many cells the FAO pipeline should process; a wrong/stale region delivers partial coverage to FAO with no signal. _validate checks only metadata nulls.
Build shape (per the epic design contract)
delivery/coverage.py (representation-free): assert_complete_coverage(received_gids: set[int], expected_count: int) -> None (raise on mismatch); region→expected-count constant alongside (delivery/ constants). No pandas.
unfao/extraction.py: cells_of(df) -> set[int] — the only pandas line.
- Manager: calls
assert_complete_coverage(cells_of(df), EXPECTED[region]) via the S0 hook; logs fetched/enriched/unmapped counts.
Two checks: (a) internal consistency — received gids survive to delivery (expected = the gids that arrived); (b) region intent — count matches the intended region (expected = declared constant; to be sourced from datafactory region metadata when it publishes it — same companion shape as S2's last_valid_month_id).
Acceptance criteria
Files
views_postprocessing/delivery/coverage.py (new), views_postprocessing/unfao/extraction.py (extend), unfao/managers/unfao.py (call), tests/.
Epic: #51 · S1 · depends on #61 (S0) ·
storyimplementationProblem (C-34)
Nothing asserts how many cells the FAO pipeline should process; a wrong/stale region delivers partial coverage to FAO with no signal.
_validatechecks only metadata nulls.Build shape (per the epic design contract)
delivery/coverage.py(representation-free):assert_complete_coverage(received_gids: set[int], expected_count: int) -> None(raise on mismatch); region→expected-count constant alongside (delivery/constants). No pandas.unfao/extraction.py:cells_of(df) -> set[int]— the only pandas line.assert_complete_coverage(cells_of(df), EXPECTED[region])via the S0 hook; logs fetched/enriched/unmapped counts.Two checks: (a) internal consistency — received gids survive to delivery (expected = the gids that arrived); (b) region intent — count matches the intended region (expected = declared constant; to be sourced from datafactory region metadata when it publishes it — same companion shape as S2's
last_valid_month_id).Acceptance criteria
delivery/coverage.pyis a pure, pandas-free function with the region constant; unit-tested on plain sets/ints.Files
views_postprocessing/delivery/coverage.py(new),views_postprocessing/unfao/extraction.py(extend),unfao/managers/unfao.py(call),tests/.