Skip to content

Tall-target comment never reaches its expected viewport state #5134

Closed

Description

@leaf-agent

The scheduled run 41432142330 records the following failing boundary. This is CI evidence, not a claim that the failure persists on current main or that its cause is established.

Reconcile current main, existing repairs and active work before reproducing. Diagnose the shared failing operation before choosing a fix; split ownership if reproduction establishes different mechanisms. Preserve the intended behavior from the originating changes and follow the repository’s focused verification, review and landing gates.

tests.browser.test_render_aim::test_a_comment_uses_the_viewport_when_its_target_fills_the_vertical_lane — macOS
browser = <render_harness.WatchedBrowser object at 0x11bcc9af0>
serve = <function serve.<locals>.go at 0x11d6b2d40>

    def test_a_comment_uses_the_viewport_when_its_target_fills_the_vertical_lane(
        browser, serve
    ):
        """A target occupying the lane does not reduce its editor to one line."""
        page = open_page(
            browser,
            serve(
                leaf_page(
                    "A section target",
                    '<section id="target" style="min-height: 150vh">'
                    "<h2>The section begins at the top of the reading band</h2>"
                    "<p>Its content continues past the bottom of the viewport.</p>"
                    '<div style="height: 480px"></div></section>',
                )
            ),
        )
        resized(page, 511, 336)
        target = page.locator("#target")
        target.click(modifiers=["Alt"], position={"x": 200, "y": 25})
        field = open_compact_comment(page)
        bar = page.locator(".lf-fab-bar")
        assert bar.get_attribute("data-lf-placement") in {"top-start", "bottom-start"}
    
        write(field, "\n".join(f"Line {n}: keep the draft visible." for n in range(3)))
        rendered(page)
        assert field.evaluate(
            "node => node.clientHeight === node.scrollHeight && node.clientHeight > 60"
        )
    
        write(field, "\n".join(f"Line {n}: keep the draft reachable." for n in range(40)))
        page.wait_for_function(
            """() => {
              const field = document.querySelector('.lf-fab-input');
              return field.scrollHeight > field.clientHeight;
            }"""
        )
        box = bar.bounding_box()
        ceiling = page.evaluate(SHOWN_TOP)
        assert box["y"] >= ceiling and box["y"] + box["height"] <= 328, box
    
        field.evaluate("node => { node.scrollTop = 0; }")
        field.click(position={"x": 20, "y": 20})
        field_scroll = field.evaluate("node => node.scrollTop")
        page_scroll = page.evaluate("scrollY")
        page.mouse.wheel(0, 180)
>       page.wait_for_function(
            "before => document.querySelector('.lf-fab-input').scrollTop > before",
            arg=field_scroll,
        )

/Users/runner/work/leaf/leaf/tests/browser/test_render_aim.py:1038: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/leaf/leaf/.venv/lib/python3.12/site-packages/playwright/sync_api/_generated.py:21235: in wait_for_function
    self._sync(
/Users/runner/work/leaf/leaf/.venv/lib/python3.12/site-packages/playwright/_impl/_page.py:1158: in wait_for_function
    return await self._main_frame.wait_for_function(**locals_to_params(locals()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/runner/work/leaf/leaf/.venv/lib/python3.12/site-packages/playwright/_impl/_frame.py:945: in wait_for_function
    await self._channel.send("waitForFunction", self._timeout, params)
/Users/runner/work/leaf/leaf/.venv/lib/python3.12/site-packages/playwright/_impl/_connection.py:78: in send
    return await self._connection.wrap_api_call(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <playwright._impl._connection.Connection object at 0x10c54cf20>
cb = <function Channel.send.<locals>.<lambda> at 0x11b6787c0>
is_internal = False, title = None

    async def wrap_api_call(
        self, cb: Callable[[], Any], is_internal: bool = False, title: str = None
    ) -> Any:
        if self._api_zone.get():
            return await cb()
        task = asyncio.current_task(self._loop)
        parsed_st = _attach_api_call_information(
            getattr(task, "__pw_stack__", None) or _capture_stack_trace(),
            is_internal,
            title,
        )
        self._api_zone.set(parsed_st)
        try:
            return await cb()
        except Exception as error:
>           raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
E           playwright._impl._errors.TimeoutError: Page.wait_for_function: Timeout 120000ms exceeded.

/Users/runner/work/leaf/leaf/.venv/lib/python3.12/site-packages/playwright/_impl/_connection.py:636: TimeoutError

The full tracebacks are in that run’s pytest-results-* JUnit artifacts.

Cause of a failure tracked in #4225.

Activity

  1. added
    tend-ci-cause
    on Nov 3, 2026
  2. leaf-agent commented on Nov 4, 2026

    @leaf-agent
    CollaboratorAuthor

    This is a macOS-only intermittent failure, and I couldn't reproduce it here, so it stays open without a fix. The test failed once in the last nine scheduled test-macos runs. It passed in the runs before and after: run 41622727492 on 19757c94c passed it in 2.4 s. On Linux it passed in both scheduled runs I checked, the failing one included, and in 54 local copies under leaf-dev flake at --cpu-throttle 1, 8 and 20.

    The failure is at the wheel step. Its precondition held: the field overflowed and the bar sat inside the viewport. The failure screenshot shows the page scrolled instead, with the comment box pushed above the top of the window and only Line 39 still visible. So the wheel seems to have scrolled the page rather than the field, and the field's scrollTop never rose. The trailing scrollY == page_scroll assertion is the one that would have named this, but the 120 s wait timed out before reaching it. I found no runtime handler that redirects a wheel away from .lf-fab-input: the wheel listeners under browser/runtime/ only observe it. So the open question is why macOS Chromium sometimes routes Playwright's synthetic wheel at the click point to the page, and this machine can't answer it.

    The next diagnostic needs macOS. The scheduled test-macos job runs this test daily. A second failure with the same screenshot would justify ordering the test on something stronger than the click before the wheel, for example reading elementFromPoint at the mouse position before scrolling. A pass streak would point to a one-off.

    Per-run record (scheduled ci, test-macos JUnit)
    run head result
    41622727492 19757c9 passed, 2.4 s
    41432142330 72afa89 failed, 122.7 s (wait timeout)
    41299273709 cc5df72 passed
    41194441570 d995f3e passed
    41043755219 ad253a2 passed
    40860803124 583064c passed
    40675368197 809f092 passed
    40492069054 7cbf678 passed
    40311120380 f919fde passed

    Reproduce locally with uv run leaf-dev flake --cpu-throttle 8 "tests/browser/test_render_aim.py::test_a_comment_uses_the_viewport_when_its_target_fills_the_vertical_lane" (18/18 passed on Linux).

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

    tend-ci-cause

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions