# Tasks — network-bootstrap ## Phase 1: Scaffold - [ ] 1.1 Create `packages/network/network-bootstrap/` with standard package layout (per CLAUDE.md feature-module structure). - [ ] 1.2 Author `package.json` at `0.1.0`, `"sideEffects": false`, subpath exports per feature module. - [ ] 1.3 Wire `tsconfig.json` / `tsconfig.lib.json` / `vite.config.ts` / `vitest.config.ts` via `createTestConfig()`. - [ ] 1.4 Add `tests/dep-graph.test.ts` asserting no cycles. ## Phase 2: Port types + errors - [ ] 2.1 Port `bootstrap.types.ts` → `src/types/types.ts` + sibling `.md` doc. - [ ] 2.2 `defineCodes("NET_BOOTSTRAP", [...])` registry: `CHAIN_EXHAUSTED`, `CACHE_CORRUPTED`, `STRATEGY_TIMEOUT`, `INVALID_OPTIONS`. - [ ] 2.3 Zod schemas for every public option struct. ## Phase 3: Core - [ ] 3.1 Port `DiscoveryChain` with ordered execution + first-success fallthrough. - [ ] 3.2 Port `PeerCache` backed by `AbstractStorage` from `@suaveplan/storage`. - [ ] 3.3 Wire `@suaveplan/retry` for backoff between strategy attempts. - [ ] 3.4 Emit `bootstrap:started`/`:peer-found`/`:exhausted` on `NetworkBus`. - [ ] 3.5 Thread `AbortSignal` through every async path. ## Phase 4: Plugin + middleware - [ ] 4.1 Port `BootstrapPlugin` (`NetworkPlugin` impl). - [ ] 4.2 Port `BootstrapMiddleware` (runtime chain augmentation). - [ ] 4.3 Conformance test for `NetworkPlugin` lifecycle (install/start/stop/dispose idempotency). ## Phase 5: Observability - [ ] 5.1 OTel spans (`bootstrap.chain.execute`). - [ ] 5.2 Counters (`bootstrap.peers_found_total{strategy}`, `bootstrap.failures_total{strategy,code}`). - [ ] 5.3 Histograms (`bootstrap.chain_duration_ms`). ## Phase 6: Tests + docs - [ ] 6.1 Unit tests per feature module via `@suaveplan/testing/runner`. - [ ] 6.2 fast-check property tests: chain ordering, cache eviction, retry idempotency. - [ ] 6.3 100/100/100/100 coverage gate. - [ ] 6.4 Sibling `.md` doc per `.ts` impl file (`docs:check` green). - [ ] 6.5 Root `README.md` with basic + advanced examples. ## Phase 7: Verification - [ ] 7.1 `bunx turbo lint typecheck test --filter=@suaveplan/network-bootstrap` green. - [ ] 7.2 `bunx turbo test:coverage --filter=@suaveplan/network-bootstrap` 100/100/100/100. - [ ] 7.3 `bun run docs:check --filter=@suaveplan/network-bootstrap` green. - [ ] 7.4 `bun scripts/folder-reorg/generate-manifest.ts` updates `MANIFEST.md`. - [ ] 7.5 `STATUS.md` row flipped from `–` to `✅`. ## Pre-archive checklist - [ ] Row 1 — Verified by: Phase 7 gates all green. - [ ] Row 2 — Verified by: Parity checklist in `proposal.md` has zero unresolved 🚫. - [ ] Row 3 — Verified by: `openspec/specs/network-bootstrap/spec.md` written with `## ADDED Requirements`. - [ ] Row 4 — Verified by: Folder moved to `openspec/archive/-network-bootstrap/`.