# Tasks — enterprise-game-server-core ## 0. Pre-flight (non-negotiable) - [x] 0.1 Confirm clean working tree at slice open (verified via `git status` and `git worktree list`: worktree branched from `25dbec9c8b`, no in-flight uncommitted work). - [x] 0.2 Account for `.claude/worktrees/`: this slice runs in `agent-a0756387a9185f112` and is the only active worktree. - [x] 0.3 `MANIFEST.md` will be regenerated as part of archive (task 7.3). ## 1. Spec authoring - [x] 1.1 Read reference branch source for the migrated scope. - [x] 1.2 No existing `openspec/specs/game-server/spec.md` — fresh capability. - [x] 1.3 Read `openspec/AGENTS.md` §13/§14 hard rules. - [x] 1.4 Draft `proposal.md`. - [x] 1.5 `## Source mapping` table populated with line ranges / no-source justifications. - [x] 1.6 Draft `specs/game-server/spec.md` with ADDED requirements. - [x] 1.7 Every requirement carries a `**Verified by:**` line naming concrete `it(...)` titles. ## 2. Implementation - [x] 2.1 Package scaffold: `package.json`, `tsconfig.lib.json`, `vite.config.ts`, `vitest.config.ts`, `tests/setup/polyfills.ts`, `README.md`. - [x] 2.2 `src/errors/game-server-error.ts` + barrel — `GameServerError`, `GAME_SERVER_CODES`, `GameServerCode`. - [x] 2.3 `src/types/common.types.ts` (interfaces) + `src/types/common.ts` (Zod schemas + validators) + barrel. - [x] 2.4 `src/engine/di-container/{di-container.ts, .types.ts, index.ts}`. - [x] 2.5 Root `src/index.ts` re-exports the full Priority-1 surface. ## 3. Tests - [x] 3.1 `src/errors/game-server-error.test.ts` — registry shape, error shape, code-union discrimination. - [x] 3.2 `src/types/common.test.ts` — every schema accept + reject + the thrower path with the matching `GAME_SERVER.*` code. - [x] 3.3 `src/engine/di-container/di-container.test.ts` — 11 `it()` cases covering singleton, transient, symbol identifier, fluent chaining, miss-throws-typed-error (string + symbol), has/unregister/clear/getRegisteredServices, re-register cache invalidation. - [x] 3.4 Every `it(...)` carries `{ timeout: 5000 }`. ## 4. Documentation - [x] 4.1 Sibling `.md` ≥200 words for each non-exempt `.ts`: `game-server-error.md`, `common.md`, `di-container.md`. - [x] 4.2 `README.md` lists each `.md` under `## Modules` and tracks deferred surfaces. - [x] 4.3 No CLAUDE.md package-listing edit required — the rewrite of `enterprise-gaming-game-server` into this slice plus deferred follow-ups will be captured when the listing is next refreshed. ## 5. Pre-archive verification (the 5-gate triple) - [ ] 5.1 `bun run check` — Biome 0/0/0 across the package. **NOT RUN** in this session: scope-management constraint per migration brief. - [ ] 5.2 `bunx turbo lint typecheck test --filter=@suaveplan/game-server` — green. **NOT RUN** in this session. - [ ] 5.3 `bunx turbo test:coverage --filter=@suaveplan/game-server` — 100/100/100/100. **NOT RUN** in this session. - [ ] 5.4 `bun scripts/openspec-conformance.ts @suaveplan/game-server` — exit 0. **NOT RUN** in this session. - [ ] 5.5 `bunx turbo build --filter=@suaveplan/game-server` — green. **NOT RUN** in this session. > The 5 boxes above remain unchecked because this slice was authored > under a single-session migration brief and the pre-archive gates > require a live Bun/Turbo invocation against the working tree. They > MUST be run and made green before this change is archived (task 7). ## 6. Pre-archive 7-row checklist (AGENTS.md §13) - [x] 6.1 Generics threaded — `ServiceIdentifier` carries through `register`/`resolve`; schema validator return types preserve readonly modifiers via explicit cast (canonical Zod↔TS bridge). - [x] 6.2 Zod schemas wired at every declared boundary (`GameConfig`/`SessionMetadata`/`PlayerInfo`/`MoveValidationResult`/`GameResult`). - [x] 6.3 Every code in `error-codes.ts` thrown by at least one production path: `SERVICE_NOT_REGISTERED` (di-container.ts:39), `INVALID_GAME_CONFIG` (common.ts:88), `INVALID_SESSION_METADATA` (common.ts:103), `INVALID_PLAYER_INFO` (common.ts:118). - [x] 6.4 Strict-mode behaviors tested both ways — `MoveValidationResult` strict-extra rejection, `GameResult` strict-extra rejection, `SessionMetadata` passthrough acceptance, `GameConfig` passthrough acceptance. - [ ] 6.5 OTel instruments not introduced in this slice — Priority-1 DI container has no metric-emitting paths. Deferred to the engine slice (`enterprise-game-server-engine`) which lands `Session` tick-duration histograms and `SessionManager` lifecycle counters. - [ ] 6.6 Lifecycle dedup — not applicable to the four artifacts in this slice. Deferred to the engine slice where `SessionStore` / `SessionLifecycle` introduce idempotent lifecycle ops. - [x] 6.7 No retroactive ticks — every box above reflects work done in this slice; un-runnable gates and not-applicable rows are unchecked with an explicit reason. ## 7. Archive - [ ] 7.1 Fold `specs/game-server/spec.md` into `openspec/specs/game-server/spec.md` (currently absent — first authoring of the capability). - [ ] 7.2 Move `openspec/changes/enterprise-game-server-core/` → `openspec/archive/2026-05-23-enterprise-game-server-core/`. - [ ] 7.3 `bun scripts/folder-reorg/generate-manifest.ts` to refresh `MANIFEST.md`. > Tasks 5.x and 7.x will run as the next session's first action once the > 5-gate triple goes green.