Norway gets into the country table at all

NOR was absent from iso3-to-iso2, so Norway appeared in no research table:
consumers filter on ISO3_2[iso3], which makes a missing code a silent
omission rather than an error. Its absence is also why SJM -> NO read as
injective -- "NO" had exactly one claimant, the wrong one.

NOR -> NO, from ISO 3166-1, which is what CLDR's codeMappings encodes. The
full CLDR vendor still comes with the 242-country table and will re-derive
this alongside the other 66 missing codes; this is the one line
exp-shepherd needs first to re-key the mislabelled Svalbard rows onto
Norway.

NOR joins the named spot-check, and the completeness floor rises 175 -> 176
with it. Left at 175 that check would have called a regression back to the
pre-NOR map clean, which is the opposite of what it is for. Removing NOR
now fires both guards; injectivity still reports "all 175 codes map to a
DISTINCT ISO2" while it does, for the third time in this defect.
This commit is contained in:
Doxa Maps 2026-09-27 03:22:04 +00:00
parent 1eae1d8c10
commit 8f79a3af0f
2 changed files with 10 additions and 2 deletions

View file

@ -118,6 +118,7 @@
"NFK": "NF",
"NGA": "NG",
"NIU": "NU",
"NOR": "NO",
"NPL": "NP",
"NZL": "NZ",
"OMN": "OM",

View file

@ -67,7 +67,12 @@ else ok('every value is a well-formed 2-letter uppercase code');
// SEE IT -- the check passes as long as no two codes share an ISO2, and NOR is absent from this map
// entirely, so "NO" had exactly one claimant and looked clean. A uniqueness test cannot tell a right
// code from a wrong one that nobody else wanted; only a named expectation can.
const MUST = { NER: 'NE', NGA: 'NG', PSE: 'PS', ISR: 'IL', HKG: 'HK', MAC: 'MO', ABW: 'AW', SJM: 'SJ' };
// NOR belongs here as the OTHER HALF of the SJM defect. Norway was absent from this map entirely,
// which is why SJM -> NO looked injective and why Norway appeared in no downstream table at all --
// consumers filter on `ISO3_2[iso3]`, so a missing code is not an error, it is a silent omission.
// Added from ISO 3166-1 (NO/NOR), which is what CLDR's codeMappings encodes; the full CLDR vendor
// still comes with BUILD-ISO3-TABLE-COVERS-ALL-242-COUNTRIES and will re-derive this alongside 66 others.
const MUST = { NER: 'NE', NGA: 'NG', PSE: 'PS', ISR: 'IL', HKG: 'HK', MAC: 'MO', ABW: 'AW', SJM: 'SJ', NOR: 'NO' };
// ABSENT MUST FAIL, NOT PASS. The first version read `map[k] && map[k] !== v`, so a
// code MISSING ENTIRELY was falsey and slipped through — deleting NER outright passed
// all three checks and this line still printed "NER … all correct" about a code that
@ -82,7 +87,9 @@ if (!missing.length && !wrong.length) ok('previously-wrong codes (NER, PSE, HKG,
// The map must also stay COMPLETE. A silent shrink (175 -> 174) means a country
// stopped being fetched at all, which no per-code check can see.
const EXPECTED_MIN = 175;
// 175 -> 176 with NOR. The floor RISES when a code is added, or the check stops being able to see the
// shrink it exists for: left at 175 it would have called a regression back to the pre-NOR map clean.
const EXPECTED_MIN = 176;
if (Object.keys(map).length < EXPECTED_MIN) {
fail(`map has ${Object.keys(map).length} codes, expected at least ${EXPECTED_MIN} — a country has DISAPPEARED`);
} else ok(`${Object.keys(map).length} codes present (>= ${EXPECTED_MIN})`);