fix(voice): treat a Zone as retired only in Nepal

Every name ending in "Zone" was kept without a level and refused as a retired
administrative identity. That is right for Nepal, which replaced its zones in
2015, but zones are current units elsewhere: Ethiopia's "Gamo Zone" was
refused. The selector now keeps the verified level unless display_name places
the zone in Nepal or names no country, and the client no longer reads "Zone"
as a retired level when the source verified one.
This commit is contained in:
Manjunath committed 2026-11-03 17:27:26 +05:30
1 parent 682427ef1d
commit 451be8e3b7
4 files changed
+73 -2

No files matched your search

+22 -1
View File
@@ -30,12 +30,13 @@ function fakeLadder({
calls = [],
delay = null,
label = 'Bagmati Province',
match = /bagmati/i,
} = {}) {
return {
calls,
async resolveAnnotationTarget(request) {
calls.push(request);
if (!/bagmati/i.test(request.target)) return null;
if (!match.test(request.target)) return null;
return {
lat: 27.7,
lon: 85.3,
@@ -391,6 +392,26 @@ test('a verified province accepts a bare query with a separate level', async ()
assert.equal(retired.areas.store.size, 0);
});
test('a current Zone the source verified is not refused as retired', async () => {
const gamo = makeAreas({
annotationResolver: fakeLadder({
label: 'Gamo Zone',
match: /gamo/i,
outline: {
ring: BAGMATI_POLYGONS[0][0],
polygons: BAGMATI_POLYGONS,
adminArea: 'Gamo Zone',
adminLevel: 'admin2',
synthesized: false,
outlineSource: 'nominatim',
},
}),
});
const result = await gamo.areas.resolveAreaAction({ query: 'Gamo Zone' });
assert.equal(result.ok, true, result.error);
assert.equal(gamo.areas.store.size, 1);
});
test('a place no outline source can trace is refused, not guessed', async () => {
const miss = makeAreas({
annotationResolver: fakeLadder({ outline: null }),