Skip to content

Namespace patch names by synth ({synth}/{name}) #7

@pnilan

Description

@pnilan

Problem

Patch names are currently globally unique. Saving a patch named "bass" for tb-03 silently overwrites an existing "bass" patch for minitaur. Users should be able to have the same patch name across different synths.

Proposed Solution

Change the DB uniqueness constraint from UNIQUE(name) to UNIQUE(name, synth) and use {synth}/{name} (e.g., minitaur/bass) as the display and lookup format.

Key changes

  • Schema migration: UNIQUE(name)UNIQUE(name, synth). Use Alembic (or similar) for the DB migration so existing patches.db files are upgraded cleanly.
  • patch_library.py: Update get() and delete() to accept optional synth param. Add find(name) for disambiguation. Update upsert logic to key on (name, synth).
  • tools/patches.py: Add _parse_patch_ref() helper to parse "minitaur/bass"(synth, name). Update load_patch, recall_patch, delete_patch to support both "bass" (unambiguous) and "minitaur/bass" (explicit) lookups, with clear error messages when ambiguous.
  • Display: list_patches shows "minitaur/bass" format instead of "bass (Minitaur)".

Disambiguation behavior

  • recall_patch("bass") — works if only one synth has a patch named "bass"
  • recall_patch("minitaur/bass") — always unambiguous
  • If ambiguous, return error: "Multiple patches named 'bass': minitaur/bass, tb-03/bass"

Context

Identified during review of PR #6 (Phase 3: Patch Library). Currently tracked as a known limitation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions