75 lines
3.1 KiB
Markdown
75 lines
3.1 KiB
Markdown
# Tasks: Wave B-5b game-server performance
|
|
|
|
## 0. Pre-flight
|
|
|
|
- [x] `pwd && git worktree list && git status` — confirm isolated worktree.
|
|
- [x] Confirm worktree HEAD is descended from genesis tip.
|
|
- [x] Read `CLAUDE.md`, `openspec/AGENTS.md`, existing `src/core`, `src/errors`, `src/types`.
|
|
- [x] Read upstream reference:
|
|
`/mnt/s/web/suaveplan/packages/universal/game-server/src/performance/{ObjectPool,SessionPool,NetworkTierAdapter}.ts`.
|
|
|
|
## 1. Error registry
|
|
|
|
- [x] Append six performance codes to `GAME_SERVER_CODES`
|
|
(`POOL_EXHAUSTED`, `POOL_DISPOSED`, `RELEASE_FOREIGN_OBJECT`,
|
|
`INVALID_POOL_CONFIG`, `INVALID_TIER_CONFIG`, `UNKNOWN_TIER`).
|
|
- [x] Extend `game-server-error.test.ts` with assertions on the new codes.
|
|
- [x] Update `game-server-error.md` to enumerate the new codes.
|
|
|
|
## 2. `object-pool`
|
|
|
|
- [x] `object-pool.types.ts` — `ObjectPoolConfig`, `PoolStats`, Zod
|
|
numeric config schema.
|
|
- [x] `object-pool.ts` — generic typed pool with
|
|
`acquire`/`release`/`withObject`/`getStats`/`clear`/`dispose`, two
|
|
OTel counters, typed-error boundary, pre-allocation gate.
|
|
- [x] `object-pool.test.ts` — 100% coverage incl. cap rejection +
|
|
foreign-release rejection + dispose lockout.
|
|
- [x] `object-pool.md` — six sections, ≥200 words.
|
|
- [x] `index.ts` barrel.
|
|
|
|
## 3. `session-pool`
|
|
|
|
- [x] `session-pool.types.ts` — `PooledSession`, `PooledSessionData`,
|
|
`SessionPoolConfig`.
|
|
- [x] `session-pool.ts` — typed wrapper over `ObjectPool` with
|
|
`acquireSession`/`releaseSession`/`withSession`, injectable `Clock`,
|
|
default session-type configurable.
|
|
- [x] `session-pool.test.ts` — 100% coverage incl. reset path +
|
|
injected clock + auto-release on throw.
|
|
- [x] `session-pool.md` — six sections, ≥200 words.
|
|
- [x] `index.ts` barrel.
|
|
|
|
## 4. `network-tier-adapter`
|
|
|
|
- [x] `network-tier-adapter.types.ts` — `NetworkTier`,
|
|
`NodeCapabilities`, `LoadBalancingRecommendation`,
|
|
`NetworkTierAdapterStats`, Zod schemas, listener typedef.
|
|
- [x] `network-tier-adapter.ts` —
|
|
`registerNodeCapabilities`/`getTierForNodeType`/`getTierByIndex`/
|
|
`getOptimalTier`/`getLoadBalancingRecommendations`/
|
|
`validateTierCapacity`/`getMaxChildren`/`getStats`/`clear`, one OTel
|
|
counter, typed-error boundary, optional `onCapabilityUpdated`
|
|
listener.
|
|
- [x] `network-tier-adapter.test.ts` — 100% coverage incl. invalid
|
|
tier list + duplicate tier index + score-bucket fallbacks.
|
|
- [x] `network-tier-adapter.md` — six sections, ≥200 words.
|
|
- [x] `index.ts` barrel.
|
|
|
|
## 5. Wiring
|
|
|
|
- [x] Re-export every public surface from `src/index.ts`.
|
|
- [x] Add subpath exports to `package.json` for each module.
|
|
|
|
## 6. Verification
|
|
|
|
- [x] `bunx turbo lint typecheck test --filter=@suaveplan/game-server` green.
|
|
- [x] `bunx turbo test:coverage --filter=@suaveplan/game-server` =
|
|
100/100/100/100.
|
|
- [x] `grep -rnE "from ['\"](vitest|bun:test)['\"]" packages/gaming/games/game-server/src/`
|
|
→ zero output.
|
|
- [x] `grep -rn "biome-ignore|TODO|FIXME|XXX"
|
|
packages/gaming/games/game-server/src/performance` → zero output.
|
|
- [x] All source files ≤300 lines; all test files ≤500 lines.
|
|
- [x] `bun run docs:check` reports 100% coverage.
|