# @gaia/forecast-serving

Operational **forecast serving, warehouse, alerting, integration, and the data
flywheel** for Phase 175 (TypeScript). Framework-agnostic, dependency-light,
fully unit-tested.

| Module         | Phase        | Contents                                                                                                                                                 |
| -------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `schema`       | 175.1.3.1    | Canonical `WeatherSample` **Zod** schema (mirror of the Python dataclass) + grid-aligned Zarr chunking.                                                  |
| `skill`        | —            | Latitude-weighted RMSE / MAE / bias / anomaly-correlation.                                                                                               |
| `serving`      | 175.8.1.1    | BFF handlers for the 5 forecast endpoints, per-tenant token-bucket rate limiter, HMAC-signed GRIB/Zarr URLs, OpenAPI 3.1 doc.                            |
| `cycle-runner` | 175.8.1.2    | Operational cycle state machine (00/06/12/18 UTC): fetch IC → forecast → stability-gate → publish or roll back.                                          |
| `warehouse`    | 175.8.1.3    | STAC 1.0 items/collections + OGC EDR position queries (CoverageJSON).                                                                                    |
| `cap`          | 175.8.1.4    | CAP 1.2 alert XML with the `urn:oid:2.49.0.1.840.1` profile, wired to emergency/shell-routines sinks.                                                    |
| `slo`          | 175.8.1.5    | p95 cycle latency / RMSE-tolerance / availability SLO evaluation + Grafana dashboard model.                                                              |
| `integration`  | 175.8.2.1–4  | Agriculture (GDD/water-balance/planting/yield-lift), drone-fleet safety gating, renewable-energy potential (PV/turbine-curve/hydro), outdoor-event risk. |
| `flywheel`     | 175.9.1.1/.4 | Weather-outcomes collector (difficulty weighting + retraining trigger) and per-station observational-feedback residuals.                                 |
| `benchmark`    | 175.9.1.2/.3 | WeatherBench-2 scorecard/leaderboard + red-team stress-test promotion gate.                                                                              |

Task 175.9.1.5 (publish a paper + open-weights release) is an external act and
is **not** locally actionable.

```bash
vitest run --root libs/gaia/forecast-serving   # 29 tests
```
