Skip to content

test: drop MarkdownStream auto-scroll event waits once shinychat ships the pinning fix #2435

Open

Description

@schloerke

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:

  1. Delete SCROLL_TO_SCRIPT (L53) and scroll_to_and_wait_for_scroll_event() (L65), replacing the two call sites (L153 Phase B, L160 Phase C) with a plain page.evaluate that scrolls the container.
  2. Drop the now-stale comments explaining the wait (L48–52, L151, L158).
  3. Bump the shinychat floor in pyproject.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).

Relates to #2378, #2351, #2355.

Activity

  1. added
    choreA maintenance task that doesn't affect functionality
    testingRelated to testing shiny apps
    on Aug 12, 2026
  2. added
    Priority: LowLow-impact bug, docs polish, papercut, or unclear low-severity request.
    ai-triage:doneMarks an issue whose AI triage workflow is complete.
    on Aug 13, 2026
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

    Priority: LowLow-impact bug, docs polish, papercut, or unclear low-severity request.ai-triage:doneMarks an issue whose AI triage workflow is complete.choreA maintenance task that doesn't affect functionalitytestingRelated to testing shiny apps

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions