Skip to content

refactor: untangle Top 5 + MIDI chain-wipe fix + guard rails - #23

Merged
mattromano merged 25 commits into
customfrom
refactor/untangle-2026-11-07
Nov 10, 2026
Merged

mattromano merged 25 commits into
customfrom
refactor/untangle-2026-11-07

Conversation

@mattromano

Copy link
Copy Markdown
Owner

What

A structural cleanup that keeps behaviour the same (codebase-untangler), plus one bug fix. The audit is in REFACTOR_AUDIT.md and the handover is in .untangler/HANDOVER.md.

Top 5 fixed:

Issue Change
I-001 Engine-loading tests are moved to tests/engine/. npm test now runs only the fast lane, and CI gets a ~2 s "Fast tests" step.
I-002 Desktop config moves to desktop-config.ts. An unreadable slopsmith-desktop.json is kept as .corrupt instead of being silently replaced.
I-006 A failed plugin clone fails the build. Set ALLOW_MISSING_PLUGINS=1 to opt out.
I-004 callAddon() replaces 7 copies of the guarded addon handler.
I-003 Both IIFEs share one bypass switch and one MIDI switcher factory. The IIFE 2 song preload now runs under the tone-chain lock.

Bug fix (60218a7): MIDI program-change mode no longer wipes the effect chain when a song loads.

Guard rails:

  • ARCHITECTURE.md
  • tests/boundaries.test.js
  • a ~2 s pre-commit hook (npm run hooks:install)
  • conventions in CLAUDE.md
  • CONTRIBUTING.md

Verification

  • Each Top 5 item got a safety-net test written before the change, and each was broken on purpose to prove it catches the regression.
  • The fast lane passes (178 tests) and tsc is clean.
  • In the packaged app, driven over CDP:
    • tone changes, tone lock, and 25/25 quick song switches in both manual and Tone Automation mode
    • MIDI PC keeps the chain
  • Play-tested by hand on the local packaged build.

Stacked on the heard-clocks PR.

🤖 Generated with Claude Code

mattromano and others added 25 commits November 7, 2026 12:50
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Snapshot of every audio:* handler's fallbacks (I-004), desktop config
read/write (I-002), plugin clone harness (I-006), tone switcher parity
across both IIFEs (I-003), and a test-file inventory (I-001). Each guarded
spot was broken on purpose and the matching test failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only paths change (one more '..', contracts/ import). test-inventory now
checks the two lanes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
npm test now means the fast lane; test:engine runs tests/engine/ on
demand. No new jobs, nothing added to build or release workflows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code moved unchanged; main, pane-hosts and python import it from there,
soundfont-manager re-exports SoundfontQuality.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…desktop config

Reads still treat a bad file as {}; the next write now saves the old bytes
as slopsmith-desktop.json.corrupt first, so window bounds, LAN access and
pane settings can be recovered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clone_slopsmith now returns non-zero when any plugin clone fails
(ALLOW_MISSING_PLUGINS=1 keeps the old behaviour), and the desktop
plugin copy no longer swallows errors; only the optional .html is
skipped when absent. All 38 plugin repos/branches checked reachable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ddon()

setOutputDeviceType, getDeviceMetrics, scoreChord, setChart,
listInputDevices, listSources and detectNotes now share one guard /
try / warn / fallback helper. Handler snapshot unchanged; IPC contract
snapshot unchanged. Handlers that validate arguments, swallow errors
silently or have no try are left as they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rialise the song preload

- bypassSwitchToTone / makeMidiToneSwitcher in IIFE 1 replace the two
  bypass and three MIDI switcher copies (IIFE 2 uses the window exports).
- IIFE 2's bypass switcher now carries tonePresetNameMap like IIFE 1's,
  so the chain panel's preset-name lookup works for those songs too.
- IIFE 2's song preload runs under the same chain lock as tone-mapping
  applies (window._aeWithToneChainLock), re-checking the song generation
  after the wait, so two rebuilds no longer clear/load the chain at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ARCHITECTURE.md (layout + 8 rules), tests/boundaries.test.js enforcing
them in the fast lane (CI), a pre-commit guard script with
npm run hooks:install, CLAUDE.md conventions, CONTRIBUTING.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
songShouldRebuildChain() said yes whenever the song's bypass mappings
resolved, even with a valid MIDI PC config for the song. Playback then
takes the MIDI path (program changes to an existing VST, no rebuild), so
the song-start clear deleted that VST and nothing put it back. A valid
MIDI PC config now keeps the chain; Tone Automation still takes
precedence. Checked in the packaged app: the VST stays through load and
tone changes, program changes reach it; bypass mode still rebuilds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattromano
mattromano changed the base branch from fix/heard-clocks to custom November 10, 2026 15:00
@mattromano
mattromano merged commit 88f0502 into custom Nov 10, 2026
2 of 3 checks passed
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