From Chris's screenshot: Top regions showed CA and 07.
07 says nothing to anyone. CA reads as California only to someone already expecting it — sitting beside a flag it is equally the country code for Canada.
The reason it was a code no longer holds
The panel's own comment explained the trade-off:
Spelling it out would mean shipping a table of every ISO 3166-2 subdivision name — some four thousand of them — to render a panel that is off by default.
That table is already shipped. app/Analytics/subdivisions.json — 194 countries, 3,234 subdivisions — and geo.ts has needed it since region geo started working at all: DB-IP's City Lite carries subdivision names and no codes, so the name is looked up on the way in. Read the other way round it answers this question for nothing.
US-CA → California
PH-07 → Central VisayasThe tie-break, because reversing the map needs one
DB-IP carries aliases, so 384 codes have more than one spelling. The obvious rule picks badly — shortest-wins turns Baden-Württemberg into the unaccented Baden-Wurttemberg.
So: most non-ASCII characters wins, shortest breaks the tie. Prefer the properly accented name, then the plainest form of it.
| code | candidates | picked |
|---|---|---|
DE-BW | Baden-Wurttemberg, Baden-Württemberg | Baden-Württemberg |
DE-BE | Berlin, State of Berlin | Berlin |
AL-03 | Elbasan, Elbasan County | Elbasan |
PH-05 | Bicol, Bicol Region | Bicol |
What is deliberately unchanged
- The stored value.
US-CAis still what the column holds, whataddFilterUrlputs in the query string, and what the filter matches. Only the label changes. - The API.
/api/sites/{id}/regionsstill returns codes — that is a contract someone may be reading. - Cities.
cityLabelappends the subdivision only for US, CA and AU, because "San Diego, CA" is how that address is written and "Consolacion, 07" is not; the flag already carries the country. The bare Consolacion in the screenshot is correct, not a bug. - Unknown codes. A subdivision the table cannot name keeps showing its code.
PH-XXon screen is honest about not knowing; an invented name would not be.
Verification
subdivision-name.test.ts covers the lookup, the tie-break in both directions, and the null cases — and one test guards the data, since subdivisions.json is regenerated from DB-IP and a rebuild that dropped countries would otherwise pass every other assertion.
region-geo.test.ts asserted the old label expression; updated, plus a new assertion that the panel falls back to the code.
1172 unit tests, 0 failures. Lint and typecheck clean. (One pre-existing pg_rewind ENOENT error is unrelated — confirmed present on a clean main.)
Not rendered in a browser: this needs a site with recorded region traffic, so the coverage here is the unit tests on the lookup plus a source assertion on the panel expression.
🤖 Generated with Claude Code