Repository navigation
test: drop MarkdownStream auto-scroll event waits once shinychat ships the pinning fix #2435
Description
Summary
test_auto_scroll_pinning currently waits for scroll-event delivery before streaming each chunk. That wait was added by #2355 as a test-side mitigation while the underlying product bug was still open. The bug is now fixed upstream in posit-dev/shinychat#282 (merged 2026-07-31, 640b5d8), which closed #2378.
Once a shinychat release carries that fix, the waits should come out.
Why this matters
The waits don't just add slack — they route around the bug. The test passes because it guarantees shinychat's scroll handler observes the at-bottom position before the next chunk grows scrollHeight. That is precisely the ordering the bug depended on, so as written the test cannot detect a regression of #2378. Removing the waits converts it from a test that avoids the race into a direct check of the fixed behavior.
Blocked on
A shinychat release containing posit-dev/shinychat#282. Latest release is 0.6.0 (2026-07-06), which predates the fix.
What to do
In tests/playwright/shiny/components/MarkdownStream/auto_scroll/test_stream_auto_scroll.py:
- Delete
SCROLL_TO_SCRIPT(L53) andscroll_to_and_wait_for_scroll_event()(L65), replacing the two call sites (L153 Phase B, L160 Phase C) with a plainpage.evaluatethat scrolls the container. - Drop the now-stale comments explaining the wait (L48–52, L151, L158).
- Bump the
shinychatfloor inpyproject.toml(L109, currently>=0.6.0) to the release that carries the fix.
Then confirm the test still passes on Firefox and fails against shinychat 0.6.0 — if it passes on 0.6.0 too, the waits weren't the only thing masking the race and the removal needs a second look.
Verifying the released asset actually has the fix
Reproduction from the #2378 investigation: delay delivery of shinychat's scroll callback by 400 ms (emulating the lagging Firefox paint tick) while leaving the test's own listener undelayed, via page.add_init_script:
window.__delayScroll = true;
const origAdd = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function (type, cb, opts) {
if (type === "scroll" && window.__delayScroll && typeof cb === "function") {
return origAdd.call(this, type, (...a) => setTimeout(() => cb(...a), 400), opts);
}
return origAdd.call(this, type, cb, opts);
};Run the existing auto_scroll/app.py through chunks 1–5, unpinning before chunk 4 and re-pinning before chunk 5 with __delayScroll re-enabled. Against the fix, the container ends flush at the bottom (scrollTop 2558); against 0.6.0 it stalls at the #2378 signature (scrollTop 1998, scrollHeight 2816, clientHeight 258).
Activity