Block IDs regenerated on every preset load — toggle fails with Block not found #17

Closed
opened 2026-06-18 23:14:15 +00:00 by shawn · 0 comments
Owner

Root cause: In src/presets/manager.py, _preset_to_dict() did not serialize block_id, so every save/load cycle regenerated them. Same bug in save_preset and save_snapshot API endpoints — FXBlock() was constructed without passing block_id from request data.

Fix:

  1. _preset_to_dict() now includes "block_id": block.block_id for chain blocks and snapshot blocks
  2. save_preset PUT endpoint passes block_id=b.get("block_id", "") to FXBlock()
  3. save_snapshot POST endpoint passes block_id=bd.get("block_id", "") to FXBlock()

Verification: Block IDs are now stable across 5 consecutive /api/state reads, persist to disk JSON, and block toggle PATCH works with the persisted ID.

Commit: c026bc7

**Root cause:** In `src/presets/manager.py`, `_preset_to_dict()` did not serialize `block_id`, so every save/load cycle regenerated them. Same bug in `save_preset` and `save_snapshot` API endpoints — `FXBlock()` was constructed without passing `block_id` from request data. **Fix:** 1. `_preset_to_dict()` now includes `"block_id": block.block_id` for chain blocks and snapshot blocks 2. `save_preset` PUT endpoint passes `block_id=b.get("block_id", "")` to `FXBlock()` 3. `save_snapshot` POST endpoint passes `block_id=bd.get("block_id", "")` to `FXBlock()` **Verification:** Block IDs are now stable across 5 consecutive `/api/state` reads, persist to disk JSON, and block toggle PATCH works with the persisted ID. Commit: c026bc7
shawn closed this issue 2026-06-18 23:24:09 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shawn/pi-multifx-pedal#17