Internal · Engineering · March 2026

Production Audit Report

Full audit of the CO₂Router Engine and Dashboard codebase as of March 30, 2026.

Engine
85%
Production-ready
Dashboard
80%
Production-ready
Infrastructure
90%
Production-ready

1. Executive Summary

Full audit of the CO₂Router Engine and Dashboard codebase. Engine is 85% production-ready. Dashboard is 80% production-ready. Deployment infrastructure is 90% ready.

2. Architecture Overview

ComponentTechnology
EngineTypeScript · Node.js · Express · Prisma · Redis
DashboardNext.js 14
DatabasePostgreSQL (Neon) · 35+ models · 11 migrations
Signal providersWattTime, Electricity Maps, Ember, EIA-930
CachingRedis · 15min / 1hr / 6hr TTLs

3. Latency Analysis

PathLatencyNotes
Cache-hit path~10–25msRedis + scoring + response serialization
Cache-miss path8,000–15,000msExternal provider API call — should never occur on hot path
Hot path budget100ms p99Internal quality gate — enforced by middleware
Contract ceiling200ms p99Cross-region SLA — not yet stress-tested

4. Issues Found

Critical (Block Production Deployment)

  • P99 latency SLA not enforced in code — 200ms ceiling documented but no middleware enforcement (ADR-001 architecture is the fix)
  • Dashboard null-safety: 71 components require audit — any nullable field from the engine can cause a render crash
  • Provider disagreement detection: logic exists but needs verification against real multi-provider data

High (Before Production Launch)

  • Integration tests missing for all 7 intelligence endpoints
  • Forecast stability derivation: unclear source — needs validation against Electricity Maps response schema
  • Water impact field names: potential mismatch between engine output and dashboard expectations

Medium (After Launch)

  • Tests for curtailment and ramp detection
  • Water impact scenario modeling (2030/2050/2080 projections)
  • Metrics dashboard for latency, cache hit rate, provider agreement rate

5. Test Coverage

23 test files present covering core adapters and routing.

Missing test coverage:

  • Intelligence endpoints (GET /api/v1/intelligence/grid/*)
  • Dashboard contract alignment
  • Curtailment and ramp detectors
  • Forecast stability derivation
  • Water impact scenarios
  • Grid signal audit endpoint

6. Required Environment Variables

VariableRequiredNotes
DATABASE_URLYesPostgreSQL connection string (Neon recommended)
REDIS_URLYesRedis connection string
WATTTIME_USERNAMEYesWattTime API credentials
WATTTIME_PASSWORDYesWattTime API credentials
EIA_API_KEYYesEIA.gov developer API key
ELECTRICITY_MAPS_API_KEYNoOptional — enables flow-traced enrichment
EMBER_API_KEYNoOptional — enables Ember data pull
JWT_SECRETYesAuth token signing
NEXT_PUBLIC_ENGINE_URLYesDashboard → Engine base URL

7. Intelligence Endpoints

These endpoints must exist and return actual data (not placeholder responses):

EndpointPurpose
GET /api/v1/intelligence/grid/hero-metricsDashboard hero KPIs — carbon avoided, CRM, high confidence %
GET /api/v1/intelligence/grid/summaryRegional grid status overview
GET /api/v1/intelligence/grid/opportunitiesCarbon opportunity windows by region
GET /api/v1/intelligence/grid/region/:regionSingle-region deep dive with signal state
GET /api/v1/intelligence/grid/import-leakageImport carbon leakage scores by BA
GET /api/v1/intelligence/grid/audit/:regionSignal audit trail for a region

8. Prioritized Recommendations

CRITICAL
  • Add P99 latency budget enforcement middleware (100ms ceiling)
  • Audit and fix null-safety on all 71 dashboard components
  • Verify provider disagreement detection with real multi-provider data
HIGH
  • Add integration tests for all 7 intelligence endpoints
  • Clarify forecast stability derivation — validate against Electricity Maps schema
  • Align water impact field names between engine and dashboard
MEDIUM
  • Add tests for curtailment and ramp detection
  • Add water impact scenario modeling
  • Add observability metrics dashboard (latency, cache hit rate, provider agreement)