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: step back over a gap the completeness traversal skipped (#17581)

Daniel Han13ef43494732
diff --git a/tests/studio/studiobench/runtime/readiness.py b/tests/studio/studiobench/runtime/readiness.py
index 053b32699be..836c25648f9 100644
--- a/tests/studio/studiobench/runtime/readiness.py
+++ b/tests/studio/studiobench/runtime/readiness.py
@@ -393,26 +393,48 @@ async ([toTop, steps, stepPx]) => {
}
ranges.push([lo, hi]);
};
+ const moveTo = async (top, deltaY) => {
+ vp.dispatchEvent(new WheelEvent("wheel", { deltaY, bubbles: true, cancelable: true }));
+ vp.scrollTo({ top, behavior: "instant" });
+ await window.__sbNextPaint();
+ record();
+ };
+ // Ordinals between two stops that no stop has mounted yet.
+ const unseenBetween = (lo, hi) => {
+ for (let k = lo; k <= hi; k += 1) if (!seen.has(k)) return true;
+ return false;
+ };
record();
for (let i = 0; i < maxSteps; i += 1) {
+ const prev = ranges.length ? ranges[ranges.length - 1] : null;
const next = toTop
? Math.max(0, vp.scrollTop - step)
: Math.min(vp.scrollHeight, vp.scrollTop + step);
- vp.dispatchEvent(
- new WheelEvent("wheel", { deltaY: direction * step, bubbles: true, cancelable: true }),
- );
- vp.scrollTo({ top: next, behavior: "instant" });
- await window.__sbNextPaint();
- record();
+ await moveTo(next, direction * step);
+ // A step shorter than the viewport can still open a gap: the list re-anchors scrollTop when
+ // rows above mount at their real height. Step back down in half steps until the rows between
+ // the two stops have mounted, then resume from where the step landed.
+ const here = ranges.length ? ranges[ranges.length - 1] : null;
+ if (toTop && prev && here && here !== prev && here[1] + 1 < prev[0]) {
+ const resume = vp.scrollTop;
+ let pos = resume;
+ for (let k = 0; k < 16 && unseenBetween(here[1] + 1, prev[0] - 1); k += 1) {
+ pos = Math.min(vp.scrollHeight, pos + Math.max(1, Math.floor(step / 2)));
+ await moveTo(pos, Math.max(1, Math.floor(step / 2)));
+ }
+ await moveTo(resume, -1);
+ }
if (toTop && vp.scrollTop <= 0) break;
if (!toTop && vp.scrollTop >= vp.scrollHeight - vp.clientHeight - 1) break;
}
- let continuous = ranges.length > 0;
- for (let i = 1; i < ranges.length; i += 1) {
- const a = ranges[i - 1];
- const b = ranges[i];
- // Touching counts as continuous: rows 1-6 followed by rows 7-12 leaves nothing between them.
- if (b[0] > a[1] + 1 || a[0] > b[1] + 1) { continuous = false; break; }
+ // Continuous when the stops' spans, taken together, leave no gap: touching counts, so rows 1-6
+ // and rows 7-12 leave nothing between them.
+ const spans = ranges.slice().sort((a, b) => a[0] - b[0]);
+ let continuous = spans.length > 0;
+ let reach = spans.length ? spans[0][1] : 0;
+ for (let i = 1; i < spans.length; i += 1) {
+ if (spans[i][0] > reach + 1) { continuous = false; break; }
+ reach = Math.max(reach, spans[i][1]);
}
const sorted = Array.from(seen).sort((a, b) => a - b);
return {
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 3dfbf2a8923..3aac0d6b252 100644
--- a/tests/studio/studiobench/runtime/selftest/test_studiobench_readiness_live.py
+++ b/tests/studio/studiobench/runtime/selftest/test_studiobench_readiness_live.py
@@ -258,6 +258,16 @@ def test_a_virtualised_thread_covers_every_ordinal_when_the_sweep_is_continuous(
assert out["ordinals_missing"] == []
+def test_a_scroll_anchor_jump_does_not_leave_coverage_unmeasured(browser):
+ """A re-anchoring jump can carry one step past a row even below the step cap; the traversal
+ steps back until that row mounts, so coverage stays measured and complete."""
+ out, _ = _completeness(browser, "windowed_anchor_jump")
+ assert out["head_reached"] is True, out
+ assert out["sweep_continuous"] is True, out
+ assert out["ordinal_coverage_state"] == COVERAGE_COMPLETE, out
+ assert out["ordinals_missing"] == []
+
+
def test_a_thread_that_lost_the_middle_passes_the_head_marker_and_fails_coverage(browser):
"""A store with only its first and last page passes the head marker; ordinal coverage catches it."""
out, got = _completeness(browser, "windowed_lost_middle")
diff --git a/tests/studio/studiobench/runtime/selftest/thread_fixture.js b/tests/studio/studiobench/runtime/selftest/thread_fixture.js
index 11c2db22d08..eea9c3f9fa0 100644
--- a/tests/studio/studiobench/runtime/selftest/thread_fixture.js
+++ b/tests/studio/studiobench/runtime/selftest/thread_fixture.js
@@ -20,6 +20,9 @@
"windowed_duplicate_ordinals",
// Window index published as the thread position, the likeliest accidental bug.
"windowed_from_one",
+ // Once, halfway up, scrollTop jumps 600px further, as a list re-anchoring on rows that mounted
+ // taller than estimated; a fixed step then skips a row.
+ "windowed_anchor_jump",
];
function marker(i) {
@@ -166,6 +169,14 @@
render(Math.max(0, state.store.length - windowSize), windowSize, true);
pin();
viewport.addEventListener("scroll", () => {
+ if (
+ mode === "windowed_anchor_jump" &&
+ !state.jumped &&
+ viewport.scrollTop < viewport.scrollHeight / 2
+ ) {
+ state.jumped = true;
+ viewport.scrollTop = Math.max(0, viewport.scrollTop - 600);
+ }
state.renderWindowAround(viewport.scrollTop);
jump.classList.toggle(
"invisible",