* 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
2.6 KiB
status, priority, issue_id, tags, dependencies
| status | priority | issue_id | tags | dependencies | ||||
|---|---|---|---|---|---|---|---|---|
| complete | p2 | 157 |
|
SCENARIO_TEMPLATES Imported Directly from ../../server/ — Module Boundary Violation
Problem Statement
SupplyChainPanel.ts imports SCENARIO_TEMPLATES via a relative path crossing into server/:
import { SCENARIO_TEMPLATES } from '../../server/worldmonitor/supply-chain/v1/scenario-templates';
Client components must not import from server/ directly — the src/ → server/ boundary keeps server-only deps (gRPC stubs, proto codegen) out of the browser bundle. This import will silently work today but will break if any server-only module is added upstream of scenario-templates.ts.
Findings
- File:
src/components/SupplyChainPanel.ts - Direct relative import crosses
src/→server/module boundary src/config/scenario-templates.tsalready re-exports theScenarioResultandScenarioVisualStatetypes from this file- The
SCENARIO_TEMPLATESconst is not yet re-exported fromsrc/config/scenario-templates.ts - Pattern in codebase: all other panel files import from
@/config/,@/services/, or@/components/ - Identified by architecture-strategist during PR #2910 review
Proposed Solutions
Option A: Re-export SCENARIO_TEMPLATES via src/config/scenario-templates.ts (Recommended)
In src/config/scenario-templates.ts, add:
export { SCENARIO_TEMPLATES } from '../../server/worldmonitor/supply-chain/v1/scenario-templates';
Then update SupplyChainPanel.ts:
import { SCENARIO_TEMPLATES } from '@/config/scenario-templates';
Pros: One canonical boundary crossing point, consistent with existing type re-exports, no runtime impact Cons: Needs one extra line in config file Effort: Small | Risk: None
Option B: Add a src/ copy or adapter
Duplicate the const in src/config/. More files, divergence risk.
Effort: Medium | Risk: Medium (divergence)
Recommended Action
Apply Option A — add one re-export to src/config/scenario-templates.ts and update the import in SupplyChainPanel.ts.
Technical Details
- Affected files:
src/config/scenario-templates.ts(add re-export),src/components/SupplyChainPanel.ts(update import)
Acceptance Criteria
src/components/SupplyChainPanel.tsno longer imports from../../server/SCENARIO_TEMPLATESaccessible via@/config/scenario-templatesnpm run typecheckpasses
Work Log
- 2026-04-10: Identified by architecture-strategist during PR #2910 review
Resources
- PR: #2910