Module Overview
Watch Regions & History
Module 2 already got your AI assistant to build the full watch-regions backend: the schema’s partial unique index, the repo functions that keep “at most one default” honest under concurrent writes, and every route, including the dedicated POST /:id/default endpoint. Module 3 got it to build a screen that shows one region’s live traffic. Neither of those steps closed the gap between them, and that gap is exactly what this module is about: directing your AI assistant to build a real control panel for adding, enabling, and defaulting regions, a map that actually opens on the operator’s chosen default, “look anywhere” panning that falls back to on-demand lookups the moment you drag off the watched area, a fading trail of where the selected aircraft has actually been, and a scrubber that reconstructs any recent moment from the database.
Why This Matters
This is the module where an AI assistant is most tempted to reinvent something you already have. It’s been handed a backend it didn’t just build (or did, a module ago, and may not remember the details of), and a store and MapPanel that already exist with their own conventions. The easy failure mode isn’t a bug, it’s duplication: a second default-setting endpoint instead of the one Module 2 already shipped, a fresh piece of local state instead of a slice on the store everything else already reads from. Catching that, and steering the assistant back to the one true implementation, is the actual skill this module teaches. Everything here reads from the same position_snapshots and watch_regions tables the first two modules built, and it all has to extend the same store and the same MapPanel you already have running, not stand up parallel versions next to them.
What You’ll Learn
- Directing an AI assistant to grow the store from a single flat aircraft list into per-region positions with an operator-configurable default, and reviewing that the watch-regions control panel it builds sits entirely on top of the repo and routes Module 2 already shipped, instead of duplicating them
- Prompting a stateless
/api/live/:lat/:lon/:radiusendpoint for “look anywhere” free-pan, and catching the difference between free-pan state that’s correctly ephemeral and free-pan state an AI assistant accidentally persists somewhere it shouldn’t - Directing fading aircraft trails, reconstructed from
position_snapshotsfor whichever aircraft is currently selected, and reviewing that the query is actually bounded - Prompting historical playback: a bounded time-range query over the same table, a scrubber UI that replays it, and verifying the AI’s version cleanly hands control back to live data when the operator exits
Outcome
By the end of this module, you’ll have the same map the original course ends up with: default-region-aware on load, free to pan anywhere without losing live data, trailing the selected aircraft’s recent track, and able to step back through the last twenty minutes on demand. The difference is you got there by directing an AI assistant through each piece and catching the specific ways it tried to cut corners or reinvent work already done, not by trusting its first pass.
Let’s get started.