Files
suaveplan/openspec/changes/enterprise-game-server-core/tasks.md
2026-05-27 23:29:53 +01:00

5.5 KiB

Tasks — enterprise-game-server-core

0. Pre-flight (non-negotiable)

  • 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).
  • 0.2 Account for .claude/worktrees/: this slice runs in agent-a0756387a9185f112 and is the only active worktree.
  • 0.3 MANIFEST.md will be regenerated as part of archive (task 7.3).

1. Spec authoring

  • 1.1 Read reference branch source for the migrated scope.
  • 1.2 No existing openspec/specs/game-server/spec.md — fresh capability.
  • 1.3 Read openspec/AGENTS.md §13/§14 hard rules.
  • 1.4 Draft proposal.md.
  • 1.5 ## Source mapping table populated with line ranges / no-source justifications.
  • 1.6 Draft specs/game-server/spec.md with ADDED requirements.
  • 1.7 Every requirement carries a **Verified by:** line naming concrete it(...) titles.

2. Implementation

  • 2.1 Package scaffold: package.json, tsconfig.lib.json, vite.config.ts, vitest.config.ts, tests/setup/polyfills.ts, README.md.
  • 2.2 src/errors/game-server-error.ts + barrel — GameServerError, GAME_SERVER_CODES, GameServerCode.
  • 2.3 src/types/common.types.ts (interfaces) + src/types/common.ts (Zod schemas + validators) + barrel.
  • 2.4 src/engine/di-container/{di-container.ts, .types.ts, index.ts}.
  • 2.5 Root src/index.ts re-exports the full Priority-1 surface.

3. Tests

  • 3.1 src/errors/game-server-error.test.ts — registry shape, error shape, code-union discrimination.
  • 3.2 src/types/common.test.ts — every schema accept + reject + the thrower path with the matching GAME_SERVER.* code.
  • 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.
  • 3.4 Every it(...) carries { timeout: 5000 }.

4. Documentation

  • 4.1 Sibling .md ≥200 words for each non-exempt .ts: game-server-error.md, common.md, di-container.md.
  • 4.2 README.md lists each .md under ## Modules and tracks deferred surfaces.
  • 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)

  • 6.1 Generics threaded — ServiceIdentifier<T> carries through register/resolve; schema validator return types preserve readonly modifiers via explicit cast (canonical Zod↔TS bridge).
  • 6.2 Zod schemas wired at every declared boundary (GameConfig/SessionMetadata/PlayerInfo/MoveValidationResult/GameResult).
  • 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).
  • 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.
  • 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.