navi/backend/services/navi_places
Matt f537a55266 wiki_rewrite: paginate fully + extend rewriter to wikivoyage
The Twin Falls Wikivoyage investigation surfaced two coordinated gaps that kept
OSM wikivoyage tags from rewriting to local Kiwix URLs even though the
wikivoyage ZIM is loaded and serving.

Fix 1 (pagination) -- wiki_rewrite.py: append ?count=-1 to the Kiwix OPDS catalog
fetch. kiwix-serve's /catalog/v2/entries defaults to the first 10 entries; the
library has 17, so wikivoyage (and other page-2 ZIMs) were never seen by
_discover_zims and never entered _zim_map, so their tags always fell back to public.

Fix 2 (tag passthrough) -- place_detail.py: add wikivoyage to both nominatim
extratags whitelists, mirroring the existing wikipedia/wikidata lines. The
rewriter (classify_wiki_link / build_kiwix_url / rewrite_wiki_link) and the
_enrich_wiki_links loop were already source_type-generic and covered wikivoyage;
the only missing link was that the nominatim parser dropped the wikivoyage tag
before enrichment ever saw it. No rewriter refactor was needed.

Tests (test_place.py):
- test_catalog_url_requests_full_library: the OPDS fetch URL contains count=-1.
- test_wikivoyage_tag_rewrites_to_local: a wikivoyage OSM tag for a mirrored
  article rewrites to https://wiki.echo6.co/content/wikivoyage_en_all_maxi_<date>/...
  with sources.wiki_rewrites.wikivoyage == "local" (Kiwix mocked).
Full navi-places suite: 15 passed.

Follow-up (separate ops step, not in this PR): prune 3 dangling library.xml
entries on the Kiwix host (wikiloc.com_eng_2026-04_18, meshtastic.org_eng_2026-04_14,
meshtastic.org_eng_2026-04_15) whose ZIM files are absent; kiwix-serve silently
skips them.

Note: Twin Falls (R/121355) itself has no OSM wikivoyage tag, so it still will not
get a local Wikivoyage link from tag rewrite -- that needs the separate name-based
discovery feature (discover_wikivoyage_article stub).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 06:23:24 +00:00
..
tests wiki_rewrite: paginate fully + extend rewriter to wikivoyage 2026-05-26 06:23:24 +00:00
__init__.py Add navi-places service (extraction #5) (#5) 2026-05-22 17:00:06 -06:00
admin.py decouple: read wiki_index.db directly in navi-places (drop /api/wiki-enrich HTTP) 2026-05-23 19:17:53 -06:00
app.py decouple: move /api/wiki-rewrite logic from recon to navi-places 2026-05-23 21:12:27 -06:00
config.py Add navi-places service (extraction #5) (#5) 2026-05-22 17:00:06 -06:00
google_places.py Add navi-places service (extraction #5) (#5) 2026-05-22 17:00:06 -06:00
osm_categories.py Add navi-places service (extraction #5) (#5) 2026-05-22 17:00:06 -06:00
overture.py Add navi-places service (extraction #5) (#5) 2026-05-22 17:00:06 -06:00
place_cache.py Add navi-places service (extraction #5) (#5) 2026-05-22 17:00:06 -06:00
place_detail.py wiki_rewrite: paginate fully + extend rewriter to wikivoyage 2026-05-26 06:23:24 +00:00
place_route.py Add navi-places service (extraction #5) (#5) 2026-05-22 17:00:06 -06:00
wiki_index.py decouple: read wiki_index.db directly in navi-places (drop /api/wiki-enrich HTTP) 2026-05-23 19:17:53 -06:00
wiki_rewrite.py wiki_rewrite: paginate fully + extend rewriter to wikivoyage 2026-05-26 06:23:24 +00:00