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
| Component | Technology |
|---|---|
| Engine | TypeScript · Node.js · Express · Prisma · Redis |
| Dashboard | Next.js 14 |
| Database | PostgreSQL (Neon) · 35+ models · 11 migrations |
| Signal providers | WattTime, Electricity Maps, Ember, EIA-930 |
| Caching | Redis · 15min / 1hr / 6hr TTLs |
3. Latency Analysis
| Path | Latency | Notes |
|---|---|---|
| Cache-hit path | ~10–25ms | Redis + scoring + response serialization |
| Cache-miss path | 8,000–15,000ms | External provider API call — should never occur on hot path |
| Hot path budget | 100ms p99 | Internal quality gate — enforced by middleware |
| Contract ceiling | 200ms p99 | Cross-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
| Variable | Required | Notes |
|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection string (Neon recommended) |
REDIS_URL | Yes | Redis connection string |
WATTTIME_USERNAME | Yes | WattTime API credentials |
WATTTIME_PASSWORD | Yes | WattTime API credentials |
EIA_API_KEY | Yes | EIA.gov developer API key |
ELECTRICITY_MAPS_API_KEY | No | Optional — enables flow-traced enrichment |
EMBER_API_KEY | No | Optional — enables Ember data pull |
JWT_SECRET | Yes | Auth token signing |
NEXT_PUBLIC_ENGINE_URL | Yes | Dashboard → Engine base URL |
7. Intelligence Endpoints
These endpoints must exist and return actual data (not placeholder responses):
| Endpoint | Purpose |
|---|---|
GET /api/v1/intelligence/grid/hero-metrics | Dashboard hero KPIs — carbon avoided, CRM, high confidence % |
GET /api/v1/intelligence/grid/summary | Regional grid status overview |
GET /api/v1/intelligence/grid/opportunities | Carbon opportunity windows by region |
GET /api/v1/intelligence/grid/region/:region | Single-region deep dive with signal state |
GET /api/v1/intelligence/grid/import-leakage | Import carbon leakage scores by BA |
GET /api/v1/intelligence/grid/audit/:region | Signal 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)