Claude/instrument recognition v2 xy1mkj - #1892
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.