Skip to content

Fix the flaky pad-editor test at its cause (#290) - #299

Merged
thorwhalen merged 2 commits into
mainfrom
fix/drum-pads-editor-flake
Oct 5, 2026
Merged

thorwhalen merged 2 commits into
mainfrom
fix/drum-pads-editor-flake

Conversation

@thorwhalen

@thorwhalen thorwhalen commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Closes #290: the flaky test/drum_pads_editor.test.tsx. This fixes the cause instead of raising the test timeout.

Two causes, both real

  1. A race (seen on CI tonight, on PR @thoremin/sdk: the pure extension SDK as a workspace package (ADR follow-up c, part 1) #298). The walk waited for the "Air instruments" group, then looked up "Edit Air Drum" synchronously. The group renders before the seeded instruments arrive, so the lookup failed after 343 ms with "Unable to find a label ... Edit Air Drum". The test now waits for the row itself.

  2. Load. Every dial write re-rendered the whole Instruments view. The walk took ~0.7 s alone and over 5 s under the full suite's parallel load: the timeout reported in Flaky test: drum_pads_editor.test.tsx times out (~5.2 s) under full-suite load, passes alone #290. It is now split in two:

    • the cold-load reachability (to the editor, plus one write) stays on the real view;
    • the editing walk renders DrumPadEditor itself, against the same dials store and command path.

    Each walk resets the airDrum dial. Timings: 518 ms + 277 ms, where it was one 721 ms test.

Also, after review:

  • the same race fixed in test/instruments_view_compact.test.tsx: its group() helper waited for any list item, and an empty group's "None saved" placeholder satisfied that before the seeded rows arrived. It now waits for a named row;
  • the cold-load walk asserts the editor is the same element after a dial write, so the view's re-render cannot silently remount it (the editing state the colour-picker bug depended on);
  • a first draft raised testing-library's waitFor timeout globally. It is dropped: the suite passes without it, and it would only have masked slowness.

Verified

  • Full suite repeatedly, and under load (two and three concurrent 8-thread suites, by the reviewers): 2439 passed each time; the two files under --sequence.shuffle across seeds.
  • npm run test:core passes; typecheck is clean.

- a race: the walk waited for the Air instruments GROUP, then looked up the Edit Air Drum
  row synchronously; the group renders before the seeded instruments arrive. It now waits
  for the row (CI saw this on 2026-10-05: "Unable to find a label ... Edit Air Drum")
- the load: every dial write re-rendered the whole Instruments view, so the walk took
  ~0.7 s alone and over 5 s under the full suite. Split in two: the cold-load reachability
  (to the editor, one write) on the real view, the editing walk on the editor itself,
  same dials store and command path; each walk resets the airDrum dial
- jsdom shell tests wait up to 4 s instead of testing-library's 1 s default
  (test/setup/dom.ts), still inside vitest's 5 s test timeout

Closes #290
… the compact view test waits for named rows; the cold-load walk checks the editor survives the view's re-render
@thorwhalen
thorwhalen merged commit e9c354a into main Oct 5, 2026
4 checks passed
@thorwhalen
thorwhalen deleted the fix/drum-pads-editor-flake branch October 5, 2026 16:58
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.

Flaky test: drum_pads_editor.test.tsx times out (~5.2 s) under full-suite load, passes alone

1 participant