Near-identical viewports from different collaborators (slightly different pan/zoom because Yjs awareness doesn't enforce pixel-exact alignment) previously produced byte-different Overpass queries and therefore different server-side cache keys. Each client missed cache and triggered its own upstream fetch. buildQuery now quantizes the bbox to a 0.01° grid (~1 km), expanding outward (south/west floor, north/east ceil) so the viewport is always covered, and formats coords with 3 decimals for a stable string. Trade-offs: - Slightly larger query bbox: ≤ one grid cell (≈ 1 km) of padding on each side. For a zoom-12 viewport (~11 km wide) that's <10% extra data; bounded by the existing `[maxsize:1048576]` + `out 100` limits. - Coordinates in the query are now 3-decimal strings regardless of the caller's precision — existing buildQuery test updated to match. Two new tests cover the cache-alignment property and the outward- expansion invariant. Hit ratio impact will be visible on the Grafana "Overpass Cache Hit Ratio" stat added in the prior PR. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| components | ||
| jobs | ||
| lib | ||
| routes | ||
| entry.client.tsx | ||
| entry.server.tsx | ||
| root.tsx | ||
| routes.ts | ||