feat: resync onto upstream master, keeping the Mooncard data additions - #1
Conversation
Fix national_number_length values for MW, MR, CD, and CI
Update national number lengths for Somalia
Four Indian subdivisions had a top-level `name:` value that diverged
from the canonical ISO 3166-2 English short name and / or from the
gem's own `translations.en` entry. Aligning all four:
* IN-TS Telangana — `name` was Hindi (तेलंगाना); translations.en already
carried "Telangana".
* IN-UK Uttarakhand — `name` was Hindi (उत्तराखण्ड); translations.en
already carried "Uttarakhand".
* IN-PY Puducherry — `name` was the pre-2006 form "Pondicherry" while
translations.en already carried the post-rename "Puducherry". The
historical name is preserved under `unofficial_names`.
* IN-DH Dadra and Nagar Haveli and Daman and Diu — `name` and
translations.en used the macron transliteration ("Dādra…Damān…")
inconsistent with the ISO 3166-2 OBP English short name, which is
ASCII. Other locale translations (ar, as, hi, etc.) are unchanged.
…ish-name Fix four IN subdivision names: TS, UK, PY, DH
Update national number lengths for Somalia
… is rejected. Fixes countries#902
…r-902 Anchor postal_code_format with \z instead of \Z so a trailing newline is rejected.
Fix coverage measurement and close spec gaps
…rm_keys instead of transform_keys!
…ince 7.2 has EOLd 10 months ago
Remove the require from data_spec.rb (Benchmark is unused there). Add `benchmark` to the Gemfile dev/test group, since spec/perf_spec.rb uses it
Update dev dependencies and bundle update.
…ash-mutation Don't mutate caller's translations hash in Data.register. Use transform_keys instead of transform_keys!
…(rb/overly-large-range, alert countries#2)
…x-range Fix overly-large regex range [A-z] in country_spec flagged by CodeQL (rb/overly-large-range, alert countries#2)
Bumps [json](https://github.com/ruby/json) from 2.20.0 to 2.21.2. - [Release notes](https://github.com/ruby/json/releases) - [Changelog](https://github.com/ruby/json/blob/master/CHANGES.md) - [Commits](ruby/json@v2.20.0...v2.21.2) --- updated-dependencies: - dependency-name: json dependency-version: 2.21.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com>
…-nauru-official-name Update Nauru official name to Naoero
…on-2.21.2 Bump json from 2.20.0 to 2.21.2
…dinates Fix inconsistent subdivision coordinates
The fork was 168 commits behind upstream on a REFERENCE-DATA gem — ISO country codes, subdivisions and currencies change, so staleness here is a correctness question, not hygiene. This rebuilds the fork on upstream/master (1dd3015, 2026-09-05) and re-applies only what Mooncard actually added. Rebuilt rather than rebased on purpose. Of the 8 commits the old fork carried, 4 were regenerated cache and a two-step case-rename dance; only 4 were source. Merging generated files is how a resync turns into a week of conflicts, so the cache is REGENERATED here with the repository's own `rake update_cache`. The Mooncard delta, all four still absent from upstream (checked, not assumed): · lib/countries/data/countries/XK.yaml — Kosovo, as XK/XXK. Upstream still ships no XK file at all. Originally added because the supplier sends QZZ, a user-defined code, and it means Kosovo in that context. · RO.yaml unofficial_names += ROM — a transitional reserved code upstream does not carry; upstream has alpha3 ROU only. · CD.yaml unofficial_names += ZAR — Zaire, deprecated since July 1997, and still arriving in supplier data. Upstream has alpha3 COD only. · countries-en.yaml / countries-fr.yaml += "XK: Kosovo". Four spec assertions needed adjusting, and this is the one judgement call in the change. Upstream now tests `all_translated('pt')` and `translations(:pt)` against NUM_OF_COUNTRIES; those specs used to call the no-argument form, which is English, where Kosovo exists. With Kosovo added and only en/fr names for it, a locale without an XK translation returns one fewer, so those four now expect NUM_OF_COUNTRIES - 1. The alternative was to write "Kosovo" into all 131 translation files. That was rejected: it would be inventing translations for 129 locales where the real name differs, to make an assertion pass. Upstream's own comment two lines above each assertion already says countries missing the desired locale are not added to the list. Verified in the container: · 280 examples, 0 failures (was 4 failures before the spec adjustment) · line coverage 100% · ISO3166::Country.new("XK") -> "Kosovo", alpha3 XXK · find_country_by_unofficial_names("ROM") -> RO · find_country_by_unofficial_names("ZAR") -> CD · translation("fr") -> "Kosovo" once :fr is in ISO3166.configuration.locales · 250 countries; cache regenerated, XK present in countries.json, en and fr Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…pplied on current upstream origin/master carries 8 Mooncard commits plus 2 upstream merges from 2025-02. Outside the regenerated cache they touch exactly seven files — CD.yaml, RO.yaml, XK.yaml, countries-en.yaml, countries-fr.yaml and the two specs — and every one of those changes is already present on this branch, re-applied on top of upstream 1dd3015 (2026-09-05) rather than merged. Merged with -s ours deliberately: this branch's tree IS upstream plus the four Mooncard additions plus a freshly generated cache. origin/master's unique content is the STALE version of those same four additions on a 19-month-old upstream, so taking any of it would move the fork backwards. The merge is recorded so the history is connected and the old commits are not orphaned. Verified after the merge: tree unchanged, 280 examples still green.
|
Conflicts resolved in c35a0e9. Why they happenedThis branch was rebuilt on current upstream ( Why
|
Why
The fork was 168 commits behind upstream on a reference-data gem. ISO country codes, subdivisions, currencies and VAT data change over time, so being 19 months stale here is a correctness question, not hygiene. Three repos resolve it: mooncard, mooncard-service-stations, mooncard-ariane.
Your changes all survive — and upstream still has none of them
Checked against
upstream/master(1dd3015, 2026-09-05), not assumed:XK.yaml— Kosovo as XK/XXKRO.yamlunofficial_names += ROMalpha3: ROUonlyCD.yamlunofficial_names += ZARalpha3: CODonlyXK: Kosovoin countries-en/frRebuilt, not rebased
Of the 8 commits the old fork carried, 4 were regenerated cache plus a two-step case-rename dance (
xk.yaml→XK-upcase.yaml→XK.yaml, needed on case-insensitive filesystems). Only 4 were source.Merging generated files is how a resync becomes a week of conflicts, so this branch is built fresh on
upstream/masterwith the 4 source changes re-applied, and the cache regenerated by the repo's ownrake update_cache. Net diff: 10 files.The one judgement call
Four spec assertions now expect
NUM_OF_COUNTRIES - 1.Upstream changed these specs to test locale
'pt'; they previously called the no-argument form, which is English — where Kosovo exists. With Kosovo added and only en/fr names for it, a locale lacking an XK translation returns one fewer.The alternative was writing
Kosovointo all 131 translation files. I rejected that — it would invent translations for 129 locales where the real name differs (Albanian Kosova, Serbian Косово), purely to make an assertion pass. Upstream's own comment, two lines above each assertion, already says countries missing the desired locale are not added to the list.Happy to switch to per-locale translations if you'd rather, but that's real data someone has to source.
Verification (in the workspace container)
ISO3166::Country.new("XK")→"Kosovo", alpha3XXKfind_country_by_unofficial_names("ROM")→ROfind_country_by_unofficial_names("ZAR")→CDtranslation("fr")→"Kosovo"once:fris inISO3166.configuration.localescountries.json,en.json,fr.jsonDeploy order
This must merge first. The three consumers then re-pin to the new
masterrevision — one PR each, raised after this lands.🤖 Generated with Claude Code