Skip to content

feat: fixtures & color patching - #262

Open
MD4 wants to merge 14 commits into
masterfrom
feat/fixtures-color-patching
Open

feat: fixtures & color patching#262
MD4 wants to merge 14 commits into
masterfrom
feat/fixtures-color-patching

Conversation

@MD4

@MD4 MD4 commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Description

Fixtures & color patching: patch lights instead of raw DMX channels, and program color directly.

Shows now hold fixtures (built-in profiles: Dimmer, RGB, RGBW, RGB+Dimmer, RGBW+Dimmer) placed at a start address, and the patch wires program outputs to fixture capabilities (color / dimmer / channel). A new COLOR program node composes a color in RGB or HSV (wireable inputs, live swatch preview) so one wire drives a whole RGB(W) fixture. The patch page becomes a fixture rack with add/edit dialogs, next-free-address suggestion, overlap warnings and color-aware connection validation — and the whole 512-channel universe is now addressable from the UI (previously capped at 64).

Runtime approach is compile-to-channels: fixtures + capabilities resolve to physical channel addresses once at show load (compileShowPatch), so the per-tick runner and DMX path are untouched (runner.service.ts: zero changes). Profiles are shaped like Open Fixture Library "modes" so an OFL importer can come later without a schema change.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Other (please describe):

Breaking for stored files only: show files are migrated automatically (see below); files written by 0.4.0 won't load on ≤0.3.0.

Changes Made

  • lib-models: fixture profiles + capability resolution, showFixture, capability-based showPatch (typed entries make color→dimmer wires unrepresentable), output-color node, show superRefine (duplicate ids, unknown profile, universe overflow)
  • lib-domains: output-color evaluation into a new ProgramOutput.colors namespace (HSV→RGB via new lib-utils helper), compileShowPatch/applyMapping/getMappingChannels rewrite, new fixture domain (channels, overlaps)
  • lib-shared: 0.4.0 migration — each used channel becomes a 1-channel "Channel N" dimmer fixture, byte-identical DMX output (compile-equivalence tested); plus two migration-system fixes: files stamped with the 999.999.999 sentinel re-run the chain on load (treated as unknown), and writes stamp the resource's newest migration version when APP_VERSION is unknown — so dev-written files are never exempted from future migrations
  • service-main: swap to compileShowPatch at show load + color-aware resetProgram (2 call sites; runner untouched)
  • ui-admin: fixture rack patch page (modal with profile preview chips, overlap warning, next-free suggestion), COLOR node with live color-strip preview, color-typed handles + connection validation, dashboard renders the rig, stable node heights, new Jest harness (first ui-admin tests)
  • Docs: design spec under docs/superpowers/specs/, AGENTS.md migration notes updated

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed

~200 new tests across lib-utils / lib-models / lib-domains / lib-shared / ui-admin (incl. migration fixtures, compile-equivalence, an hsv hue-sweep integration test, and adapter/validation round-trips). Manually tested against real ~/.ptah data: legacy shows (incl. one poisoned with the sentinel stamp) heal on load with backups written; fixture rack + color node verified in the running app.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Comments added for complex code
  • Documentation updated
  • No new warnings generated
  • Tests pass locally

Related Issues

Screenshots (if applicable)

Additional Notes

  • Releasing: the changeset bumps everything minor@ptah-app/app 0.4.0. The show migration is keyed to 0.4.0; if the release number changes, update show.migrations.ts, its fixture test and the repository-test pin together.
  • Existing show files are rewritten on first load (original backed up under ~/.ptah/.backups/shows/). Legacy patch entries on channels outside 1..512 (which never reached the wire) are dropped.
  • Known overlap with the WIP feat/node-input-audio branch: node.model.ts, lib-models index, program.domain.ts eval switch, ui node registry — distinct hunks, should auto-merge; re-run lib-domains tests after merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant