Files
2026-05-27 23:29:53 +01:00

4.8 KiB

Tasks — enterprise-ecs

Every checkbox MUST reflect work actually done in this change. Retroactive ticking is forbidden (openspec/AGENTS.md §13).

1. Spec authoring

  • 1.1 Read ../suaveplan/enterprise/ecs.md end-to-end
  • 1.2 Confirm openspec/specs/ecs/spec.md does not yet exist (fresh capability)
  • 1.3 Read openspec/AGENTS.md §13 + §14
  • 1.4 Draft proposal.md from openspec/templates/proposal.md
  • 1.5 Fill ## Source mapping — every requirement cites a line range or is in the "no source line" table
  • 1.6 Draft specs/ecs/spec.md from openspec/templates/spec-delta.md
  • 1.7 Every requirement carries a **Verified by:** line naming concrete it(...) titles

2. Implementation

  • 2.1 packages/games/ecs/package.json — @suaveplan/ecs@0.1.0, sideEffects: false, deps @suaveplan/error, @suaveplan/types, @suaveplan/events, @suaveplan/opentelemetry, tslib, zod
  • 2.2 tsconfig.lib.json + vite.config.ts + vitest.config.ts + tests/setup/polyfills.ts
  • 2.3 src/errors/ecs-error.ts — EcsError extends SuaveplanError + ECS_CODES registry
  • 2.4 src/types/ecs.types.ts — Entity, ComponentId, ComponentSchema<T>, ArchetypeId, QueryDescriptor, SystemDefinition, SystemPhase, SystemContext, SystemExecuteFn, WorldApi, WorldEventMap, EntitySnapshot, WorldSnapshot
  • 2.5 src/bitset/bitset.ts — Uint32Array-backed BitSet with operators and iterator
  • 2.6 src/component-registry/component-registry.ts
  • 2.7 src/entity-pool/entity-pool.ts
  • 2.8 src/archetype/archetype.ts
  • 2.9 src/query/query.ts + defineQuery
  • 2.10 src/system/system.ts + defineSystem + SystemScheduler
  • 2.11 src/schema/schema.ts — defineComponent with optional Zod validator
  • 2.12 src/world/world.ts — createWorld, World class, OTel spans/counters/histogram, EventBus events
  • 2.13 src/observability/otel.ts — counter/histogram/span helpers
  • 2.14 src/schemas/*.ts — Zod schemas for WorldSnapshot, QueryDescriptor, WorldConfig, ComponentDescriptor
  • 2.15 src/index.ts — explicit-named barrel (no export *)
  • 2.16 Per-feature index.ts barrels with explicit named re-exports

3. Tests

  • 3.1 src/bitset/bitset.test.ts + src/bitset/bitset.spec-conformance.test.ts
  • 3.2 src/component-registry/component-registry.test.ts
  • 3.3 src/entity-pool/entity-pool.test.ts
  • 3.4 src/archetype/archetype.test.ts
  • 3.5 src/query/query.test.ts
  • 3.6 src/system/system.test.ts
  • 3.7 src/schema/schema.test.ts
  • 3.8 src/world/world.test.ts + src/world/world.spec-conformance.test.ts
  • 3.9 src/errors/ecs-error.test.ts
  • 3.10 tests/property.test.ts (fast-check)
  • 3.11 tests/purity.test.ts (dist grep guard)
  • 3.12 tests/dep-graph.test.ts (runtime dep allowlist)
  • 3.13 Every it(...) carries { timeout: 5000 } (30000 for genuinely async)
  • 3.14 All test files import runner primitives from @suaveplan/testing/runner

4. Documentation

  • 4.1 Sibling .md for every implementation .ts (≥200 words, basic + advanced examples, API reference)
  • 4.2 README.md linking every co-located .md under ## Modules
  • 4.3 Update CLAUDE.md package listing to add ecs under a ### Games (universal-tier) section

5. Pre-archive 5-gate triple

  • 5.1 bun run check — Biome 0/0/0 across monorepo
  • 5.2 bunx turbo lint typecheck test --filter=@suaveplan/ecs — green
  • 5.3 bunx turbo test:coverage --filter=@suaveplan/ecs — 100/100/100/100
  • 5.4 bun scripts/openspec-conformance.ts @suaveplan/ecs — exit 0
  • 5.5 bunx turbo build --filter=@suaveplan/ecs — green

6. Pre-archive checklist (AGENTS.md §13)

  • 6.1 Generics threaded; expectTypeOf on every literal-type claim
  • 6.2 Zod schemas wired at every declared boundary (component validators, snapshot restore, query options)
  • 6.3 Every ECS.* code thrown by ≥1 production path
  • 6.4 OTel instruments emitted from production paths; asserted with a real in-memory MeterProvider
  • 6.5 Lifecycle dedup tested (idempotent registerComponent, addComponent no-op on existing component)
  • 6.6 No export * in any feature-module barrel
  • 6.7 No direct vitest / bun:test imports in test files (CLAUDE.md rule 11)
  • 6.8 No retroactive ticking — every box reflects work done in this change

7. Archive

  • 7.1 Fold spec delta into openspec/specs/ecs/spec.md
  • 7.2 Archive superseded openspec/changes/enterprise-gaming-ecs/ → openspec/archive/2026-05-19-enterprise-gaming-ecs/ with a SUPERSEDED.md note pointing at this change
  • 7.3 Move openspec/changes/enterprise-ecs/ → openspec/archive/2026-05-19-enterprise-ecs/
  • 7.4 Refresh MANIFEST.md via bun scripts/folder-reorg/generate-manifest.ts