Skip to content

Delete the dead geopandas runtime mapper (C-39) - #42

Merged
Polichinel merged 5 commits into
developmentfrom
chore/remove-dead-geopandas-mapper
Jun 24, 2026
Merged

Polichinel merged 5 commits into
developmentfrom
chore/remove-dead-geopandas-mapper

Conversation

@Polichinel

Copy link
Copy Markdown
Collaborator

Delete the dead geopandas runtime mapper (C-39)

ADR-011 replaced the runtime PriogridCountryMapper with the precomputed GAUL lookup (GaulLookupEnricher). The expert-code-review verified the mapper is orphaned in production — the live manager unfao/managers/unfao.py never references it, nothing re-exports it. This deletes the whole dead cluster (CCP: it exists only to support the mapper).

What's removed (46 files, ~5.1k deletions)

  • views_postprocessing/unfao/mapping/ — the 3,171-line geopandas/shapely module
  • views_postprocessing/shapefiles/ — the 1.3 GB bundle (GAUL L1/L2, Natural Earth, PRIO-GRID)
  • mapper tests (test_mapping, test_regression, test_integration) + conftest.py (the gpd.read_file intercept + mapper fixtures)
  • the two ADR-011 diff scripts (diff_enrichment.py, plot_enrichment_diff.py)
  • docs/CICs/PriogridCountryMapper.md
  • cachetools from pyproject.toml (mapper-only)

Why it matters

  • geopandas + shapely are now gone from the codebase (zero references) — they survived solely to feed this cluster.
  • Dissolves the old-mapper risk cluster — C-02/05/06/11/12/14/16/17/19/20/21, D-01/D-02 describe code that no longer exists. C-39 marked resolved in the register.
  • The package now screams its real responsibility: lookup-based enrichment, not runtime geometry.

Safety

  • Pure deletion — no production logic touched. The manager, enricher, schema, frames adapters, and all of reconciliation/ are untouched and clean of the mapper.
  • Deletion broke nothing: 101 passed, 43 xfailed, 0 failed, ruff clean. The keep-tests run with no conftest.

Second commit (unrelated, included for a green suite)

Re-xfails test_datafactory_deploy_readiness::test_version_bumped_past_latest_tag — it flipped red because datafactory tagged v1.4.0 (the over-strict cross-repo probe), nothing to do with the mapper.

🤖 Generated with Claude Code

Polichinel and others added 5 commits June 24, 2026 04:39
ADR-011 replaced the runtime PriogridCountryMapper with the GAUL lookup
(GaulLookupEnricher); the mapper was verified orphaned in production (the live
manager never references it). This removes the whole dead cluster (CCP): the
3,171-line geopandas module, the 1.3 GB shapefile bundle, the mapper tests +
conftest, the two ADR-011 diff scripts, and the mapper CIC -- 46 files, ~5.1k
deletions. geopandas + shapely are now gone from the codebase; cachetools
dropped from pyproject (mapper-only). Dissolves the old-mapper concern cluster
(C-02/05/06/11/12/14/16/17/19/20/21, D-01/D-02); C-39 marked resolved. Deletion
broke nothing -- keep-tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…v1.4.0)

datafactory cut + tagged v1.4.0, so pyproject version == latest tag and this
over-strict cross-repo deploy probe flips red. Re-mark it xfail(strict): the gate
flaps with datafactory's release cadence and re-promotes (fails) when datafactory
bumps past the tag. Unrelated to the mapper deletion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…9 follow-up)

Register-curation pass after the mapper deletion (C-39). Move the 11 now-dead
mapper concerns (C-02, C-04, C-05, C-06, C-11, C-12, C-14, C-16, C-17, C-20,
C-21) and 2 disagreements (D-01, D-02) from Open to Resolved — the code they
describe no longer exists. C-19 narrowed (the mapper raises are gone; 3 unfao.py
raises remain, issue #13); C-08 kept open (its datafactory area-math dimension
stays under C-31). Counts: open 36 -> 25, resolved 4 -> 15. Bookkeeping only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…eletion

The two doc-accuracy leftovers from the C-39 curation:

- Causal Clusters: replace the stale "Defer until ADR-011 is executed"
  contingency notes on Clusters A/C/D with resolved stamps (ADR-011 is
  executed, mapper deleted in PR #42); mark Cluster E executed and Cluster F
  partially resolved (the PriogridCountryMapper CIC is gone, the manager CIC
  stays).
- C-03: narrow to the manager validation + enrich->validate path. Drop the
  deleted tests/test_mapping.py from Location and the gone mapper find_*
  methods from the trigger; the two live manager-side gaps remain.

Bookkeeping only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-diff catch

review-diff on the curation found the Cluster C resolved-stamp falsely claimed
C-10 "was already resolved". C-10 (manager↔mapper coupling via the module-level
_DEFAULT_MAPPER global) is itself a dead Cluster C concern: mapping.py:3088-3122
and the unfao.py get_default_mapper() call are both deleted (C-39, PR #42). Move
C-10 to Resolved and correct the note to "C-02 and C-10 are both resolved".
Counts: open 25 -> 24, resolved 15 -> 16. Bookkeeping only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Polichinel
Polichinel merged commit 26e476a into development Jun 24, 2026
4 checks passed
@Polichinel
Polichinel deleted the chore/remove-dead-geopandas-mapper branch June 24, 2026 03:15
Polichinel added a commit that referenced this pull request Jun 26, 2026
…valence proof (Tier 2)

The ADR-011 enrichment swap (runtime mapper -> GAUL lookup enricher) went
live without the output-equivalence proof its own plan required (umbrella
#20: Stage 0 baseline + Stage 2 diff, "zero unexplained differences"). That
proof was never produced, and the old mapper + both diff scripts were since
deleted (eba1df8, PR #42), so it is now unrecoverable. Accepting option A
(a smoke-test delivery) verifies the path runs, not that it produces the
same/correct values; _validate only checks the 9 columns are non-null, not
correct, so a lookup/merge bug ships wrong-but-non-null geo metadata to FAO
silently. Tier 2 (not 1: the lookup sources from datafactory's authoritative
GAUL parquets, D-07); trigger is the go-global flip to land_gaul (64k cells).

Header 42/22/20 -> 43/23/20. Cross-refs C-03, C-22, C-23, C-30/32/34, C-39, D-08.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Polichinel added a commit that referenced this pull request Jul 31, 2026
… build (#141)

ADR-011 swapped runtime geopandas mapping for a precomputed lookup, and the
plan's required old-vs-new value diff (#20 Stage 2 / #23) was signed off without
being produced. The comparator was then deleted in PR #42, so the backward check
is unrecoverable — and run-0 shipped 64,742 cells to FAO on 2026-07-27 with no
gate anywhere asserting that a *present* GAUL value was the *right* one.

The check that remains available runs forwards, against the producer. Run this
session, zero mismatches on all four links:

  gid->lat/lon formula  vs PRIO-GRID priogrid_cell.dbf, all 259,200 cells
                        -> max abs error 0.00e+00
  lookup values         vs the 7 datafactory gaul_admin parquets
                        -> 0 mismatches / 64,742 cells
  lookup gid set        vs land_gaul_pgids.json  -> exactly equal, all unique
  delivered run-0       sidecar bytes vs the lookup -> 0 mismatches,
                        sha256 matches the manifest

The leading hypothesis going in — a flipped or off-by-one coordinate formula
putting wrong-but-non-null coordinates on every cell, invisible to every gate —
was falsified. The formula is exact across the entire global grid.

This commit turns that session result into a standing guarantee. 18 tests split
by dependency: always-on checks on the committed artifact (key uniqueness, no
nulls, no -1 sentinels, region count, coordinate formula against a committed
219-cell PRIO-GRID ground-truth sample) and skipif checks against the
views-datafactory sibling (all 7 columns, full 259,200-cell formula sweep).

build_gaul_lookup.py: the three bare `assert`s become explicit LookupBuildError
raises (python -O silently strips asserts, writing an unvalidated artifact that
looks identical), plus a new index-uniqueness guard. Rebuild verified
value-identical to the committed artifact.

Two entries I registered earlier today are corrected here on mutation evidence
rather than left overstated:

- C-59 tier 2 -> 3. A duplicate cannot reach the artifact on the production
  path: Index.intersection de-duplicates first. The guard is reachable only via
  --region all. Kept anyway — that de-duplication is accidental pandas behaviour,
  not a declared guard, and silently absorbing upstream duplication hides a
  producer defect.
- C-61 exposure corrected. The primary protection against -1 is the completeness
  filter, which is plain code and survives -O; the strippable-assert argument
  never applied to the -1 case. The real defect was stating invariants in a form
  the interpreter can delete.

C-43 scope stated explicitly and deliberately: this proves transcription
fidelity, not assignment correctness. If views-datafactory's area-majority join
puts a cell in the wrong country, every test here still passes. That is filed as
views-datafactory#387 — it had been resolved here on 2026-06-24 as "tracked
there" and was never actually opened there, leaving it untracked platform-wide
for five weeks.

Register: 61 concerns, 24 open. Cluster K added. ruff clean; 296 passed
(5 known local pyarrow byte-parity failures, CI authoritative).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant