Skip to content

fix(country-map): keep master's hand fixes in the generator notebook - #46542

Open
rusackas wants to merge 1 commit into
masterfrom
fix/country-map-notebook-keep-master-fixes
Open

rusackas wants to merge 1 commit into
masterfrom
fix/country-map-notebook-keep-master-fixes

Conversation

@rusackas

Copy link
Copy Markdown
Member

SUMMARY

The weekly country-map regeneration (#46240) fails four frontend test shards because it reverts fixes that were made by hand to generated files on master, without a matching change to the generator notebook. This moves each of those fixes into Country Map GeoJSON Generator.ipynb, so the next npm run update-maps run keeps them.

Fixes ported (notebook cell sources only, no output changes):

Everything else #46240 changes is upstream drift, not master-only fixes: small vertex changes in Iran (Natural Earth) and Madagascar (the live WHO query), last-digit float noise in South Africa, and Russia being pretty-printed instead of master's minified copy. There's also a 1e-9° Chukchi offset, which the notebook already adds on purpose (#44273) and the committed file just never picked up.

#45607 (moving the notebook to per-country build scripts) already carries all four fixes in its maps/countries/{iran,uk,russia}.py and maps/ts_writer.py. One small difference: its Russia script simplifies with preserve_topology=False, which gives slightly different Karelia/Murmansk geometry from master's file (186/179 vertices vs 191/190). That's still well within the test's bounds. This PR is the stopgap for the notebook until #45607 lands.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A, generator-only change. The committed GeoJSON/TS/JSON files are not touched.

TESTING INSTRUCTIONS

I ran the notebook end to end the same way update-country-maps.yml does (pinned deps from requirements-constraints.txt, speed_run forced on, nbconvert --execute). It finished with no cell errors. Then:

  1. The regenerated uk.geojson, countries.ts and docs/data/countries.json are byte-identical to master.
  2. In iran.geojson, every province's ISO/name matches master (Alborz is IR-32).
  3. In russia.geojson, all 85 features match master except the 1e-9 Chukchi offset noted above, and the file is 749,169 bytes.
  4. With the regenerated files in place, JEST_MAX_WORKERS=2 npm run test -- plugins/plugin-chart-country-map passes 11/11 suites (92 tests), including iran.geojson, russia.geojson, normalizeRegions and countries.

To reproduce, run npm run update-maps from superset-frontend and check that the country-map tests still pass.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

Several fixes on master were applied directly to generated files, so the
weekly `npm run update-maps` regeneration (#46240) reverted them and broke
the country-map tests. Move each one into the notebook:

- Iran: Alborz gets IR-32 (#42429) instead of IR-30.
- UK: GB-WRL is named "Wirral", not Natural Earth's duplicate "Halton".
- Russia: simplify the 1:10m Karelia/Murmansk rows at 0.03 (#44273) so
  russia.geojson stays under its size budget.
- countries.ts / docs countries.json: label
  italy_regions_and_autonomous_provinces as
  "Italy (regions and autonomous provinces)" (#42309).

Co-Authored-By: Evan Rusackas <evan@preset.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: cd79b75c1e28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the generator-notebook update intended to preserve existing country-map corrections during regeneration.

No open issues 🎉

What changed in this PR

Updates the country-map generator notebook to preserve existing fixes during regeneration, preventing generated files from reverting corrections already committed to Superset.

Changes:

  • Preserves Alborz’s IR-32 code and corrects Wirral’s region name.
  • Simplifies Karelia and Murmansk boundaries to keep Russia’s generated map within its size budget.
  • Preserves the “Italy (regions and autonomous provinces)” label in generated frontend and documentation catalogs.
File Description
superset-frontend/​plugins/​plugin-chart-country-map/​scripts/​Country Map GeoJSON Generator.ipynb Updates generator logic and explanatory notes for all four fixes; leaves notebook outputs and generated files unchanged.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants