navi/backend/services
malice 4fdda175a3
navi-offroute: HPA tile DB manifest pattern (H6a-pre, unblocks continental rollout) (#53)
* navi-offroute: HPA tile DB manifest pattern (H6a-pre, unblocks continental rollout)

Replaces the single-file NAVI_OFFROUTE_HPA_DB env var with a directory-based
manifest layout (NAVI_OFFROUTE_HPA_DIR + manifest.json) so one deployment can
carry multiple regional tile DBs side by side and look up which one(s) cover
a route bbox. The two-level HPA* kernel (astar_hpa_multimode) is unchanged;
router.py asks the new hpa_manifest module for matching tile DBs and forwards
the path to the existing kernel.

Manifest schema (version 1):
  {"version": 1, "tile_dbs": [
    {"name": "idaho", "path": "idaho.db",
     "chunk_bounds": {"min_x": -8550, "max_x": -8430, "min_y": 3100, "max_y": 3260}}
  ]}

- path is relative to the manifest directory.
- chunk_bounds is inclusive in chunk-index space; null = covers everywhere.
- Multiple entries may overlap; v1 dispatch only handles single-region routes,
  multi-region falls through to the unified kernel (UNION across DBs is a
  future PR — needs astar_hpa_multimode signature change).

Backward-compat: if NAVI_OFFROUTE_HPA_DB is set and NAVI_OFFROUTE_HPA_DIR is
not, the loader synthesizes a single unbounded entry and warns (deprecation).
Current deploy keeps working byte-identically; env-file migration happens as
a separate follow-up step.

Touches:
  + hpa_manifest.py (new, 144 LOC) — schema, loaders, lookup, lazy conn cache
  ~ router.py (-24 +31) — _HPA_MANIFEST replaces HPA_TILE_DB; dispatch site
    consults manifest.dbs_for_route_bbox; _hpa_eligible uses manifest.enabled
  + tests/test_hpa_manifest.py (new, 117 LOC) — 8 tests covering all paths
  ~ tests/test_hpa_runtime.py (4 lines) — monkeypatch _HPA_MANIFEST instead

No touches to hpa_build, astar, transitions, cost, mvum. No schema change.
No service restart, no env-file edit (deploy migration happens after merge).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* navi-offroute: drop unused connection cache from HPAManifest (cleanup)

The connection cache field (_conns) and get_connection() method were
shipped in PR #53 "ready for future use" but never consumed by the v1
dispatch path: astar_hpa_multimode opens its own sqlite connection per
call (astar.py:752) and changing that signature was out of scope.

Per self-review of PR #53: shipping dead code in a PR is wrong even
when the rationale is "future PRs will use it." Removing it here keeps
the manifest module focused on lookup; whoever needs the cache later
can add it alongside the use site.

  - Drop _conns field, get_connection() method.
  - Drop sqlite3 + Dict imports (no longer referenced).
  - Drop test_get_connection_caches_per_path.

23 deletions, 2 insertions. No production behaviour change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Ubuntu <zvx@recon-vm.echo6.co>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-04 14:23:19 -06:00
..
navi_admin fix: include navi-offroute (8428) in navi-admin fleet list 2026-05-23 23:17:23 -06:00
navi_config Add navi-admin service (extraction #7) (#7) 2026-05-22 21:21:00 -06:00
navi_contacts Add navi-admin service (extraction #7) (#7) 2026-05-22 21:21:00 -06:00
navi_geo shared: promote dem.py to shared/ (prep for navi-offroute) (#9) 2026-05-22 22:42:47 -06:00
navi_landclass Add navi-admin service (extraction #7) (#7) 2026-05-22 21:21:00 -06:00
navi_offroute navi-offroute: HPA tile DB manifest pattern (H6a-pre, unblocks continental rollout) (#53) 2026-06-04 14:23:19 -06:00
navi_places navi-places: place_cache TTL (default 30 days) (#33) 2026-05-26 16:53:25 -06:00
navi_traffic Add navi-admin service (extraction #7) (#7) 2026-05-22 21:21:00 -06:00