Testing CumbiaDance where it breaks: clock skew under sustained load

The failure that matters in an in-browser pose trainer never shows up in a short demo. It appears when the phone heats up, inference slows, and the scorer starts comparing a pose from the past with a reference frame from the present. Nothing crashes, the dancer simply loses points for being on the beat, and no log records why. A qualification plan has to provoke that drift deliberately and prove that the system degrades into honesty rather than into unfair scores.

Why the bug hides at low load

CumbiaDance runs separate loops that share nothing but a clock: the reference video decoded by the media pipeline, the camera feeding a pose model on the GPU or a WASM fallback, and the scorer that pairs each detected pose with the reference keypoints at the same instant. On a cool device those loops stay close enough that pairing by arrival order looks correct. Under thermal throttling or GPU contention, inference latency grows while video playback, which the browser protects, keeps its pace. If the scorer pairs by arrival rather than by capture timestamp, every result is now computed against the wrong frame, and because the error is systematic it reads as poor dancing instead of a defect.

The test: a perfect dancer on a hot phone

Replace the camera with a recording of the reference choreography itself, fed through a canvas capture stream, so the input is deterministic and its ideal score is known. Run it on a mid-range phone for a full practice session, around twenty minutes as an estimate of a long real session, while a worker thread saturates the CPU and a parallel WebGL workload competes for the GPU. Halfway through, force a context loss with the lose-context extension so the pose model must rebuild or fall back to the CPU, and later background the tab long enough for the browser to throttle animation frames. Record, per scoring window, the capture timestamp of the pose, the media time of the reference frame, and the score issued. What is under test is not the model's accuracy but whether the score of a dancer who never made a mistake stays flat while the machine falls apart around it.

Decision rule for degraded windows

Any window in which the pose timestamp lags the media clock by more than 100 ms must be reported as unscored rather than scored, and the run passes only if the scored windows of the perfect replay keep their baseline value while the coverage figure drops visibly and recovers once the load is removed.

What the fallback must not do

Graceful degradation carries a second constraint that load tests usually ignore. The product promises that no camera footage leaves the device, and the riskiest moment for that promise is exactly when local inference fails and someone has wired a convenience path to a remote model. Run the same soak with network capture active and assert zero outbound media payloads during context loss and CPU fallback, using the W3C media capture and graphics specifications as the contract for what each failure event should look like. Expect the CPU fallback to cut the pose rate roughly in half, an estimate that depends heavily on the model variant and that will push more windows past the skew budget. The open decision is whether a low coverage session should still issue a final grade, or whether the trainer tells the dancer the device could not keep up and withholds it.

Why not extrapolate the late pose forward instead of dropping the window?

Extrapolating keypoints across a lag that large invents motion the dancer may never have made, and in cumbia the scored detail is often a step or hip change that prediction smooths away. An unscored window is a known gap; an extrapolated one is a confident guess the dancer cannot dispute.

Back to CumbiaDance · Domains

← Back to CumbiaDance
Engineering & Architecture Brief

Testing CumbiaDance where it breaks: clock skew under sustained load

The failure that matters in an in-browser pose trainer never shows up in a short demo. It appears when the phone heats up, inference slows, and the scorer starts comparing a pose from the past with a reference frame from the present. Nothing crashes, the dancer simply loses points for being on the beat, and no log records why. A qualification plan has to provoke that drift deliberately and prove that the system degrades into honesty rather than into unfair scores.

Why the bug hides at low load

CumbiaDance runs separate loops that share nothing but a clock: the reference video decoded by the media pipeline, the camera feeding a pose model on the GPU or a WASM fallback, and the scorer that pairs each detected pose with the reference keypoints at the same instant. On a cool device those loops stay close enough that pairing by arrival order looks correct. Under thermal throttling or GPU contention, inference latency grows while video playback, which the browser protects, keeps its pace. If the scorer pairs by arrival rather than by capture timestamp, every result is now computed against the wrong frame, and because the error is systematic it reads as poor dancing instead of a defect.

The test: a perfect dancer on a hot phone

Replace the camera with a recording of the reference choreography itself, fed through a canvas capture stream, so the input is deterministic and its ideal score is known. Run it on a mid-range phone for a full practice session, around twenty minutes as an estimate of a long real session, while a worker thread saturates the CPU and a parallel WebGL workload competes for the GPU. Halfway through, force a context loss with the lose-context extension so the pose model must rebuild or fall back to the CPU, and later background the tab long enough for the browser to throttle animation frames. Record, per scoring window, the capture timestamp of the pose, the media time of the reference frame, and the score issued. What is under test is not the model's accuracy but whether the score of a dancer who never made a mistake stays flat while the machine falls apart around it.

Decision rule for degraded windows

Any window in which the pose timestamp lags the media clock by more than 100 ms must be reported as unscored rather than scored, and the run passes only if the scored windows of the perfect replay keep their baseline value while the coverage figure drops visibly and recovers once the load is removed.

What the fallback must not do

Graceful degradation carries a second constraint that load tests usually ignore. The product promises that no camera footage leaves the device, and the riskiest moment for that promise is exactly when local inference fails and someone has wired a convenience path to a remote model. Run the same soak with network capture active and assert zero outbound media payloads during context loss and CPU fallback, using the W3C media capture and graphics specifications as the contract for what each failure event should look like. Expect the CPU fallback to cut the pose rate roughly in half, an estimate that depends heavily on the model variant and that will push more windows past the skew budget. The open decision is whether a low coverage session should still issue a final grade, or whether the trainer tells the dancer the device could not keep up and withholds it.

Technical FAQ: Why not extrapolate the late pose forward instead of dropping the window?

Extrapolating keypoints across a lag that large invents motion the dancer may never have made, and in cumbia the scored detail is often a step or hip change that prediction smooths away. An unscored window is a known gap; an extrapolated one is a confident guess the dancer cannot dispute.

Related Architecture Specifications (DANCEGOAL): fitnessdetection.com · morningparties.club · salsamethod.com