# Tasks — enterprise-control-surface-schema ## 0. Pre-flight (non-negotiable) - [x] 0.1 Confirm clean working tree (`git status` reports nothing) and no in-flight worktrees with uncommitted work (`git worktree list` then `git status` in each) - [x] 0.2 Account for every `.claude/worktrees/*` entry; prune stale ones via `bun scripts/worktree-prune.ts --remove`. - [x] 0.3 Confirm `MANIFEST.md` matches `find packages -maxdepth 3 -name package.json | wc -l`. ## 1. Spec authoring - [x] 1.1 Draft `proposal.md`, `tasks.md`, `specs/control-surface-schema/spec.md` ## 2. Implementation - [x] 2.1 `src/error-codes.ts` — `CONTROL_SURFACE_SCHEMA.*` via `defineCodes` - [x] 2.2 `src/types/transform.types.ts` — `Transform`, `Vec3`, `Vec2` - [x] 2.3 `src/types/binding.types.ts` — `Binding` discriminated union (6 variants) - [x] 2.4 `src/types/range.types.ts`, `behaviour.types.ts`, `appearance.types.ts`, `action.types.ts` - [x] 2.5 `src/types/control-kind.types.ts` — 18-variant `ControlKind` enum - [x] 2.6 `src/types/control-node.types.ts` — `ControlNode` = `Group | Control` discriminated union - [x] 2.7 `src/types/group-layout.types.ts` — 4-variant `GroupLayout` - [x] 2.8 `src/types/control-surface.types.ts` — `ControlSurface` root - [x] 2.9 `src/schemas/control-surface-schema.ts` — Zod schemas mirroring every type - [x] 2.10 `src/validate/validate.ts` — `validateSurface(unknown)` returning typed result union - [x] 2.11 `src/upgrade/upgrade.ts` + `migrations/` — `upgradeSurface(unknown)`, chained migrations, registry pattern - [x] 2.12 `src/walk/walk.ts` — DFS visitor with parent-stack - [x] 2.13 `src/identity/identity.ts` — uuid generation, duplicate-id detection, binding-reference cross-check - [x] 2.14 `src/constants.ts` — `CURRENT_SCHEMA_VERSION` ## 3. Tests - [x] 3.1 Per-feature `.test.ts` covering every scenario in `spec.md` - [x] 3.2 `tests/round-trip.test.ts` — JSON serialise → validate → walk → re-serialise; deep-equal - [x] 3.3 `tests/property.test.ts` — fast-check generators for every node type; validator accepts only well-formed documents - [x] 3.4 `tests/upgrade.test.ts` — registered migrations apply in order; unknown version surfaces typed error - [x] 3.5 Every `it(...)` has `{ timeout: 5000 }` ## 4. Documentation - [x] 4.1 Sibling `.md` per `.ts` (≥200 words, basic + advanced examples) - [x] 4.2 README with `## Surface document shape` reference + 4 worked examples (4-pad drum machine, 8-channel mixer, piano keyboard, Traktor-style DJ surface) ## 5. Pre-archive verification - [x] 5.1 `bunx turbo lint typecheck test --filter=@suaveplan/control-surface-schema` — green - [x] 5.2 `bunx turbo test:coverage --filter=@suaveplan/control-surface-schema` — 100/100/100/100 - [x] 5.3 `bunx turbo build --filter=@suaveplan/control-surface-schema` — green ## 6. Archive - [x] 6.1 Fold spec delta → `openspec/specs/control-surface-schema/spec.md` - [x] 6.2 Move folder → `openspec/archive/-enterprise-control-surface-schema/` - [x] 6.3 Refresh `MANIFEST.md` - [x] 6.4 Prune worktree