# Tasks — game-server plugins (Wave C-1) ## 0. Pre-flight (non-negotiable) - [x] 0.1 Confirm clean working tree; only this worktree open - [x] 0.2 Account for sibling worktrees (none beyond this one) - [x] 0.3 Confirm `MANIFEST.md` package set matches `find packages -maxdepth 3 -name package.json` - [x] 0.4 §0a Sync — fast-forwarded worktree to current `genesis` HEAD (orchestrator-supplied SHA predates current merges; verified ancestry via `git log`) ## 1. Spec authoring - [x] 1.1 Read upstream `BasePlugin.ts` + 7 concrete plugins under `/mnt/s/web/suaveplan/packages/universal/game-server/src/plugins/` - [x] 1.2 Read existing `openspec/specs/game-server/spec.md` - [x] 1.3 Read `openspec/AGENTS.md` rules 7, 10, 11 - [x] 1.4 Draft `proposal.md` - [x] 1.5 Source mapping table with upstream line ranges - [x] 1.6 Draft `specs/game-server/spec.md` with `## ADDED Requirements` - [x] 1.7 Every requirement carries `**Verified by:**` ## 2. Implementation - [x] 2.1 `BasePlugin` abstract class + lifecycle state machine - [x] 2.2 `ABTestPlugin` — weighted bucketing with seeded `Rng` - [x] 2.3 `AnalyticsPlugin` — emitter subscription + structured sink - [x] 2.4 `FeatureFlagPlugin` — `FlagManager` adapter + evaluation log - [x] 2.5 `LoggingPlugin` — emitter forwarding + ring buffer - [x] 2.6 `PersistencePlugin` — `StorageLike` save/load + Zod-validated decode - [x] 2.7 `RulesPlugin` — `RuleEngine` adapter + history - [x] 2.8 `WorkflowPlugin` — registry + execute/cancel + history - [x] 2.9 Error-code registry extended with nine plugin codes - [x] 2.10 `package.json` deps + subpath exports ## 3. Tests - [x] 3.1 Unit tests per plugin (`*.test.ts`) covering every public method + lifecycle - [x] 3.2 100% statement/branch/function/line coverage on touched modules - [x] 3.3 Every `it(...)` carries `{ timeout: 5000 }` ## 4. Documentation - [x] 4.1 Sibling `.md` for every implementation file (≥200 words, basic + advanced, full API) ## 5. Pre-archive verification - [ ] 5.1 `bun run check` — clean - [ ] 5.2 `bunx turbo lint typecheck test --filter=@suaveplan/game-server` — green - [ ] 5.3 `bunx turbo test:coverage --filter=@suaveplan/game-server` — 100/100/100/100 - [ ] 5.4 Build green ## 6. Pre-archive 7-row checklist - [x] 6.1 Generics threaded — `WorkflowEngine` and `RuleContext` exposed type-safely - [x] 6.2 Zod schemas wired at construction-time boundaries (`AnalyticsPlugin`, `ABTestPlugin.createExperiment`, `LoggingPlugin`, `PersistencePlugin.load`, `RulesPlugin`) - [x] 6.3 Every new error code thrown by at least one production path - [x] 6.4 Lifecycle-state behaviours tested (assertLive guards after destroy) - [x] 6.5 OTel `recordPluginLifecycle` integration unchanged — covered by existing plugin-manager tests - [x] 6.6 Lifecycle dedup tested (BasePlugin re-install after destroy rejected) - [x] 6.7 No retroactive ticks ## 7. Archive - [ ] 7.1 Fold delta into `openspec/specs/game-server/spec.md` (orchestrator task) - [ ] 7.2 Archive folder rename (orchestrator task)