Skip to content

feat(search): hard-clip Photon to US + Census lane (PR 1 of 5) - #3

Merged
taddyb merged 10 commits into
mainfrom
feat/richer-geocoding-pr1
May 20, 2026
Merged

feat(search): hard-clip Photon to US + Census lane (PR 1 of 5)#3
taddyb merged 10 commits into
mainfrom
feat/richer-geocoding-pr1

Conversation

@taddyb

@taddyb taddyb commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

First PR in the richer-geocoding + discovery rollout (full plan in docs/superpowers/plans/2026-05-18-richer-geocoding.md, spec in docs/superpowers/specs/2026-05-18-richer-geocoding-design.md — both included in this PR).

Search bar gets two immediate, visible improvements without touching the data pipeline:

  • Photon now hard-clips to US (countrycodes=us) and softly biases to the basemap bbox. Eliminates the failure where 140 W 25th St returned Wyandanch, NY or Ontario, CA.
  • US Census Geocoder lane kicks in for queries matching /^\d+\s+\S/ (digits + space + word). Free, keyless, NY/NJ/CT-filtered.
  • New js/search-merge.js orchestrates lanes with 50 m geographic dedup and a score-based merge — designed to extend in PRs 3 and 5.
  • New js/tokenize.js ships a shared normalize() (build pipeline and runtime will both import it) plus an empty CATEGORY_KEYWORDS map filled in by PR 5.
  • New tests/unit/ runner with 18 passing node --test cases; CI gate added via .github/workflows/pr-checks.yml.

Test plan

  • node --test tests/unit/**/*.test.mjs passes (18/18) locally
  • Manually: 140 W 25th St resolves to Manhattan, not Wyandanch
  • Manually: Smithtown NY still resolves (Photon path not regressed)
  • Manually: 83 Elm Pl Brooklyn resolves via Census
  • CI's new `PR checks` job runs unit tests

Subsequent PRs in this series

  • PR 2: POI build pipeline + binary
  • PR 3: local POI lane in dropdown
  • PR 4: WASM `reachable_nodes` method
  • PR 5: search-driven discovery + map pins

🤖 Generated with Claude Code

taddyb and others added 10 commits May 19, 2026 20:22
Adds four-lane search (local POI / Census / Photon / discovery) and a
build pipeline that extracts ~100k pre-snapped POIs from the same OSM
PBF the walking graph uses. Discovery lane runs a bounded WASM
Dijkstra so category queries ("coffee", "park") return reachable POIs
ranked by walking minutes, not crow-flight distance.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Five PRs, each independently shippable: (1) tune Photon + Census lane,
(2) POI build pipeline + binary, (3) local POI lane, (4) WASM
reachable_nodes, (5) discovery lane + map pins. Every task is TDD
with concrete code in each step.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two real bugs surfaced by '485 W Valley Stream Blvd':
- Photon's parameter is `countrycode` (singular), not `countrycodes`.
  With the wrong name Photon returned 200 + {message: "..."} (no
  `features` key), which silently produced empty dropdowns for ALL
  queries since PR 1 went up. Also harden `geocode()` to treat
  non-array `features` as empty rather than throwing.
- Census needs a state hint for ambiguous suburban addresses. If the
  bare query returns 0 matches AND has no state token, retry with
  ", NY" / ", NJ" / ", CT" until one matches.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@taddyb
taddyb force-pushed the feat/richer-geocoding-pr1 branch from 334fad3 to f8411ec Compare May 20, 2026 00:22
@taddyb
taddyb merged commit fdfd1e8 into main May 20, 2026
1 check passed
@taddyb
taddyb deleted the feat/richer-geocoding-pr1 branch May 20, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant