You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Epic:#51 · S1 · depends on #61 (S0) · storyimplementation
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
delivery/coverage.py is a pure, pandas-free function with the region constant; unit-tested on plain sets/ints.
Manager logs cell counts and raises on expected≠actual (under- and over-coverage).
Tests: correct count passes; under- and over-coverage each raise.
Build shape (per the epic's post-/falsify design contract, 2026-06-26)
Do not add coverage logic to the pandas _validate god-method. Build it as:
views_postprocessing/delivery/coverage.py (representation-free): a pure function, e.g. assert_complete_coverage(received_gids: set[int], expected_count: int) -> None (raise on mismatch), and the region→expected-count constant lives alongside (delivery/ constants). No pandas import here.
views_postprocessing/unfao/extraction.py: cells_of(df) -> set[int] — the only pandas-aware line for this guard.
Manager: assert_complete_coverage(cells_of(self._df), EXPECTED[region]) — extract → call → raise. The guard is called, not a method.
Two checks (from the earlier deep-dive): (a) internal consistency — received gids survive to delivery (expected = the gids that arrived); (b) region intent — count matches the intended region (expected = declared constant, sourced from datafactory's region metadata when it publishes it — same companion as #52's last_valid_month_id).
Tests live against delivery/coverage.py on plain sets/ints (no framework). The design-contract stubs in tests/test_input_integrity_design_contract.py already enforce the placement + pandas-free rules.
Delivered and merged to development via #64 (input-integrity sprint S0–S6). ruff clean, 126 passed / 44 xfailed. Closing — the auto-close keyword did not fire because #64 merged into development, not the default branch. Live-run validation of the residual contracts (C-25 identity name/loa, C-43 enrichment equivalence) is tracked in the risk register and exercised by the go-global run (views-models#127).
Activity
Polichinel commentedon Jun 26, 2026
Build shape (per the epic's post-
/falsifydesign contract, 2026-06-26)Do not add coverage logic to the pandas
_validategod-method. Build it as:views_postprocessing/delivery/coverage.py(representation-free): a pure function, e.g.assert_complete_coverage(received_gids: set[int], expected_count: int) -> None(raise on mismatch), and the region→expected-count constant lives alongside (delivery/constants). No pandas import here.views_postprocessing/unfao/extraction.py:cells_of(df) -> set[int]— the only pandas-aware line for this guard.assert_complete_coverage(cells_of(self._df), EXPECTED[region])— extract → call → raise. The guard is called, not a method.Two checks (from the earlier deep-dive): (a) internal consistency — received gids survive to delivery (expected = the gids that arrived); (b) region intent — count matches the intended region (expected = declared constant, sourced from datafactory's region metadata when it publishes it — same companion as #52's
last_valid_month_id).Tests live against
delivery/coverage.pyon plain sets/ints (no framework). The design-contract stubs intests/test_input_integrity_design_contract.pyalready enforce the placement + pandas-free rules.[-]S2 — Coverage contract: assert expected cell count + log cell counts (C-34)[/-][+]S1 — Coverage contract: complete-coverage invariant + cell-count logging (C-34)[/+]Polichinel commentedon Jun 26, 2026
Delivered and merged to
developmentvia #64 (input-integrity sprint S0–S6). ruff clean, 126 passed / 44 xfailed. Closing — the auto-close keyword did not fire because #64 merged intodevelopment, not the default branch. Live-run validation of the residual contracts (C-25 identity name/loa, C-43 enrichment equivalence) is tracked in the risk register and exercised by the go-global run (views-models#127).fix(tests): iteration 2 — a scan blind in its own house style, and on…