75 lines
3.5 KiB
Markdown
75 lines
3.5 KiB
Markdown
# Tasks — `@suaveplan/api-ws`
|
|
|
|
> Every checkbox MUST reflect work actually done in this change.
|
|
|
|
## 0. Pre-flight (non-negotiable)
|
|
|
|
- [x] 0.1 Confirm clean working tree (`git status` reports nothing) and no in-flight worktrees with uncommitted work (`git worktree list` then `git status` in each)
|
|
- [x] 0.2 If any worktrees exist under `.claude/worktrees/`, account for each one: still-active agent, work-pending-merge, or stale-and-prune. Stale worktrees MUST be removed (`git worktree remove`) before opening a new one — code that has been lost twice on main is the failure mode this guards against.
|
|
- [x] 0.3 Confirm the package set in `MANIFEST.md` matches `find packages -maxdepth 3 -name package.json` count. Drift here means a prior change archived without regenerating the manifest.
|
|
|
|
## 1. Spec authoring
|
|
|
|
- [x] 1.1 Read design doc §11.1 (lifecycle), §11.2 (bus), §11.3 (multi-host), §11.4 (backpressure/heartbeat), §11.5 (reconnect), §11.8 (worker tier)
|
|
- [x] 1.2 Read `openspec/specs/api-ws/spec.md` (does not exist yet)
|
|
- [x] 1.3 Read `openspec/AGENTS.md` Sections 13, 14
|
|
- [x] 1.4 Draft `proposal.md`
|
|
- [x] 1.5 Source-mapping table
|
|
- [x] 1.6 Draft `specs/api-ws/spec.md`
|
|
- [x] 1.7 `**Verified by:**` line on every requirement
|
|
|
|
## 2. Implementation
|
|
|
|
- [x] 2.1 Scaffold `packages/api/api-ws/` (`"version": "0.1.0"`, `"sideEffects": false`, deps: `@suaveplan/api-types`, `@suaveplan/error`, `@suaveplan/types`, `zod`)
|
|
- [x] 2.2 `src/connection/` — `WsConnection` interface
|
|
- [x] 2.3 `src/connection-registry/` — `ConnectionRegistry`
|
|
- [x] 2.4 `src/subscription-bus/` — `SubscriptionBus` + cross-tenant gate
|
|
- [x] 2.5 `src/broker/` — `WsBroker`
|
|
- [x] 2.6 `src/envelope/` — Zod schema (always `import z from "zod"`)
|
|
- [x] 2.7 `src/backpressure/` — `BackpressurePolicy` (constants + helper)
|
|
- [x] 2.8 `src/heartbeat/` — `HeartbeatPolicy`
|
|
- [x] 2.9 `src/reconnect-token/` — `ReconnectToken` shape + HMAC verify helper
|
|
- [x] 2.10 `src/capability-id/` — augmentation file adding `"ws"` + `"ws.broadcast-cross-tenant"`
|
|
- [x] 2.11 `src/error-codes/` — `WS_CODES`
|
|
- [x] 2.12 `src/testing/` — `runWsEngineConformance(factory)`
|
|
- [x] 2.13 `src/index.ts` — explicit named re-exports
|
|
- [x] 2.14 `package.json` `exports` per subpath
|
|
|
|
## 3. Tests
|
|
|
|
- [x] 3.1 Unit tests per feature
|
|
- [x] 3.2 Spec-conformance type tests
|
|
- [x] 3.3 Property test on connection-registry multi-index lookup
|
|
- [x] 3.4 Every `it(...)` carries `{ timeout: 5000 }`
|
|
|
|
## 4. Documentation
|
|
|
|
- [x] 4.1 Sibling `.md` for every implementation `.ts`
|
|
- [x] 4.2 `README.md` linking every `.md`
|
|
- [x] 4.3 No CLAUDE.md update
|
|
|
|
## 5. Pre-archive verification
|
|
|
|
- [x] 5.1 `bun run check` — 0/0/0
|
|
- [x] 5.2 `bunx turbo lint typecheck test --filter=@suaveplan/api-ws` — green
|
|
- [x] 5.3 `bunx turbo test:coverage --filter=@suaveplan/api-ws` — 100/100/100/100
|
|
- [x] 5.4 `bun scripts/openspec-conformance.ts @suaveplan/api-ws` — exit 0
|
|
- [x] 5.5 `bunx turbo build --filter=@suaveplan/api-ws` — green
|
|
|
|
## 6. Pre-archive 7-row checklist
|
|
|
|
- [x] 6.1 Generics on `SubscriptionBus<Payload>`; `expectTypeOf` on every literal-type claim
|
|
- [x] 6.2 Zod wired at the envelope boundary
|
|
- [x] 6.3 Every `WS_CODES` entry thrown
|
|
- [x] 6.4 Backpressure / heartbeat strict-mode behaviors tested on / off
|
|
- [x] 6.5 OTel — N/A (engines emit)
|
|
- [x] 6.6 Lifecycle dedup — connection registration is idempotent; tested
|
|
- [x] 6.7 No retroactive tick
|
|
|
|
## 7. Archive
|
|
|
|
- [x] 7.1 Fold spec delta
|
|
- [x] 7.2 Move to `openspec/archive/<yyyy-mm-dd>-api-ws/`
|
|
- [x] 7.3 Tick umbrella `1.5`
|
|
- [x] 7.4 Refresh `MANIFEST.md`
|