4.3 KiB
4.3 KiB
Tasks: enterprise-dmx
Change ID: enterprise-dmx
Package: @suaveplan/dmx
Target path: universal/media/dmx
Prerequisite packages on Verdaccio: @suaveplan/error, @suaveplan/types, @suaveplan/events
0. Pre-flight (non-negotiable)
- 0.1 Confirm clean working tree (
git statusreports nothing) and no in-flight worktrees with uncommitted work (git worktree listthengit statusin each) - 0.2 If any worktrees exist under
.claude/worktrees/, account for each one: still-active agent, work-pending-merge, or stale-and-prune. Stale worktrees MUST be removed (git worktree remove) before opening a new one — code that has been lost twice on main is the failure mode this guards against. - 0.3 Confirm the package set in
MANIFEST.mdmatchesfind packages -maxdepth 3 -name package.jsoncount. Drift here means a prior change archived without regenerating the manifest.
1. Scaffold
- Create directory
universal/media/dmx/withsrc/,tests/,src/__benchmarks__/, and all feature subdirectories per the layout inproposal.md. - Write
package.jsonat version0.1.0with"type": "module","sideEffects": false, fullexportsmap, deps:@suaveplan/error workspace:^,@suaveplan/types workspace:^,@suaveplan/events workspace:^,zod catalog:forms,@opentelemetry/api catalog:observability. - Write
tsconfig.jsonextending@suaveplan/typescript-config/library.json. - Write
vitest.config.tsusingcreateTestConfig()from@suaveplan/testing/config. - Add
lint,typecheck,test,test:coverage,build,docs:checkscripts.
2. Types + errors
- Write
src/types/common.ts— all interfaces and type aliases from proposal. - Write
src/types/common.md. - Write
src/error-codes.ts—DmxErrorCode,DMX_ERROR_METADATA,registerDmxErrorCodes(). - Write Zod schemas:
FixtureDefinitionSchema,FixtureInstanceSchema,SceneSchema,FadeOptionsSchema,DmxEngineOptionsSchema,CueStepSchema. - Write
src/constants/index.ts—DMX_UNIVERSE_SIZE = 512,DMX_MIN_VALUE = 0,DMX_MAX_VALUE = 255.
3. NullTransport
- Implement
NullTransport implements DmxTransport— captures allsendcalls in acalls: Array<{universe: Uint8Array; universeId: string}>array; exposesreset(). - Write
null-transport.test.tsandnull-transport.md.
4. Interpolation utilities
- Implement
interpolate(from, to, t): DmxValue— four easing functions (linear, ease-in, ease-out, ease-in-out). Clamp result to [0, 255]. - Implement
buildScene(id, values): Scene. - Write
interpolate.test.ts,interpolate.md,scene.test.ts,scene.md.
5. DmxEngine
- Implement
DmxEngine: universe management, fixture registry with address-conflict detection,setChannel/getChannel,getUniverse,applyScenewith fade interpolation (uses injectableClockfor frame timing),blackout,start/stoprender loop. - Wire OTel: counter
dmx.frame_total, histogramdmx.frame_render_ms, counterdmx.scene_apply_total. - Write
dmx-engine.test.ts(≤500 lines): universe CRUD, fixture conflict detection, scene apply, blackout, fade end-state, abort on stop. - Write
dmx-engine.md.
6. ChaseSequencer
- Implement
ChaseSequencer— step list,start(looping),stop,jumpToStep; uses injectableClock; emits step events via@suaveplan/events. - Write
chase-sequencer.test.ts(≤500 lines): step progression, loop restart, manual jump, stop mid-sequence. - Write
chase-sequencer.md.
7. Benchmarks
- Write
src/__benchmarks__/dmx.bench.ts— single-universe 512-channel render loop, 8-fixture scene apply.
8. Tests
- Write
tests/integration.test.ts— engine + sequencer end-to-end with NullTransport. - Write
tests/property.test.ts(fast-check) — channel value clamping, fade interpolation monotonicity, scene round-trip.
9. Docs + verify + publish
- All co-located
.mdfiles (≥200 words each). - Write
README.mdat package root. bunx turbo lint typecheck test --filter=@suaveplan/dmx— green.bunx turbo test:coverage --filter=@suaveplan/dmx— 100%.bun scripts/publish.ts --package @suaveplan/dmx.- Archive to
openspec/archive/2026-04-24-enterprise-dmx/.