feat/atlas-intl
needs attentionviewing older commit164beb7 · fullpre-PRreviewed 2026-07-22 19:04 UTC2H · 4M · 8L · 12I- Purpose
- Extends the open-source Atlas SEN (Mexico electricity grid map) to show the country's cross-border power interconnections — context missing from the current domestic-only map.
- Goal
- Add an 'Interconexiones internacionales' toggle layer showing Mexico's 6 border ties with the US, Guatemala, and Belize.
- Sub-goals
- Add international_ties.json GeoJSON with 6 ties + 12 endpoint points
- Add 4 Mapbox layers (glow / AC / DC / pts) with click popups and toggle wiring
- What
- New static GeoJSON data file with 6 international power ties; index.html updated to fetch, render, and toggle the new layer.
- Why
- The Atlas SEN map lacked international context; showing border interconnections completes the picture of how Mexico's grid connects to WECC, ERCOT, SIEPAC, and Belize.
- Areas
- apps/web/public/atlas/data/international_ties.json+20−0apps/web/public/atlas/index.html+14−4
- Blast
- 2 files, +34/−4. Static public atlas page; no backend, no DB, no auth.
Findings · 13
correctness2
intl-glow omitted from cursor-handler forEach
apps/web/public/atlas/index.html
Hovering on the glow fringe won't switch cursor to pointer. Add 'intl-glow' to the cursor handler array.
p.tie has no null-guard in intl-pts popup
apps/web/public/atlas/index.html
Safe for current data but a future pt feature omitting 'tie' renders 'enlace: undefined'. Add p.tie||''.
security2
XSS: GeoJSON string properties interpolated unescaped into innerHTML popup
apps/web/public/atlas/index.html
All properties (n, mx, ext, pais, mw, tech, dir, year, grupo, src, name, tie) go directly into template literals rendered via pop() as innerHTML. A compromised or maliciously-PR'd international_ties.json would inject arbitrary JS. Fix: escapeHtml() on all interpolated values.
Open-source data file is an unguarded XSS vector with no CI lint barrier
apps/web/public/atlas/data/international_ties.json
A PR modifying any string field could ship XSS without touching application code. Add a CI step rejecting angle brackets in GeoJSON string properties.
conventions2
intl-glow paint differs slightly from tx-lines-glow baseline
apps/web/public/atlas/index.html
blur:5/opacity:0.22 vs tx-lines-glow blur:4/opacity:0.28. Minor aesthetic divergence.
intl source has defensive ternary guard not present in other source registrations
apps/web/public/atlas/index.html
Safe but inconsistent; document as intentional or align with direct-pass pattern.
tests1
No CI schema validation for hand-authored GeoJSON data files
apps/web/public/atlas/data/international_ties.json
A lightweight Node script could assert line/point pairing, coordinate bounds, required properties, and nLines count.
improvement5
No legend distinguishing AC solid lines from DC/async dashed lines
apps/web/public/atlas/index.html
The sync/async visual split (solid vs dashed) has no explanation in the UI. Users will see dashed lines for Laredo VFT and Railroad/Sharyland with no affordance. Add an 'Internacional: CA / CC' legend entry.
Popup omits null guard for mw and dir properties
apps/web/public/atlas/index.html
p.mw is always interpolated without a guard — if mw:0 or null, renders bare '0'. Add: ${p.mw?p.mw:'capacidad no publicada'}.
Source ID and layer ID both named 'intl' — confusing for maintainers
apps/web/public/atlas/index.html
Mapbox GL JS namespaces don't conflict but readable disambiguation is better. Rename solid-AC layer to 'intl-ac' for symmetry with 'intl-dc'.
Data gaps: possible second Belize circuit; seasonal capacity limits not reflected
apps/web/public/atlas/data/international_ties.json
CFE docs reference two Belize circuits. MX-GT seasonal limits differ from nameplate. Add a 'capacidad nominal' tooltip note.
Inline muted color (#8b93a4) repeated — use CSS class
apps/web/public/atlas/index.html
Two popup spans use style='color:#8b93a4' inline. Define a .tag--muted CSS class.
seo1
Page title/meta description may not reflect new international scope
apps/web/public/atlas/index.html
If title/description scopes to Mexico-only, the addition of CAISO/ERCOT/Guatemala/Belize cross-border ties warrants an update.