Skip to content

Seed the e2e fixture where the API actually looks - #373

Merged
thcp merged 1 commit into
mainfrom
fix/e2e-beatgrid-fixture
Aug 16, 2026
Merged

Seed the e2e fixture where the API actually looks#373
thcp merged 1 commit into
mainfrom
fix/e2e-beatgrid-fixture

Conversation

@thcp

@thcp thcp commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

The bug

tests/e2e/seed.py wrote both peaks.json and beats.json into the job root.
The pipeline writes them under stems/, and that is the only place the
endpoints look — so both 404'd for the whole life of the browser suite:

Artifact Fixture wrote API reads Consequence
beats.json <job>/beats.json <job>/stems/beats.json Studio reported "No beat grid for this track"; every click-track control stayed disabled
peaks.json <job>/peaks.json <job>/stems/peaks.json Studio fell back to decoding every stem for its waveforms

So the click track, the count-in and the grid editor could not be covered in a
browser at all — while seed.py, at a glance, looked like it covered them.
And the precomputed-peaks path that every real track takes was never exercised;
the fixture silently tested the full-decode fallback instead.

The grid now also carries the shape beatgrid.py emits rather than an invented
one, bars included — without bar marks the accent mode degrades to "Auto
(none found)" and the detected-meter path never runs.

What it unlocks

tests/e2e/click-track.spec.mjs, covering what was previously untestable:

  • the beat grid reaching the studio at all (the test that would have caught this)
  • the click toggling on and off
  • count-in persisting across a reload, from the store rather than the DOM
  • the rate control reporting the tempo it is actually clicking (/2 → 60 BPM,
    x2 → 240 BPM)
  • the accent choice, including "accenting 4/4 from the detected downbeat",
    which only works because bars is now present
  • the grid editor opening and closing from the button, a second click, and Done

A note on the helper

waitForClickTrack is separate from openStudio deliberately. openStudio
returns once the transport reports a duration, but the metronome is built later
— after the audio engine is up and the grid has been fetched. Acting before
then hits a null metronome, where the rate and accent controls silently
no-op
: the click looks present and does nothing. That is what made the rate
test fail on the first run, and it seemed worth naming rather than papering
over with a sleep.

Verification

25/25 e2e pass (19 existing + 6 new). Confirmed by request log that
stems/peaks.json and beats now return 200 where they previously 404'd, and
that the "no peaks.json; using full-decode engine" warning is gone.

…for them

seed.py wrote both peaks.json and beats.json into the job root. The pipeline
writes them under stems/ and that is the only place the endpoints look, so
both 404'd:

- GET /api/jobs/{id}/beats -> 404, the studio reported "No beat grid for this
  track", and every click-track control stayed disabled. The click track, the
  count-in and the grid editor could not be tested in a browser at all -- while
  seed.py, at a glance, looked like it covered them.
- GET /api/jobs/{id}/stems/peaks.json -> 404, so the studio fell back to
  decoding every stem for its waveforms. The precomputed-peaks path that every
  real track takes was never exercised.

The grid also carries the shape beatgrid.py emits rather than an invented one,
`bars` included: without bar marks the accent mode degrades to "Auto (none
found)" and the detected-meter path never runs.

Adds tests/e2e/click-track.spec.mjs over what this unlocks -- the grid reaching
the studio, the click toggling, count-in persisting across a reload, the rate
control reporting the tempo it is actually clicking, the accent choice, and the
grid editor opening and closing from all three of its controls.

waitForClickTrack is a helper rather than part of openStudio: the metronome is
built after the transport reports a duration, and acting before then hits a
null metronome where the rate and accent controls silently no-op. That is what
made the rate test fail first time round, and it is worth naming.
@thcp
thcp merged commit 309c49d into main Aug 16, 2026
10 checks passed
@thcp
thcp deleted the fix/e2e-beatgrid-fixture branch August 16, 2026 21:01
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