Skip to content

Claude/instrument recognition v2 xy1mkj - #1892

Merged
glloq merged 4 commits into
mainfrom
claude/instrument-recognition-v2-xy1mkj
Aug 5, 2026
Merged

Claude/instrument recognition v2 xy1mkj#1892
glloq merged 4 commits into
mainfrom
claude/instrument-recognition-v2-xy1mkj

Conversation

@glloq

@glloq glloq commented Aug 5, 2026

Copy link
Copy Markdown
Owner

No description provided.

claude added 4 commits August 5, 2026 23:24
The live route-through clamped note-on and note-off independently, each
against the CapabilityResolver cache at its own arrival time. If a
destination's capabilities changed while a note was held (a settings edit
or the 30s cache sweep re-reading a changed row), the note-off folded to a
different pitch than the note-on — so the original pitch was never released
and the mechanical instrument sounded indefinitely. The router, unlike the
file scheduler, kept no active-note state and no All-Notes-Off panic.

Track the pitch actually sent for each held note (`_activeRoutedNotes`,
keyed by destination|channel|source-note) and have the matching note-off
and any poly-aftertouch reuse it instead of re-clamping. Poly-aftertouch
was also passing through completely unclamped, diverging from the
scheduler; it now follows the note to its clamped pitch. Bounded against
orphaned note-ons by a size cap.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BZ7sHZ9pTnJMt6h9Cus5mn
…ff, invalidate cache

Global-audit fixes to the v2 descriptor pipeline:

- gm_program / type / subtype were emitted by descriptorToCapabilities but
  updateInstrumentCapabilities does not persist them (they live on the
  settings allow-list), so a descriptor's declared program was silently
  dropped. Split them into descriptorToSettings and route them through
  updateSettings.
- §6 override arbitration compared the raw (nested) descriptor instruments
  while user overrides are stored column names, so a nested move such as
  notes.min was invisible and the override was never purged. Diff the
  flattened descriptorToOverrideView instead.
- CapabilityResolver invalidated its enforcement cache only on
  instrument_settings_changed, so after a descriptor applied (incl. a 0x11
  hot-change re-fetch) the scheduler/router kept clamping to stale
  capabilities for up to 30s. It now also listens to instruments_configured.
- descriptorToStringConfig accepted a tuning / frets_per_string with
  malformed elements; since those arrays are positional, one bad entry now
  drops the whole array rather than shifting later strings.
- createStringInstrument forced num_strings to the default guitar tuning's
  length when tuning was omitted, clobbering a descriptor-provided count; an
  explicit tuning stays authoritative, otherwise the provided count wins and
  the fallback tuning is sized to match.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BZ7sHZ9pTnJMt6h9Cus5mn
…te on disconnect

- A block 0x11 change notification arriving mid-transfer called
  _startDescriptorFetch, which early-returned because a fetch was already
  in flight — so the newer revision was ignored and the stale transfer
  completed and was recorded. It now abandons and restarts the in-flight
  transfer when the incoming revision is newer (an equal/absent revision
  stays a re-entrant no-op).
- Per-device recognition state (announce dedupe, identity probes,
  descriptor transfers, cached descriptor revisions) was never pruned on
  disconnect: the maps leaked and, worse, the announce dedupe suppressed a
  device's re-announcement on reconnect. Reconcile the maps against the
  still-open ports on every hot-plug update (cancelling pending timers).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BZ7sHZ9pTnJMt6h9Cus5mn
Cross-checked review of everything touched in this PR (protocol/mapping,
persistence/DB, enforcement/DI, DeviceManager). Adds a "Suivi — audit
global" section: nine confirmed defects fixed (one P2 router stuck-note,
descriptor program/type persistence, override diff, cache invalidation,
0x11 mid-transfer restart, disconnect pruning, strings validation,
num_strings clobber), each with its test, plus two intentional P3 notes.
The DB layer was reviewed clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BZ7sHZ9pTnJMt6h9Cus5mn
@glloq
glloq merged commit 302ac13 into main Aug 5, 2026
5 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.

2 participants