Skip to content

Expand usage of websockets for parameter / BPM setting#149

Merged
sastraxi merged 30 commits into
TreeFallSound:pistomp-v3from
sastraxi:feat/websocket-parameter-set
Jun 4, 2026
Merged

Expand usage of websockets for parameter / BPM setting#149
sastraxi merged 30 commits into
TreeFallSound:pistomp-v3from
sastraxi:feat/websocket-parameter-set

Conversation

@sastraxi

Copy link
Copy Markdown
Collaborator

Migrates outbound parameter/bypass/tempo writes from the bespoke pi_stomp_set REST endpoint to the existing MOD-UI WebSocket, and adds inbound handling for plugin-bypass echoes so the LCD stays in sync with MOD-UI-originated changes.

This removes our need to maintain a fork that adds the pi_stomp_set REST endpoint.

Outbound messages

  • Plugin bypass toggle (non-footswitch) → param_set /graph/<inst>/:bypass <v>
  • Parameter edit commit → param_set /graph/<inst>/<sym> <v>
  • Tap tempo → transport-bpm <bpm>

Inbound messages

  • param_set /graph/<inst> :bypass <v> from MOD-UI is parsed into a PluginBypassMessage, updates plugin state, and redraws the LCD plugin row. Idempotent on self-echo.

Changes

  • Fail-fast startup. The WebSocket bridge is now required; the previous try/except swallow around bridge construction is gone. If the bridge fails to construct or start, handler init raises. Two unit tests pin this.
  • No more rollback on send failure. The old REST path toggled plugin.bypass back if the POST returned non-200. Fire-and-forget is fine here because the WS connection is the source of truth: if we're connected, we're synchronized; if we're not, the bridge will reconnect and the next state change carries us forward.
  • Canonical instance_id. Plugin.instance_id is normalized at construction (leading slash stripped). The parser produces bare instance names. Comparisons are plain ==. send_parameter still defensively strips + warns if a caller passes a slashed id (probably best to figure out a way to enforce this at the type layer later)
  • Added tests for all the above

sastraxi and others added 27 commits April 22, 2026 18:51
- Add FakeWebSocketBridge to conftest; patch AsyncWebSocketBridge in integration stack
- Add ws_bridge field to SystemFixture (6th element)
- Update test_v3_toggle_plugin_bypass_direct/via_footswitch to assert WebSocket messages
- Update test_set_mod_tap_tempo/none to assert transport-bpm messages instead of REST POSTs
- Fix all SystemFixture unpacks across test suite (5-tuple → 6-tuple)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Positional unpacks break every time a new field is added. A dataclass
allows attribute access so field additions never require mechanical fixes
across test files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Mechanical follow-up to the NamedTuple → dataclass conversion. Every
unpack site across all test files now uses named attribute access, so
future field additions to SystemFixture require no changes here.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…eter-set

# Conflicts:
#	modalapi/modhandler.py
#	pistomp/hardware.py
#	pyproject.toml
#	uv.lock
…eter-set

# Conflicts:
#	tests/integration/test_tap_tempo.py
#	tests/v3/test_plugins.py
#	uv.lock
…eter-set

# Conflicts:
#	tests/integration/conftest.py

@rreichenbach rreichenbach left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome!

@sastraxi sastraxi merged commit 4fb5b9b into TreeFallSound:pistomp-v3 Jun 4, 2026
1 check 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.

2 participants