Skip to content

Claude/midi audit auto routing i43men - #1896

Merged
glloq merged 2 commits into
mainfrom
claude/midi-audit-auto-routing-i43men
Aug 6, 2026
Merged

Claude/midi audit auto routing i43men#1896
glloq merged 2 commits into
mainfrom
claude/midi-audit-auto-routing-i43men

Conversation

@glloq

@glloq glloq commented Aug 6, 2026

Copy link
Copy Markdown
Owner

No description provided.

claude added 2 commits August 6, 2026 12:03
…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
@glloq
glloq merged commit af40277 into main Aug 6, 2026
0 of 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