fix: sync _TOWN_ANCHORS_SEED with the production town_anchors table

_TOWN_ANCHORS_SEED covered only 29 hand-picked towns, while the live
CT108 town_anchors table (GUI-curated since) has grown to 186. Any
fresh deploy (fresh volume, or the pre-v19 sqlite path) would seed
only the original 29 and silently lose anchor-resolution coverage for
the other 157 real, already-in-production towns.

Regenerated the dict from a live dump of CT108's town_anchors
(name, lat, lon, state; all 186 rows confirmed enabled=1), alphabetized,
same dict-of-dicts shape and column-aligned brace formatting as before
(alignment column widened to fit the longest name, "mountain home
afb"). seed_town_anchors() is unchanged and still INSERT OR IGNORE, so
it stays idempotent against the existing production rows.

Expanding the seed changes which town resolves as "nearest" for a few
existing test fixtures whose incident/work-zone coordinates are
genuinely closer to a newly-added real town (e.g. Oakley, Wilder) than
to the old 29-town subset's nearest match -- those goldens and
assertions are updated to the new (correct) nearest-town result.
test_api_post_add_town's probe town is renamed from the now-real
"Bellevue" to a fictitious "Testopolis" to avoid a duplicate-name 400.
This commit is contained in:
Matt Johnson 2026-08-16 02:58:11 +00:00
commit 522458f194
4 changed files with 206 additions and 38 deletions

View file

@ -357,8 +357,10 @@ def test_k_anchor_falls_to_nearest_town(monkeypatch, mem_db):
county="Cassia")
n = _normalize_wfigs(env)
wire = _wfigs_render(n, prefix="New")
# Resolves anchor via town_anchors table (Burley @ 42.536, -113.793)
assert "Burley" in wire
# Resolves anchor via town_anchors table (Oakley @ 42.24206, -113.883058
# -- now the nearest seeded anchor to the incident's 42.197,-113.710
# after the full-list seed sync; Burley is farther away)
assert "Oakley" in wire
def test_k_anchor_falls_to_landclass(monkeypatch, mem_db):
@ -372,7 +374,8 @@ def test_k_anchor_falls_to_landclass(monkeypatch, mem_db):
n = _normalize_wfigs(env)
wire = _wfigs_render(n, prefix="New")
# Resolves nearest town from town_anchors table, overriding landclass
assert "Burley" in wire
# (Oakley is nearest to 42.197,-113.710 after the full-list seed sync)
assert "Oakley" in wire
def test_k_anchor_falls_to_county(monkeypatch, mem_db):
@ -385,7 +388,8 @@ def test_k_anchor_falls_to_county(monkeypatch, mem_db):
n = _normalize_wfigs(env)
wire = _wfigs_render(n, prefix="New")
# Resolves nearest town from town_anchors table
assert "Burley" in wire
# (Oakley is nearest to 42.197,-113.710 after the full-list seed sync)
assert "Oakley" in wire
def test_k_anchor_nearest_town_under_one_mile_says_near(monkeypatch, mem_db):
@ -398,7 +402,8 @@ def test_k_anchor_nearest_town_under_one_mile_says_near(monkeypatch, mem_db):
n = _normalize_wfigs(env)
wire = _wfigs_render(n, prefix="New")
# Anchor resolved via town_anchors; exact format depends on distance
assert "Burley" in wire
# (Oakley is nearest to 42.197,-113.710 after the full-list seed sync)
assert "Oakley" in wire
# ============================================================================