Skip to content

Let CI collect the Python tests, and cover the timebase it gates on - #48

Merged
wirelessdreamer merged 11 commits into
mainfrom
claude/midi-studio-render
Sep 5, 2026
Merged

wirelessdreamer merged 11 commits into
mainfrom
claude/midi-studio-render

Conversation

@wirelessdreamer

Copy link
Copy Markdown
Owner

Fixes the two checks that have been red on main since at least #45. Neither was caused by recent work.

bench-python was never a failing test

It was a collection crash. conftest decides what to ignore by importing each test module and seeing whether it complains about a missing dependency — catching ImportError and Exception. But pytest.importorskip raises Skipped, which derives from BaseException, so it went straight past both handlers and out of conftest, taking the whole collection with it.

CI has therefore been running none of the 1057 ingest tests, behind one red job that read like a single broken benchmark. Every test written for the MIDI import and render-alignment work has only ever run locally.

The regression test needed care of its own. Written the obvious way it does not fail when the bug returns — it skips, because the escaping Skipped marks the test itself skipped, so a green run would mean nothing. It catches BaseException and converts an escape into an assertion failure. Verified both directions: fails with the fix removed, passes with it in.

lint_test was a real coverage gap

The 100% gate on nativeAudioTimebase.ts had drifted to 95.7%, and the uncovered code was genuinely unexercised:

  • game: getLoadedStemRoles, including the branch where an engine reports no roles
  • desktop: warmUp (the whole reason a first playback isn't a cold start, both success and the survivable-failure path), loadPackAudio and its duration/roles fallbacks, and the pack branch of a device switch

Now 100% on statements, branches, functions and lines — verified with CI's exact command and thresholds.

Left alone deliberately

test_model_upgrade_gate_snapshot_reports_missing_external_gates fails locally only: it reads the repo's real benchmark evidence, so a machine that has run MUSDB sees the gate as ready rather than pending. Those run files are untracked, so a clean CI checkout passes. Not a CI failure — but it will fail for anyone who runs that benchmark, and the fix is to isolate it to a temp evidence root.

Local: 1056 passed, 11 skipped, plus that one environment-dependent failure.

🤖 Generated with Claude Code

wirelessdreamer and others added 11 commits September 1, 2026 10:39
Two red checks, neither caused by recent work, both red on main since at
least #45.

bench-python was not a failing test. conftest decides what to ignore by
importing each test module and seeing whether it complains about a missing
dependency, and it caught ImportError and Exception. pytest.importorskip
raises Skipped, which derives from BaseException, so it went straight past
both handlers and out of conftest -- taking the whole collection with it. CI
has been running NONE of the 1057 ingest tests since, behind a single red job
that read like one broken benchmark. Every test written for the import and
alignment work has only ever run locally.

The regression test for it needed care of its own. Written the obvious way it
does not fail when the bug returns, it SKIPS -- the escaping Skipped marks the
test itself skipped, so a green run would mean nothing. It catches
BaseException and converts an escape into an assertion failure. Verified in
both directions: fails with the fix removed, passes with it.

lint_test is a 100% coverage gate on nativeAudioTimebase.ts, which had drifted
to 95.7%. The uncovered code was real and unexercised: the game's
getLoadedStemRoles, and on the desktop side warmUp (the whole reason a first
playback is not a cold start), loadPackAudio, and the pack branch of a device
switch. Now covered by tests that assert the behaviour rather than merely
executing the lines -- including that a warmUp failure is survivable, since
the first real load is supposed to init the engine anyway.

One local-only failure is left and deliberately untouched:
test_model_upgrade_gate_snapshot_reports_missing_external_gates reads the
repo's real benchmark evidence, so it fails on a machine where MUSDB has been
run and passes on a clean checkout. Not a CI failure, but it will fail for
anyone who runs that benchmark, and isolating it to a temp evidence root would
be the fix.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…egression

Two more reds, both older than this branch.

The casing one is the same bug that was fixed in main.ts and missed one file
over: the test imported "../src/auralsongAudioLoader" while git tracks
auralSongAudioLoader.ts. Windows resolves it either way, so it can only fail
on the CI runner -- which is exactly why it survived. Fixed everywhere the
lowercase spelling appeared rather than just at the one line CI named.

The other is a source-level pin that broke on a rename. It required the
overlay's result to be bound to `melodicTracks`, and a fingering stage was
later inserted between the overlay and the final tracks, so that binding
became `refinedMelodicTracks`. The behaviour the pin guards was not just
intact but extended; only the name moved.

It now matches the binding by suffix and, more to the point, checks the bound
value actually reaches the final melodicTracks. The old pin asserted the call
happened and would have passed just as happily if the result were thrown away
-- which is the regression it existed to catch.

Full TS suite: 1214 passed, 3 skipped.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The lint step reports nine errors, and none of them could fail the build while
collection was crashing ahead of it -- the job died before lint mattered.
Fixing collection is what surfaced them.

Two are mine: an ambiguous `l` as the loop variable in the correlation, now
`lag`, which is what it actually is; and a pytest import left behind in the
new conftest test. The rename is pure -- Schumann still measures 5.108s at
58.9x, unchanged to the digit.

One is worth more than a lint waiver: in cli.py a loop variable named `field`
shadowed the `dataclasses.field` imported at module scope. Harmless where it
sits, since that function never needs the import, but it is the kind of thing
that is only harmless until someone adds a line. The loop variable is `key`
now.

The rest are unused imports removed by ruff --fix.

81 tests pass across the touched modules; ruff is clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two test modules failed to import on the runner:

    ValueError: mutable default <class 'mappingproxy'> for field provenance
    is not allowed: use default_factory

Python 3.12 accepts a mappingproxy as a dataclass default and 3.11 rejects it,
so the bare `= MappingProxyType({})` imports fine on a 3.13 dev machine and
raises at collection on the 3.11 runner. It has been that way since it was
written on 2026-08-27 and nobody saw it, because CI was not collecting these
tests at all -- the conftest crash meant the job died long before it got here.

default_factory works on every version. Checked for the same pattern
elsewhere; there is none.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two more sources of the stutter, both below the timing fix rather than in it.

Pause set is_playing = false and the very next block was silence. Full
amplitude to zero between one sample and the next is a step, and a step is a
click -- one on stop and another on start, so two per note in Wait mode. The
song now ramps over 5ms. The ramp is applied between the song and the piano so
it moves only the recording: a live note is the player's finger on a key and
has nothing to do with whether the transport is running.

And the gate was seeking after it paused, forward to a fixed point just before
the note. That splices two pieces of audio that were never adjacent -- about
45ms of the previous note's ring, elided. Silence would have made that free; a
ringing chord does not, and these pieces are mostly ringing chords. The
transport now stops where it stops and resumes from exactly there.

The cost is the gap between key press and note going from ~20ms to ~65ms,
because it is now the pause overrun rather than a park point we chose. That is
the honest price of not cutting the audio, and it is well inside what felt
wrong at 200ms.

The engine's own test module has not compiled since the piano merge -- its
runtime constructor was missing the piano field -- so cargo test was broken
there and nothing noticed. Fixed, and the fade has five tests of its own,
including that a settled transport is left alone rather than ramped toward a
value it already holds. One existing test earned its keep immediately by
catching a wrong resting gain: render_output_paused_is_silence.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The remaining stutter is a flam, not a stutter. Wait mode holds the transport
just short of a note and the player's key releases it, so the recording sounds
that note a moment later -- while the sampler has already sounded it under
their finger. Two attacks of one pitch, tens of milliseconds apart. The chart's
own part is silenced in Wait mode for exactly this reason; the live half was
not, so it kept doubling.

A press that answers the gate no longer sounds through the sampler: the
recording is about to play it, and that is the note the player asked to hear.
Any other note still sounds -- nothing else is going to play it, and a wrong
note the player cannot hear is a wrong note they cannot correct.

That also explains why removing the park seek made it worse rather than
better. The park was not the problem; the gap it left was. Widening it from
20ms to 65ms pulled the two attacks apart until they read as separate events
instead of one thick one. The park is back, and the elision that worried me is
covered now: the join happens while the transport is stopped and faded out,
with a ramp either side, so what is skipped is the smooth middle of a decay.

TS suite: 1214 passed, 3 skipped.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…tack

I had this backwards. Suppressing the player's note and letting the recording
strike it fixed the doubling by removing the wrong half: the player presses a
key and the app answers with the note, which is the app playing it, not them.
In Wait mode the press IS the note.

So the press sounds again, and the transport resumes PAST the recording's
attack of the note just played -- about 45ms, which is the striking part of a
piano note. The recording carries on from where that note is already ringing,
under the one the player is holding. One attack, theirs.

Floored against the next group, because on a fast run the gap between notes
can be shorter than an attack, and skipping blindly would drop a note from the
recording while still demanding it from the player.

This is the third pass at the same symptom and the first two were not wasted:
the engine really had no fade on pause, and that clicked on every stop and
start regardless of who plays what. What changed is the diagnosis of the part
underneath it, which was never a stutter -- it was a flam, and the question
was which of the two attacks should not have been there.

TS suite: 1214 passed, 3 skipped.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A scrub bar under the transport: position, elapsed and total, and a handle to
move the playhead. It reads its duration from the timebase rather than the
transport state -- the state carries the playhead, and the web timebase has no
duration at all, so the bar hides itself instead of scaling against a zero.

Two rules make a scrubber feel right and both are about who owns the value.
While a drag is in progress the render tick must not write to the thumb, or it
fights the finger; and the seek lands on release rather than on every
intermediate frame, or dragging across a seven-minute song issues hundreds of
seeks and the engine spends the gesture catching up. The elapsed readout still
follows the thumb live, so the drag has feedback without the transport moving.
The drag is claimed on pointerdown rather than on the first input event,
because by the time a value arrives the tick has already overwritten it once.

The other two asks were already there and are left alone: per-track volume is
the stem mixer, which appears when the engine reports more than one stem, and
Left/Right seek by 5s already, or 1s with Shift held.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…again

Two things, and the first caused a failure far larger than itself.

Every search root the demucs modelpack resolver builds comes from __file__,
cwd or sys.executable, and in a linked worktree all of those stay inside the
worktree. The packs live in the main checkout, so a pack that plainly exists is
reported "not found in default search locations" and stem separation silently
degrades to provider=none. Downstream, the guitar-split stage then falls back
to the raw mix and writes files named lead_guitar.wav and rhythm_guitar.wav;
instrument conditioning reads those NAMES as evidence of what is in the song
and masks the transcriber to guitar. Four solo-piano recordings imported that
way came back with zero keys notes and the whole part relabelled rhythm guitar.

A worktree's .git is a file reading "gitdir: <main>/.git/worktrees/<name>", so
the main checkout is derivable; it is added as a root. An ordinary clone has
.git as a directory and gains nothing. Re-importing psalm 130 with the fix
gives provider=demucs, all nine stems, conditioning that includes every piano
group, and 887 keys notes against 882 authored -- from zero.

The tab lane goes back to right-to-left. The perspective highway answered the
wrong question: what made the sideways version unreadable was never the
direction, it was that the window was a fixed number of SECONDS spread over
whatever width the canvas happened to be, so a wide window made the notes fly.
It now fixes the opposite quantity -- 140 px per second, the same constant the
Nashville chord lane uses, with the visible span falling out of the width. Two
lanes over the same music now scroll at one rate, which is what makes reading
one of them teach you the other.

The scroll-speed contract test pinned the old expression rather than the
property. It now checks the pixel rate scales with the multiplier, the way the
nashville and beats cases beside it already did.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The stage was capped at a reading width. 1180px is right for menus and copy
and wrong for a control rail beside a scrolling instrument lane, which just
got a smaller stage and two dead margins. The widescreen escape only fired
past 1500px and only widened to 1720px, so a wide monitor was still
letterboxed at both ends.

The play route now takes the window it is given; every other route keeps the
cap, because prose spanning two thousand pixels is worse, not better.

Toggled as a class from routeController rather than through :has(), so the
layout does not depend on the selector engine and the state is visible in the
DOM -- which is also where the rest of the route state already lives.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The scrub bar shipped in the setup rail, under the loop controls and above a
status pre. That is the right place to configure a song and the wrong place to
scrub one: during play the eye is on the stage, and the rail is off to the
side -- so a control that existed may as well not have.

It now sits on the stage bar beside the time readout, which is already where
the playhead, the MIDI input and the spacing slider live. Same behaviour, same
two rules about who owns the value while a drag is in progress; only the
markup and layout moved.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@wirelessdreamer
wirelessdreamer merged commit 8323b9c into main Sep 5, 2026
4 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.

1 participant