# Tasks — network-transport-standby ## Phase 1: Scaffold - [ ] 1.1 Create `packages/network/network-transport-standby/` with feature-module layout. - [ ] 1.2 `package.json` at `0.1.0`, `"sideEffects": false`, subpath exports per module. - [ ] 1.3 Test config via `createTestConfig()`; `tests/dep-graph.test.ts`. ## Phase 2: Types + errors - [ ] 2.1 Port `types/` → `src/types/` + sibling `.md`. - [ ] 2.2 `defineCodes("NET_STANDBY", [...])`: `POOL_EXHAUSTED`, `SLOT_UNHEALTHY`, `PROMOTION_FAILED`, `INVALID_OPTIONS`. - [ ] 2.3 Zod schemas for `StandbyPoolConfig`, `ConnectionRequest`, `ConnectionState`. ## Phase 3: Core pool - [ ] 3.1 Port pool engine (min/max slots, eviction policy). - [ ] 3.2 Port warm-up scheduler over `@suaveplan/timing` + injectable `Clock`. - [ ] 3.3 Replace ad-hoc reconnect loop with `@suaveplan/retry` exponential-backoff policy. ## Phase 4: Health subsystem - [ ] 4.1 Port per-slot health scoring (EMA RTT + jitter + loss composite). - [ ] 4.2 Port auto-reconnect FSM. - [ ] 4.3 Wire to `network-transport-webrtc`'s ping primitives. ## Phase 5: Transport + plugin - [ ] 5.1 Port `StandbyTransport implements Transport`. - [ ] 5.2 Author `StandbyPlugin implements NetworkPlugin` mirroring `WebRTCPlugin`. - [ ] 5.3 Conformance test for `Transport` + `NetworkPlugin` contracts. ## Phase 6: Observability - [ ] 6.1 Gauge `standby.warm_slots`. - [ ] 6.2 Counters `standby.promotions_total{outcome}`, `standby.evictions_total{reason}`. - [ ] 6.3 Histogram `standby.warmup_duration_ms`. - [ ] 6.4 Bus emissions `transport:standby:warm`/`:promoted`/`:evicted`. ## Phase 7: Tests + docs - [ ] 7.1 Unit tests per module via `@suaveplan/testing/runner`. - [ ] 7.2 fast-check property tests: pool invariants (min ≤ active ≤ max), eviction fairness, promotion atomicity. - [ ] 7.3 100/100/100/100 coverage gate. - [ ] 7.4 Sibling `.md` per `.ts` impl file. - [ ] 7.5 Root `README.md`. ## Phase 8: Integration - [ ] 8.1 Cross-package test with `network-plugin-transport-manager`: standby warms 4 slots, manager promotes one to active in < 100 ms simulated. - [ ] 8.2 Failure-mode test: slot becomes unhealthy → evict → warm replacement. ## Phase 9: Verification - [ ] 9.1 `bunx turbo lint typecheck test --filter=@suaveplan/network-transport-standby` green. - [ ] 9.2 `bunx turbo test:coverage --filter=@suaveplan/network-transport-standby` 100/100/100/100. - [ ] 9.3 `bun run docs:check` green. - [ ] 9.4 `MANIFEST.md` regen. - [ ] 9.5 `STATUS.md` row flipped. ## Pre-archive checklist - [ ] Row 1 — Phase 9 green. - [ ] Row 2 — Parity 🚫 list empty. - [ ] Row 3 — `openspec/specs/network-transport-standby/spec.md` written. - [ ] Row 4 — Manager integration test passes. - [ ] Row 5 — Folder archived.