Skip to content

feat: resync onto upstream master, keeping the Mooncard data additions - #1

Merged
DamienMetzger merged 170 commits into
masterfrom
damien/resync-upstream-keep-kosovo
Sep 13, 2026
Merged

DamienMetzger merged 170 commits into
masterfrom
damien/resync-upstream-keep-kosovo

Conversation

@DamienMetzger

Copy link
Copy Markdown

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:

Mooncard addition Upstream today
XK.yaml — Kosovo as XK/XXK no XK file at all
RO.yaml unofficial_names += ROM has alpha3: ROU only
CD.yaml unofficial_names += ZAR has alpha3: COD only
XK: Kosovo in countries-en/fr absent

Rebuilt, 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/master with the 4 source changes re-applied, and the cache regenerated by the repo's own rake 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 Kosovo into 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)

  • ✅ 280 examples, 0 failures — 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 in countries.json, en.json, fr.json

Deploy order

This must merge first. The three consumers then re-pin to the new master revision — one PR each, raised after this lands.

🤖 Generated with Claude Code

younn-o added 30 commits July 18, 2024 10:12
pmor and others added 28 commits May 18, 2026 08:39
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
…r-902

Anchor postal_code_format with \z instead of \Z so a trailing newline is rejected.
Fix coverage measurement and close spec gaps
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!
…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.
@DamienMetzger

Copy link
Copy Markdown
Author

Conflicts resolved in c35a0e9.

Why they happened

This branch was rebuilt on current upstream (1dd3015, 2026-09-05) rather than rebased, so it shared no recent history with the fork's master. Both sides then touched the same seven files — and that is exactly the conflict you'd expect.

Why -s ours is the right resolution here, not a shortcut

I checked what origin/master actually had that this branch lacked before deciding. It is 10 commits: the 8 original Mooncard commits plus 2 upstream merges from 2025-02. Outside the regenerated cache they touch precisely seven files:

lib/countries/data/countries/CD.yaml
lib/countries/data/countries/RO.yaml
lib/countries/data/countries/XK.yaml
lib/countries/data/translations/countries-en.yaml
lib/countries/data/translations/countries-fr.yaml
spec/country_spec.rb
spec/data_spec.rb

Every one of those changes is already on this branch, re-applied on top of a 19-months-newer upstream. So origin/master's only unique content is the stale version of the same four additions — taking any of it would move the fork backwards.

The merge is recorded (not discarded) so the history stays connected and the old commits aren't orphaned.

Verified after the merge, not assumed

  • ✅ tree byte-identical to the pre-merge tree — the merge changed nothing
  • ✅ XK.yaml present · RO.yaml has ROM · CD.yaml has ZAR · XK: Kosovo in both translations
  • ✅ 250 country files; XK in the regenerated cache
  • ✅ 280 examples, 0 failures, coverage 100%
  • ✅ mergeable=MERGEABLE, state=CLEAN

@DamienMetzger
DamienMetzger merged commit c92b888 into master Sep 13, 2026
6 checks passed
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.