Repository navigation
Description
Epic: #148 · Depends on S1 · Closes C-65
Background
ADR-012 designates unfao/extraction.py as "the single pandas-aware module" — the one place a representation change lands. The representation change already landed beside it: unfao/frame_extraction.py implements the same operations frame-natively and is what production calls.
After S1, extraction.py (103 lines) retains one reachable function:
| Function | Reachable after S1? | Frame equivalent |
|---|---|---|
file_metadata |
yes — managers/unfao.py:48 (_ContractStorePort) |
— |
months_of |
no | frame_extraction.months_of |
drop_months_above |
no | frame_extraction.drop_months_above |
cells_of |
no | frame_extraction.cells_of |
unmapped_cell_count |
no | historical.unmapped_cell_count |
Two seams for one concept is the CRP violation D-11 predicted: WET-before-DRY was correct during the migration and expires when the migration completes. It has.
Work
file_metadata is not extraction at all — it normalises a store document's metadata dict. It belongs with its one caller, not in a module named for a representation it no longer touches.
- Move
file_metadata(and only it) to sit beside_ContractStorePort, or into a small store-facing module if that reads better once S1 has shrunk the manager - Delete
unfao/extraction.py - Retarget
tests/test_extraction.py(96 lines) at the surviving function — do not delete the file; thefile_metadataassertions are still worth having - Remove
extractionfrom the manager's import line (:21)
Acceptance criteria
- Exactly one extraction module remains, and it is frame-native
-
grep -rn "unfao.extraction\|from views_postprocessing.unfao import.*extraction" views_postprocessing/returns nothing -
file_metadata's tests still run and still assert the same behaviour - pandas no longer imported by any surviving module in
unfao/exceptenrichment.py(S4's subject)
Testing / validation
ruff check . · full suite green · test_hop_b_sink_e2e.py green — file_metadata is on the contract read path, so its move must be provably behaviour-neutral.
Activity
refactor(unfao): S3 — one representation seam; store metadata gets it…
Polichinel commentedon Jul 31, 2026
Done in PR #161 (merged to
development).extraction.pydeleted;file_metadatamoved tounfao/store_metadata.py(sibling ofsource_metadata.py— producer facts / store facts). Tests followed the code: parity assertions intest_frame_extraction.pybecame absolute ones (same expected values, no deleted module to route through), andtest_input_integrity_e2e.pynow feeds the invariants primitives, which is how the delivery calls them. Register C-65 closed. The design-contract file's "no premature Extractor Protocol" note is marked vindicated — WET-before-DRY paid out.refactor(structure): S5 — separate partner declarations from delivery…
docs(adr): S6 — the ontology describes the code, and the claims are n…
fix(release): address code-review findings on the main merge (#169)
coverage: an undeclared region is a refusal, not a skipped gate (C-11…