Skip to content

The streaming render path is untested, and looking for its canvases the obvious way says it is broken #494

Description

@thcp

The problem

The streaming render path has no test coverage, and the reason it has none is a
false negative that reads exactly like a broken feature.

StemDeck draws the waveform lanes two different ways. When the Web Audio engine
owns playback the lanes are an SVG overlay built from peaks. On the streaming
path they are WaveSurfer canvases. The two share nothing: different code,
different bar geometry, different response to a zoom.

Only the first is tested.

Why nobody noticed

Looking for canvases the obvious way finds none:

document.querySelector("#multitrack-container").querySelectorAll("canvas").length
// 0

Which says the streaming path renders nothing. It says that after eight seconds
of waiting, with the loading overlay cleared, canplay fired and no failed
requests. It is a convincing result and it is wrong: WaveSurfer renders into
shadow roots, and querySelectorAll does not cross a shadow boundary. Walking
the roots finds nine canvases, correctly sized.

So the cost is not only the missing coverage. It is that the first person to
look concludes the path is broken and either files that, or works around a bug
that does not exist. This already happened once, and the wrong claim reached a
merged pull request body.

What coverage needs to prove

The zoom promise on this path rests on a different mechanism from the SVG one.
WaveSurfer bars are configured in pixels (barWidth 3, barGap 2), so they stay the
same width across a zoom only if it re-renders rather than letting a
fixed-size canvas stretch. That is worth asserting rather than assuming, and it
cannot be asserted without piercing the shadow DOM.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions