fix(terrain): keep cold height requests within the browser deadline (#348)

Use 64-point browser and upstream terrain batches to reduce cold-cache timeouts. Preserve successful chunk results, distinguish absent readings from malformed responses, and reject fabricated zero heights.

Original terrain resilience contribution by ItzDESTAQ, with browser batching, validation and regression follow-up by Sameh Khamis.

Validated with unit/build/format/boundary checks, 108 tracking checks, 5 terrain-outage checks, controlled slow-upstream comparison and live browser checks.

Co-authored-by: ItzDESTAQ <[email protected]>
Co-authored-by: Sameh Khamis <[email protected]>
This commit is contained in:
DESTAQandSameh Khamis authored and GitHub committed 2026-09-12 14:04:08 -07:00
1 parent 4e99f40488
commit db49edf363
8 files changed
+254 -32

No files matched your search

+14 -6
View File
@@ -1211,12 +1211,20 @@ This is the current runtime/source-of-truth snapshot for the project.
> settled dim contact always completes its release after tracking ends.
> - **Terrain-height resilience:** `/api/terrain/heights` caches canonical
> 5-decimal points individually, reconstructs reordered/overlapping batches
> in exact request order, and refreshes only missing or stale points. Network,
> 429, and 5xx failures receive bounded jittered retries with `Retry-After`;
> stale real heights remain usable per point, while an uncached absent height
> still returns 502 rather than becoming a fabricated ground value. Client
> geoid fallbacks wait 60 seconds before retrying and self-heal to Re:Earth on
> the first later successful fetch.
> in exact request order, and refreshes only missing or stale points. Upstream
> calls and browser requests are both chunked at 64 points, sized to fit
> their 30s deadlines across Re:Earth's observed 87-186 ms/point range; a chunk
> that still fails contributes nulls for its own positions instead of
> discarding the chunks that resolved. Network, 429, and 5xx failures receive
> bounded jittered retries with `Retry-After`; stale real heights remain
> usable per point, while an uncached absent height still returns 502 rather
> than becoming a fabricated ground value. A position the upstream answers
> with a null ellipsoid is reported as an absent height rather than a refresh
> failure, and is left uncached so a later poll re-asks it. Client geoid
> fallbacks wait 60 seconds before retrying and self-heal to Re:Earth on the
> first later successful fetch. Smaller chunks reduce timeout risk; complete
> camera batches still wait for their sequential requests, and unresolved
> placement continues to use the existing prior until real heights arrive.
> - **Overpass cache admission:** `/api/overpass` parses and sanitizes requests,
> then checks fresh memory, identical in-flight work, and fresh disk entries
> before invoking its local 90/min limiter. Cache and single-flight responses