seriesFor: state that every no-sheet country shares one series, and gate it

A second country without a sheet size would silently join India's oversized
series and print India as "map 1 of 2". The comment now says so, and
check:country-sheet-one-path fails when more than one country has no sheet,
naming them, so that change is a decision rather than drift. Its self-test
plants a second one (China) and requires the arm to fail.
This commit is contained in:
Doxa Maps 2026-09-30 21:23:59 +00:00
parent ffbb07e4a4
commit b0d0fcaf91
2 changed files with 5 additions and 0 deletions

View file

@ -60,6 +60,8 @@
* A null sheet is a tier too: India (sheet null, too many groups for any paper size) is its own
* 1-of-1 series. Skipping it printed "map 1 of 0" on India's packet page 1 from the Regions tab
* while the wall's own copy printed "map 1 of 1" -- the two paths disagreeing again.
* Every null-sheet country shares that ONE oversized series: a second would make India "map 1 of 2".
* check:country-sheet-one-path fails when that happens, so it is decided, not drifted into.
*/
export function seriesFor(countries, item) {
if (!item || !Array.isArray(countries)) return undefined

View file

@ -93,6 +93,8 @@ export function armB(seriesFor, countries) {
const by = (iso) => countries.find((c) => c.iso3 === iso)
const ind = by('IND')
const s = ind && seriesFor(countries, ind)
const oversized = countries.filter((c) => (c.sheet ?? null) === null)
if (oversized.length > 1) fails.push(`${oversized.length} countries have no sheet size (${oversized.map((c) => c.iso3).join(', ')}): they now share ONE oversized series, so India prints "map 1 of ${oversized.length}". Decide that deliberately, then update this expectation.`)
if (!ind) fails.push('India is missing from country-posters.json')
else if (!s || s.index !== 1 || s.totalLists !== 1 || s.totalGroups !== ind.count) fails.push(`India (sheet ${JSON.stringify(ind.sheet)}) should be map 1 of 1 with ${ind.count} groups; got ${JSON.stringify(s)}`)
const t3 = countries.filter((c) => c.sheet === '3x3')
@ -126,6 +128,7 @@ async function main() {
['makeCountrySheet without countries', () => armA({ ...files, [wall]: files[wall].replace(/countries: data\.countries \|\| \[\],/, '') })],
['India skipped (the old guard)', () => armB((l, it) => (!it || !it.sheet ? undefined : seriesFor(l, it)), countries)],
['absent code given a position', () => armB((l, it) => seriesFor(l, it) || { index: 1, totalLists: 1, totalGroups: 0 }, countries)],
['a second no-sheet country joins India', () => armB(seriesFor, countries.map((c) => (c.iso3 === 'CHN' ? { ...c, sheet: null } : c)))],
]
let bad = 0
for (const [name, run] of cases) {