Files
worldmonitor/todos/156-complete-p2-globe-scenario-missing-stroke-color-branch.md
Elie Habib 60e727679c feat(supply-chain): Sprint E — scenario visual completion + service parity (#2910)
* feat(supply-chain): Sprint E — scenario visual completion + service parity

- E1: fetchSectorDependency exported from supply-chain service index
- E2: PRO gate + all-renderer dispatch in MapContainer.activateScenario
- E3: scenario summary banner in SupplyChainPanel (dismiss wired)
- E4: "Simulate Closure" trigger button in expanded chokepoint cards
- E5: affectedIso2s heat layer in DeckGLMap (GeoJsonLayer, red tint)
- E6: SVG renderer setScenarioState (best-effort iso2 fill)
- E7: Globe renderer scenario polygons via flushPolygons
- E8: integration tests for scenario run/status endpoints

* fix(supply-chain): address PR #2910 review findings (P1 + P2 + P3)

- Wire setOnScenarioActivate + setOnDismissScenario in panel-layout.ts (todo #155)
- Rename shadow variable t→tmpl in SCENARIO_TEMPLATES.find (todo #152)
- Add statusResp.ok guard in scenario polling loop (todo #153)
- Replace status.result! non-null assertion with shape guard (todo #154)
- Add AbortController to prevent concurrent polling races (todo #162)
- Add polygonStrokeColor scenario branch (transparent) in GlobeMap (todo #156)
- Re-export SCENARIO_TEMPLATES via src/config/scenario-templates.ts (todo #157)
- Cache affectedIso2Set in DeckGLMap.setScenarioState (todo #158)
- Add scenario paths to PREMIUM_RPC_PATHS for auth injection (todo #160)
- Show template name in scenario banner instead of raw ID (todo #163)

* fix(supply-chain): address PR #2910 review findings

- Add auth headers to scenario fetch calls in SupplyChainPanel
- Reset button state on scenario dismiss
- Poll status immediately on first iteration (no 2s delay)
- Pre-compute scenario polygons in GlobeMap.setScenarioState
- Use scenarioId for DeckGL updateTriggers precision

* fix(supply-chain): wire panel instance to MapContainer, stop button click propagation

- Call setSupplyChainPanel() in panel-layout.ts so scenario banner renders
- Add stopPropagation() to Simulate Closure button to prevent card collapse
2026-04-10 21:31:26 +04:00

2.2 KiB

status, priority, issue_id, tags, dependencies
status priority issue_id tags dependencies
complete p2 156
code-review
quality
supply-chain
visual

GlobeMap polygonStrokeColor Missing scenario Branch — Falls Through to Red

Problem Statement

In GlobeMap.ts, polygonStrokeColor has no 'scenario' case. When scenario polygons are rendered, the callback falls through to the catch-all return '#ff4444' (conflict red), giving affected countries a visible red border that clashes with the intended orange/amber heat tint and visually conflates scenario state with conflict data.

Findings

  • File: src/components/GlobeMap.ts
  • polygonCapColor and polygonSideColor both have 'scenario' branches added in Sprint E
  • polygonStrokeColor was missed — falls through to '#ff4444' (conflict) or 'transparent'
  • At runtime: scenario-affected countries appear with a red border matching conflict polygons
  • Identified during architecture review of PR #2910

Proposed Solutions

// In polygonStrokeColor callback:
if (d._kind === 'scenario') return 'transparent';

Scenario heat overlay has no border — consistent with how the DeckGL GeoJsonLayer has stroked: false. Pros: Zero visual noise, matches DeckGL behavior, 1-line fix Cons: None Effort: Small | Risk: None

Option B: Use a subtle amber stroke

if (d._kind === 'scenario') return 'rgba(220,120,40,0.4)';

Adds a faint amber outline to distinguish from other polygon types. Effort: Small | Risk: Low (visual choice)

Apply Option A — transparent stroke for scenario polygons, matching DeckGL's stroked: false.

Technical Details

  • Affected files: src/components/GlobeMap.ts
  • Grep: polygonStrokeColor — find the callback and add the missing branch before the conflict case

Acceptance Criteria

  • polygonStrokeColor returns 'transparent' (or no-stroke equivalent) when d._kind === 'scenario'
  • No red border visible on Globe scenario overlay
  • npm run typecheck passes

Work Log

  • 2026-04-10: Identified during /ce-review of PR #2910 (GlobeMap polygon rendering)

Resources

  • PR: #2910