Stage 3 — Swap _append_metadata to the lookup enricher
Part of the FAO global delivery plan — umbrella: #20. Hard-gated on Stage 2 (#23): zero unexplained differences. This is the ONLY behavioral code change in the entire delivery plan.
Why this exists
After Stages 0–2, the lookup enricher is built, tested, and characterized against real production output. This stage makes it live: _append_metadata() (views_postprocessing/unfao/managers/unfao.py:140-163) stops calling the runtime mapper and calls the enricher. Everything upstream (_read) and downstream (_validate, _save) is untouched — the validation gate (unfao.py:188-221) keeps guarding exactly as before, and because the enricher surfaces unknown gids as nulls (pinned by a Stage-1 test), the fail-loud guarantee survives the swap.
Spec
- The swap —
_append_metadata uses the Stage-1 enricher. The mapper import (get_default_mapper, unfao.py:19,41) goes away from the manager; with it goes the import-time loading of 774 MB of shapefiles (register C-02's trigger in this code path).
mapping.py stays in the repo, inert. Not deleted, not selectable by config — one live truth (umbrella: deletion is a separate decision after one verified production cycle).
- Delete the dead commented-out config blocks
unfao.py:80-107 (two alternative AppwriteConfig blocks). This is D-09's only "do now" exception: they are a mis-uncomment hazard during exactly this kind of high-stakes week, and removing comments is zero-risk.
- Re-run africa_me_legacy on the production machine — same procedure as Stage 0.
Verification (definition of done)
Revert path
This change must land as one commit touching only unfao.py (method body + dead-block deletion) so that git revert <sha> restores the mapper path instantly. If anything looks wrong in the verification run, revert first, diagnose second.
Explicitly NOT in this issue
- No region change (that is Stage 4, views-models)
- No deletion of
mapping.py, shapefiles, or geopandas from dependencies (post-cycle decision)
- No store/Appwrite changes, no multi-store
DeliveryProfile (register C-33, deferred per D-09)
- No fixes to the pipeline-core read path (C-26..C-29, deferred)
Stage 3 — Swap
_append_metadatato the lookup enricherPart of the FAO global delivery plan — umbrella: #20. Hard-gated on Stage 2 (#23): zero unexplained differences. This is the ONLY behavioral code change in the entire delivery plan.
Why this exists
After Stages 0–2, the lookup enricher is built, tested, and characterized against real production output. This stage makes it live:
_append_metadata()(views_postprocessing/unfao/managers/unfao.py:140-163) stops calling the runtime mapper and calls the enricher. Everything upstream (_read) and downstream (_validate,_save) is untouched — the validation gate (unfao.py:188-221) keeps guarding exactly as before, and because the enricher surfaces unknown gids as nulls (pinned by a Stage-1 test), the fail-loud guarantee survives the swap.Spec
_append_metadatauses the Stage-1 enricher. The mapper import (get_default_mapper,unfao.py:19,41) goes away from the manager; with it goes the import-time loading of 774 MB of shapefiles (register C-02's trigger in this code path).mapping.pystays in the repo, inert. Not deleted, not selectable by config — one live truth (umbrella: deletion is a separate decision after one verified production cycle).unfao.py:80-107(two alternative AppwriteConfig blocks). This is D-09's only "do now" exception: they are a mis-uncomment hazard during exactly this kind of high-stakes week, and removing comments is zero-risk.Verification (definition of done)
tests/test_integration.pynow exercise the enricher path)baseline_schema.md— byte-for-byte on the schema, values differing only per the Stage-2 explained classesRevert path
This change must land as one commit touching only
unfao.py(method body + dead-block deletion) so thatgit revert <sha>restores the mapper path instantly. If anything looks wrong in the verification run, revert first, diagnose second.Explicitly NOT in this issue
mapping.py, shapefiles, or geopandas from dependencies (post-cycle decision)DeliveryProfile(register C-33, deferred per D-09)