Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

studiobench: overlap the completeness traversal stops on a windowed thread (#17577)

Daniel Hanb5e447c1726a
diff --git a/tests/studio/studiobench/runtime/readiness.py b/tests/studio/studiobench/runtime/readiness.py
index 43c95a75664..053b32699be 100644
--- a/tests/studio/studiobench/runtime/readiness.py
+++ b/tests/studio/studiobench/runtime/readiness.py
@@ -345,6 +345,11 @@ async ([toTop, steps, stepPx]) => {
// step awaits a paint, so a windowed list gets a frame per step to mount what the step exposed.
const target = toTop ? 0 : vp.scrollHeight;
const direction = toTop ? -1 : 1;
+ // Upward, a step is at most 3/4 of the viewport so consecutive stops share a row: a windowed
+ // list mounts little beyond the viewport, and a longer step can jump a short row between two
+ // tall ones, which leaves coverage unmeasured. The distance budget (steps * stepPx) is kept.
+ const step = toTop ? Math.max(1, Math.min(stepPx, Math.floor(vp.clientHeight * 0.75))) : stepPx;
+ const maxSteps = Math.ceil((steps * stepPx) / step);
// WHICH MESSAGES THE TRAVERSAL ACTUALLY SAW, ordinal by ordinal.
//
// The marker check at the end of the walk asks one question -- did the FIRST message arrive --
@@ -389,12 +394,12 @@ async ([toTop, steps, stepPx]) => {
ranges.push([lo, hi]);
};
record();
- for (let i = 0; i < steps; i += 1) {
+ for (let i = 0; i < maxSteps; i += 1) {
const next = toTop
- ? Math.max(0, vp.scrollTop - stepPx)
- : Math.min(vp.scrollHeight, vp.scrollTop + stepPx);
+ ? Math.max(0, vp.scrollTop - step)
+ : Math.min(vp.scrollHeight, vp.scrollTop + step);
vp.dispatchEvent(
- new WheelEvent("wheel", { deltaY: direction * stepPx, bubbles: true, cancelable: true }),
+ new WheelEvent("wheel", { deltaY: direction * step, bubbles: true, cancelable: true }),
);
vp.scrollTo({ top: next, behavior: "instant" });
await window.__sbNextPaint();
@@ -420,11 +425,13 @@ async ([toTop, steps, stepPx]) => {
ordinals_in_window_holes: Array.from(holes).sort((a, b) => a - b),
sweep_continuous: continuous,
traversal_stops: ranges.length,
+ step_px: step,
};
}
"""
-# 400 steps of 2,000px cover the tallest rung; reaching either end breaks early.
+# A 400 x 2,000px distance budget covers the tallest rung; upward steps are capped to 3/4 of the
+# viewport (TRAVERSE_JS) and reaching either end breaks early.
TRAVERSE_STEPS = 400
TRAVERSE_STEP_PX = 2000
@@ -566,7 +573,7 @@ def probe_thread_completeness(
# Distinguishes a missing head from a gesture that never left the bottom.
"reached_top": top.get("reached_target"),
"scroll_top_after_gesture": top.get("scroll_top"),
- "traverse_step_px": step_px,
+ "traverse_step_px": top.get("step_px", step_px),
}
)
out.update(coverage)
diff --git a/tests/studio/studiobench/runtime/selftest/test_studiobench_readiness_live.py b/tests/studio/studiobench/runtime/selftest/test_studiobench_readiness_live.py
index 53707dcba1d..3dfbf2a8923 100644
--- a/tests/studio/studiobench/runtime/selftest/test_studiobench_readiness_live.py
+++ b/tests/studio/studiobench/runtime/selftest/test_studiobench_readiness_live.py
@@ -238,11 +238,13 @@ def _completeness(browser, mode: str, **kwargs) -> tuple[dict, list[str]]:
def test_a_virtualised_thread_passes_the_completeness_probe(browser):
out, _ = _completeness(browser, "windowed")
assert out["head_reached"] is True, out
- # The default 2,000px step jumps straight past this 2,160px thread, so coverage is unmeasured.
- assert out["ordinal_coverage_complete"] is None, out
- assert out["sweep_continuous"] is False
- assert "never in view" in out["coverage_reason"]
- assert out["ordinal_coverage_state"] == COVERAGE_UNMEASURED, out
+ # The default 2,000px step is capped to 3/4 of the 400px viewport, so the stops overlap and
+ # coverage is measured on a windowed arm without any step override.
+ assert out["traverse_step_px"] == 300, out
+ assert out["sweep_continuous"] is True, out
+ assert out["ordinal_coverage_complete"] is True, out
+ assert out["ordinal_coverage_state"] == COVERAGE_COMPLETE, out
+ assert out["ordinals_seen_count"] == MESSAGES
def test_a_virtualised_thread_covers_every_ordinal_when_the_sweep_is_continuous(browser):