Repository navigation
Switch between National and Site by zoom, with preload and cross-fade (seamless handoff, Phase B) - #28
Conversation
The site catalog now carries latitude and longitude for all 155 sites: 150 from nexrad-model's registry (a Rust test keeps them in sync) and 5 the registry lacks (KBHX, KDOX, KHDC, KLGX, PAPD) from api.weather.gov. decideAutoSource is the pure Phase B policy: a covering Site replaces National at zoom 9 (center within 200 km), a displayed Site is kept down to zoom 8.5 and within 230 km, the likely Site preloads from zoom 8, and moving between Sites always passes through National. A picked Site is preferred while the view stays inside its coverage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Site shader gains u_opacity. Like the display mode it changes only shading, never the paint receipt, so a Site can draw its first frame at opacity 0 and fade in over National. fadeOpacity eases between values across animation frames and stops when superseded. National is now always inserted, and re-inserted after context loss, below the Site stack, so the fading Site layer is the upper one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Zoom now decides the source. After a camera move the operator makes, the policy may fade a covering Site in over National (zoom 9, center within 200 km), keep it down to zoom 8.5 and within 230 km, or fade it back out to the resident National. Moving between Sites passes through National. - From zoom 8 the likely Site's newest scan is fetched ahead on the Site lane; the switch reuses that generation and paints without a network wait. Only one automatic switch runs at a time, and a Site that just failed is not retried for a minute. - The Site paints its first frame at opacity 0, fades in over 300 ms (instant under reduced motion), and only then becomes the displayed source. Leaving it, National paints underneath first and the Site fades out before it is removed. National keeps playing until the Site covers it. - Automatic switches never move the camera. The picker flies to a Site at zoom 9.5 (preloading during the flight from National), picking National zooms out to the country, recenter uses the same targets, and the camera is restored at launch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
proveZoomHandoff preloads KTLX at zoom 8.3, requires zoom 9.6 to fade the preloaded Site in over resident National without moving the camera, and zoom 7.5 to fade back to the same National history with the Site removed. The resident-handoff timing allows for the deliberate fade-out. docs/32 records the Phase B policy, switching, camera, and known limits; PRODUCT and DESIGN note that zoom now decides the source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A flight to where the camera already is may never emit moveend, so the landing evaluation never ran. The picker, National choice, and recenter now evaluate immediately when the camera is not moving after the call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The packaged gate released its resident-evidence reservation before measuring active playback, so a newer MRMS frame committing during the 1.5 s window (every ~2 minutes) failed "zero sharp-playback transfer and upload work". The measurement now holds the same reservation the scrub evidence uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gate Exact point lookups now settle within one 16 ms polling interval, so the gate could miss the neutral "--.- dBZ" pending state entirely and fail at random. A MutationObserver on the playback bar records every readout change during the window; the gate's requirements are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ff-phase-b # Conflicts: # src/App.tsx
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 87d3c95dae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const settleAutoSwitch = () => { | ||
| autoSwitchInFlight = false; | ||
| if (!pendingAutoEvaluation) return; | ||
| pendingAutoEvaluation = false; | ||
| evaluateAutoSource(); |
There was a problem hiding this comment.
Re-evaluate after the intermediate National hop
When a user pans at detail zoom from the current Site's coverage into another Site's coverage, the policy first targets National, but pendingAutoEvaluation is normally false because there was only one moveend. Consequently settleAutoSwitch stops after National is revealed and never evaluates the unchanged camera again, leaving National displayed at zoom 10 until the user moves the map a second time. Re-evaluate after a successful Site-to-National switch so the intended National-to-new-Site leg can run.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 2d5cd1f: a switch that succeeds now re-checks the same camera, so one pan into another Site's coverage runs Site → National → Site. The packaged zoom proof adds a KTLX → KFWS pan and requires that exact sequence; it passed at 3.4 s with the camera untouched.
| const painted = radarSessionCoordinatorRef.current?.snapshot().painted; | ||
| if (auto && instance && location && painted?.source.kind === "national") { | ||
| auto.prefetch(normalized); | ||
| auto.evaluateIfSettled(); | ||
| return; |
There was a problem hiding this comment.
Route picked Site changes through National
When a Site is already painted and the operator picks a different Site, this condition is false, so the handler falls through to session.start(normalized) immediately. That directly replaces the current Site's frames without the required Site-to-National fade/handoff; the flight's moveend only sets pendingAutoEvaluation while that manual transition is active, and the manual promise never calls settleAutoSwitch. Handle the picker through the automatic route for painted Sites as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 2d5cd1f: picking a Site while another Site is shown now goes through the zoom policy too. The policy hops a displayed Site to National when a different picked Site covers the center at zoom ≥ 9 (this also covers picks closer than 230 km, e.g. KTLX → KVNX, which previously would have stayed on KTLX). Moves made during a manual switch are now evaluated once it ends, via a coordinator subscription.
| if (auto && instance) { | ||
| auto.evaluateAfterNextMove(); | ||
| flyToNational(instance); | ||
| auto.evaluateIfSettled(); |
There was a problem hiding this comment.
Allow National selection to recenter a National view
The newly added National flight is unreachable when National is already the settled painted source because the earlier guard returns first. Thus, if the user has panned or zoomed a National view regionally—for example over an area without Site coverage—choosing National again does not perform the promised flight to the CONUS bounds. The source-transition guard should not suppress the camera action.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 2d5cd1f: picking National always flies out to CONUS; being on National already only skips the redundant source switch and the inspection reset.
- A switch that succeeds re-checks the same camera, so a pan from one Site's coverage into another's runs both legs (Site, National, Site) from one camera move instead of stopping on National. - A camera move made during a manual switch is evaluated once that switch ends. - Picking a Site while another Site is shown flies there and fades through National, instead of replacing the frames in place. The policy now hops a displayed Site to National when a different picked Site covers the center at detail zoom, and drops a pick once the view leaves its range. - Picking National always flies out to the country, even when National is already shown. - The packaged zoom proof adds a KTLX to KFWS pan and requires the KTLX > national > KFWS sequence with the camera untouched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What changes
Zoom now picks the radar source, the way RadarScope does:
How
src/data/radar-sites.jsonnow has a latitude and longitude. A Rust test checks them against the NEXRAD registry.autoSourcePolicy.tsmakes the decision: enter at zoom ≥ 9 within 200 km, keep at zoom ≥ 8.5 within 230 km, preload at zoom ≥ 8.RadarCustomLayergains au_opacityuniform;fade.tseases it with smoothstep. The fade is skipped under prefers-reduced-motion.Verification
npm run verifypasses: frontend tests, build, and Rust fmt/clippy/test/check.npm run test:national:phase4:packagedpasses with 0 failures, using live NOAA data:Known limits
Builds on #26 (Phase A, merged).
🤖 Generated with Claude Code