Add cable health scoring via sebuf InfrastructureService#220
Conversation
Port submarine cable health monitoring from PR #134 to the sebuf architecture. Adds GetCableHealth RPC to InfrastructureService that analyzes NGA maritime warnings to detect cable faults and repair activity, computing health scores with time-decay. - Proto: GetCableHealthRequest/Response, CableHealthRecord, evidence - Handler: NGA warning fetch, cable matching (name + proximity), signal processing, health computation with redis caching - Client: circuit breaker, proto enum → frontend string adapter, 1-min cache - Frontend: health-based cable coloring (fault=red, degraded=orange), evidence display in cable popup, SVG + DeckGL support Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This replaces #134, porting the cable health feature from a standalone edge function to the sebuf |
PR Review: Cable Health Scoring via sebuf InfrastructureServiceOverall: Well-structured feature with clean proto definition, solid signal processing, and good integration across both map renderers. A few issues worth addressing. Issues1. BLOCKING — Euclidean distance for geographic proximity is inaccurate const dist = Math.sqrt((lat - lLat) ** 2 + (lon - lLon) ** 2);Uses Euclidean distance on lat/lon degrees. At the equator 1° = 111km, but at 60°N it's ~55km for longitude. A cable landing at Singapore (1.35°N) vs one at Norway (62°N) will have wildly different "5 degree" thresholds. The At minimum, scale longitude by Math.sqrt((lat - lLat) ** 2 + ((lon - lLon) * Math.cos(lat * Math.PI / 180)) ** 2)Or use haversine, but the cosine adjustment is sufficient for a 5-degree radius. 2. BLOCKING — 3. SUGGESTION — Race between case 'cables':
await this.loadCableActivity();
await this.loadCableHealth();These are independent and could run in parallel with 4. SUGGESTION — console.log(`[CableHealth] ${faultCount} faults, ${degradedCount} degraded`);Logs every time health is fetched (every 5 minutes, or 1 minute from local cache). Consider removing or guarding behind verbose/debug mode. 5. SUGGESTION — No in-memory fallback cache on server handler 6. NITPICK — 7. NITPICK — Missing i18n keys for other locales What looks good
|
- Fix geographic proximity: use cosine-latitude correction instead of raw Euclidean distance on lat/lon degrees, return distanceKm directly - Fix signal kind: use 'cable_advisory' (not 'operator_fault') for non-fault NGA warnings so advisories don't trigger fault status - Parallelize loadCableActivity + loadCableHealth with Promise.all - Remove console.log from client-side cable-health service - Add in-memory fallback cache on server so transient Redis+NGA failures serve stale data instead of empty response Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Thanks for the thorough review! All addressed in d3ac428: 1. BLOCKING — Euclidean distance — Fixed. 2. BLOCKING — 3. SUGGESTION — Sequential cable loads — Fixed. Wrapped in 4. SUGGESTION — 5. SUGGESTION — In-memory fallback cache — Added. Follows the same pattern as UCDP — 6. NITPICK — Orphaned 7. NITPICK — Missing i18n keys — Noted for future translation pass. Only Ready for re-review when you get a chance @koala73! |
|
Thank you @SebastienMelki |
PR #220 added popups.cable.health.evidence only to en.json. Add translated values to all 15 other locales.
* feat: add cable health scoring via sebuf InfrastructureService Port submarine cable health monitoring from PR koala73#134 to the sebuf architecture. Adds GetCableHealth RPC to InfrastructureService that analyzes NGA maritime warnings to detect cable faults and repair activity, computing health scores with time-decay. - Proto: GetCableHealthRequest/Response, CableHealthRecord, evidence - Handler: NGA warning fetch, cable matching (name + proximity), signal processing, health computation with redis caching - Client: circuit breaker, proto enum → frontend string adapter, 1-min cache - Frontend: health-based cable coloring (fault=red, degraded=orange), evidence display in cable popup, SVG + DeckGL support Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix: address PR review feedback for cable health scoring - Fix geographic proximity: use cosine-latitude correction instead of raw Euclidean distance on lat/lon degrees, return distanceKm directly - Fix signal kind: use 'cable_advisory' (not 'operator_fault') for non-fault NGA warnings so advisories don't trigger fault status - Parallelize loadCableActivity + loadCableHealth with Promise.all - Remove console.log from client-side cable-health service - Add in-memory fallback cache on server so transient Redis+NGA failures serve stale data instead of empty response Co-Authored-By: Claude Opus 4.6 <[email protected]> --------- Co-authored-by: Claude Opus 4.6 <[email protected]>
PR koala73#220 added popups.cable.health.evidence only to en.json. Add translated values to all 15 other locales.
Summary
GetCableHealthRPC toInfrastructureService— analyzes NGA maritime warnings to detect cable faults/repair activity, computes health scores with time-decayReplaces #134.
Changes
GetCableHealthRequest/Response,CableHealthRecord,CableHealthEvidence,CableHealthStatusenumTest plan
npm run dev→curl -X POST http://localhost:3000/api/infrastructure/v1/get-cable-health -H 'Content-Type: application/json' -d '{}'returns valid responsecables: {})npm run typecheckpasses (ignoring pre-existing posthog-js issue)🤖 Generated with Claude Code