Claude/midi audit auto routing i43men - #1896
Merged
Merged
Conversation
…audit fixes A 4-agent independent review of the 26 audit fixes confirmed the whole is solid and caught 2 real bugs I introduced, 1 regression, and minor items — all fixed with tests (full backend suite green, 1272 tests): - [HIGH] InstrumentMatcher._scoreBestEffortWrapping could OUT-SCORE a clean fit: it omitted the −5/−6 base penalty the compatible paths apply, so a lossy octave-wrap could reach 40 and win over a faithful transpose. Added a WRAP_PENALTY so best-effort always ranks below a clean fit; also mark it compatible:false at 0% playable. - [HIGH] apply_assignments' re-apply purge used deleteByFileId (ALL rows), destroying manual routings and the disabled offline-preserved routing that P2-3 adds. Scoped to enabled=1 AND auto_assigned=1 via a new deleteActiveAutoByFileId (repo + Database + RoutingPersistenceDB). - [MEDIUM] P2-6 regressed melody/harmony channels (not typeMapping keys) to type-score 0; undefined acceptableTypes now returns the neutral score. - [LOW] failedChannels reported the split target channel not the source; live-player side-effects moved to a best-effort nested try so a setter throw can't mis-report a persisted routing; sendEvent now uses the logical note type (velocity-0 → noteOff) like scheduleEvent; setChannelSplitRouting panics only on an actual config change; MidiTransposer/ChannelAnalyzer comment + mixed-field hardening. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ekccgnr9tm3Jt5x91X5nHt
…/cleanup
Follow-up to the 2026-08-06 adaptation & auto-routing audit. Ships the
"safe lot" of remaining low-value items (honest reporting + defensive
guards + dead-code removal), no behavior change to audible playback.
P2-8 (option B — stop producing the misleading claim): restrict
calculateFullCoverageSplit to the instruments' NATIVE ranges. A
per-segment transposition is not representable at runtime (playback
transposition is keyed on the source channel; the runtime resolver
returns only {device,targetChannel}; the persisted schema drops it), so
the emitted `transposition` segment field was silently dropped by every
apply/runtime path and the split's `gaps:[]`/`quality` were unfaithful
to its own model. The split now only claims full coverage when two
native ranges genuinely tile the channel; channels that would need an
octave shift fall through to the gap-reporting split strategies (guarded
by the existing quality>=50 filter) or keep a single-instrument
assignment whose per-channel transposition IS applied. AutoAssigner's
"prefer a split that avoids transposition" gate stays correct (no split
produces a transposition field anymore).
P3 (safe subset):
- validateInstrument(null) now reports an invalid result instead of
throwing, so a null element no longer crashes the whole
validateInstruments() batch.
- Empty drum channel guard: calculateMappingQuality returns 0 when the
channel has no percussion notes (was ~95/100 via the total===0->100
neutral defaults + coverageRatio 1, making an empty channel look like
an excellent kit to the assigner). Non-empty kits unchanged.
- Remove never-read dead code: NOTE_PRIORITIES and the preserveEssentials
option in DrumNoteMapper, and the GM_CATEGORIES member in
InstrumentMatcher. getGmDefaultPolyphony is kept (live: frontend mirror
+ sync test).
Adds 9 regression tests (adaptation-audit-fixes-2026-08-06) and realigns
the audit doc. Full backend suite green: 107 suites / 1281 tests; lint
and typecheck clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ekccgnr9tm3Jt5x91X5nHt
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.