Skip to content

Offscreen thread arrival lacks the expected focused margin card #5146

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.navigation.test_threads::test_an_offscreen_thread_card_arrives_with_its_anchor[above-or-below-up] — Linux
browser = <render_harness.WatchedBrowser object at 0x7f8d86e94fb0>
serve = <function serve.<locals>.go at 0x7f8d84d8b600>, from_below = True
width = 390

    @pytest.mark.parametrize(
        ("width", "from_below"),
        [
            pytest.param(1440, False, id="beside-down"),
            pytest.param(390, True, id="above-or-below-up"),
        ],
    )
    def test_an_offscreen_thread_card_arrives_with_its_anchor(
        browser, serve, from_below, width
    ):
        """A distant card arrives with its anchor and retraces the same attachment on return."""
        context = "".join(f"<p>Reading context {i}.</p>" for i in range(40))
        page = open_page(
            browser,
            serve(
                leaf_page(
                    "Thread arrival",
                    f"<h1>Thread arrival</h1>{context}"
                    '<p id="destination">The distant passage to review.</p>'
                    f"{context}",
                ),
                anchored=[("destination", "The distant passage")],
            ),
        )
        resized(page, width, 900)
        page.evaluate(
            """below => {
              scrollTo({top: below ? document.scrollingElement.scrollHeight : 0,
                behavior: 'instant'});
              window.arrivalFrames = [];
              window.sampleArrival = true;
              const sample = () => {
                const card = document.querySelector('.lf-margin-preview');
                if (card?.checkVisibility()) {
                  const box = card.getBoundingClientRect();
                  const target = document.querySelector('#destination').getBoundingClientRect();
                  window.arrivalFrames.push({top: box.top, bottom: box.bottom,
                    height: box.height, targetTop: target.top, targetBottom: target.bottom,
                    head: 0,
                    foot: innerHeight});
                }
                if (window.sampleArrival) requestAnimationFrame(sample);
              };
              requestAnimationFrame(sample);
            }""",
            from_below,
        )
        page.keyboard.press("t")
>       expect(page.locator(".lf-margin-preview .lf-page-thread")).to_be_focused()
E       AssertionError: Locator expected to be focused
E       Actual value: None
E       Error: element(s) not found 
E       Call log:
E         - Expect "to_be_focused" locator(".lf-margin-preview .lf-page-thread") with timeout 120000ms
E         - waiting for locator(".lf-margin-preview .lf-page-thread")
E       
E       Aria snapshot:
E       - main:
E         - heading "Thread arrival" [level=1]
E         - paragraph: Reading context 0.
E         - paragraph: Reading context 1.
E         - paragraph: Reading context 2.
E         - paragraph: Reading context 3.
E         - paragraph: Reading context 4.
E         - paragraph: Reading context 5.
E         - paragraph: Reading context 6.
E         - paragraph: Reading context 7.
E         - paragraph: Reading context 8.
E         - paragraph: Reading context 9.
E         - paragraph: Reading context 10.
E         - paragraph: Reading context 11.
E         - paragraph: Reading context 12.
E         - paragraph: Reading context 13.
E         - paragraph: Reading context 14.
E         - paragraph: Reading context 15.
E         - paragraph: Reading context 16.
E         - paragraph: Reading context 17.
E         - paragraph: Reading context 18.
E         - paragraph: Reading context 19.
E         - paragraph: Reading context 20.
E         - paragraph: Reading context 21.
E         - paragraph: Reading context 22.
E         - paragraph: Reading context 23.
E         - paragraph: Reading context 24.
E         - paragraph: Reading context 25.
E         - paragraph: Reading context 26.
E         - paragraph: Reading context 27.
E         - paragraph: Reading context 28.
E         - paragraph: Reading context 29.
E         - paragraph: Reading context 30.
E         - paragraph: Reading context 31.
E         - paragraph: Reading context 32.
E         - paragraph: Reading context 33.
E         - paragraph: Reading context 34.
E         - paragraph: Reading context 35.
E         - paragraph: Reading context 36.
E         - paragraph: Reading context 37.
E         - paragraph: Reading context 38.
E         - paragraph: Reading context 39.
E         - paragraph: The distant passage to review.
E         - paragraph: Reading context 0.
E         - paragraph: Reading context 1.
E         - paragraph: Reading context 2.
E         - paragraph: Reading context 3.
E         - paragraph: Reading context 4.
E         - paragraph: Reading context 5.
E         - paragraph: Reading context 6.
E         - paragraph: Reading context 7.
E         - paragraph: Reading context 8.
E         - paragraph: Reading context 9.
E         - paragraph: Reading context 10.
E         - paragraph: Reading context 11.
E         - paragraph: Reading context 12.
E         - paragraph: Reading context 13.
E         - paragraph: Reading context 14.
E         - paragraph: Reading context 15.
E         - paragraph: Reading context 16.
E         - paragraph: Reading context 17.
E         - paragraph: Reading context 18.
E         - paragraph: Reading context 19.
E         - paragraph: Reading context 20.
E         - paragraph: Reading context 21.
E         - paragraph: Reading context 22.
E         - paragraph: Reading context 23.
E         - paragraph: Reading context 24.
E         - paragraph: Reading context 25.
E         - paragraph: Reading context 26.
E         - paragraph: Reading context 27.
E         - paragraph: Reading context 28.
E         - paragraph: Reading context 29.
E         - paragraph: Reading context 30.
E         - paragraph: Reading context 31.
E         - paragraph: Reading context 32.
E         - paragraph: Reading context 33.
E         - paragraph: Reading context 34.
E         - paragraph: Reading context 35.
E         - paragraph: Reading context 36.
E         - paragraph: Reading context 37.
E         - paragraph: Reading context 38.
E         - paragraph: Reading context 39.
E       - navigation "Page Map, 1 locations":
E         - toolbar "Changes, threads, items on me, delivery status, and activity":
E           - group "Page actions for paragraph · The distant passage to review. · “The distant passage”":
E             - button "Thread, 1 of 1, 50 percent down, paragraph · The distant passage to review. · “The distant passage”"
E       - dialog:
E         - text: Thread 1 of 1
E         - region "Leaf":
E           - button "Back to Threads"
E           - heading "About this bit." [level=2]
E           - button "Show on page"
E           - button "Resolve thread"
E           - button "Close"
E           - blockquote: “The distant passage”
E           - text: Me
E           - time: 2m ago
E           - text: ·Queued for Claude
E           - button "Edit message"
E           - button "Copy as Markdown"
E           - paragraph: About this bit.
E           - button "Page menu · Away"
E           - textbox "Reply to About this bit.":
E             - /placeholder: Reply c
E       - button "1 comment on § paragraph · The distant passage to review.": 1 comment

/home/runner/work/leaf/leaf/tests/browser/navigation/test_threads.py:173: AssertionError
tests.browser.navigation.test_threads::test_an_offscreen_thread_card_arrives_with_its_anchor[above-or-below-up] — macOS
browser = <render_harness.WatchedBrowser object at 0x11c690ad0>
serve = <function serve.<locals>.go at 0x11c61a0c0>, from_below = True
width = 390

    @pytest.mark.parametrize(
        ("width", "from_below"),
        [
            pytest.param(1440, False, id="beside-down"),
            pytest.param(390, True, id="above-or-below-up"),
        ],
    )
    def test_an_offscreen_thread_card_arrives_with_its_anchor(
        browser, serve, from_below, width
    ):
        """A distant card arrives with its anchor and retraces the same attachment on return."""
        context = "".join(f"<p>Reading context {i}.</p>" for i in range(40))
        page = open_page(
            browser,
            serve(
                leaf_page(
                    "Thread arrival",
                    f"<h1>Thread arrival</h1>{context}"
                    '<p id="destination">The distant passage to review.</p>'
                    f"{context}",
                ),
                anchored=[("destination", "The distant passage")],
            ),
        )
        resized(page, width, 900)
        page.evaluate(
            """below => {
              scrollTo({top: below ? document.scrollingElement.scrollHeight : 0,
                behavior: 'instant'});
              window.arrivalFrames = [];
              window.sampleArrival = true;
              const sample = () => {
                const card = document.querySelector('.lf-margin-preview');
                if (card?.checkVisibility()) {
                  const box = card.getBoundingClientRect();
                  const target = document.querySelector('#destination').getBoundingClientRect();
                  window.arrivalFrames.push({top: box.top, bottom: box.bottom,
                    height: box.height, targetTop: target.top, targetBottom: target.bottom,
                    head: 0,
                    foot: innerHeight});
                }
                if (window.sampleArrival) requestAnimationFrame(sample);
              };
              requestAnimationFrame(sample);
            }""",
            from_below,
        )
        page.keyboard.press("t")
>       expect(page.locator(".lf-margin-preview .lf-page-thread")).to_be_focused()
E       AssertionError: Locator expected to be focused
E       Actual value: None
E       Error: element(s) not found 
E       Call log:
E         - Expect "to_be_focused" locator(".lf-margin-preview .lf-page-thread") with timeout 120000ms
E         - waiting for locator(".lf-margin-preview .lf-page-thread")
E       
E       Aria snapshot:
E       - main:
E         - heading "Thread arrival" [level=1]
E         - paragraph: Reading context 0.
E         - paragraph: Reading context 1.
E         - paragraph: Reading context 2.
E         - paragraph: Reading context 3.
E         - paragraph: Reading context 4.
E         - paragraph: Reading context 5.
E         - paragraph: Reading context 6.
E         - paragraph: Reading context 7.
E         - paragraph: Reading context 8.
E         - paragraph: Reading context 9.
E         - paragraph: Reading context 10.
E         - paragraph: Reading context 11.
E         - paragraph: Reading context 12.
E         - paragraph: Reading context 13.
E         - paragraph: Reading context 14.
E         - paragraph: Reading context 15.
E         - paragraph: Reading context 16.
E         - paragraph: Reading context 17.
E         - paragraph: Reading context 18.
E         - paragraph: Reading context 19.
E         - paragraph: Reading context 20.
E         - paragraph: Reading context 21.
E         - paragraph: Reading context 22.
E         - paragraph: Reading context 23.
E         - paragraph: Reading context 24.
E         - paragraph: Reading context 25.
E         - paragraph: Reading context 26.
E         - paragraph: Reading context 27.
E         - paragraph: Reading context 28.
E         - paragraph: Reading context 29.
E         - paragraph: Reading context 30.
E         - paragraph: Reading context 31.
E         - paragraph: Reading context 32.
E         - paragraph: Reading context 33.
E         - paragraph: Reading context 34.
E         - paragraph: Reading context 35.
E         - paragraph: Reading context 36.
E         - paragraph: Reading context 37.
E         - paragraph: Reading context 38.
E         - paragraph: Reading context 39.
E         - paragraph: The distant passage to review.
E         - paragraph: Reading context 0.
E         - paragraph: Reading context 1.
E         - paragraph: Reading context 2.
E         - paragraph: Reading context 3.
E         - paragraph: Reading context 4.
E         - paragraph: Reading context 5.
E         - paragraph: Reading context 6.
E         - paragraph: Reading context 7.
E         - paragraph: Reading context 8.
E         - paragraph: Reading context 9.
E         - paragraph: Reading context 10.
E         - paragraph: Reading context 11.
E         - paragraph: Reading context 12.
E         - paragraph: Reading context 13.
E         - paragraph: Reading context 14.
E         - paragraph: Reading context 15.
E         - paragraph: Reading context 16.
E         - paragraph: Reading context 17.
E         - paragraph: Reading context 18.
E         - paragraph: Reading context 19.
E         - paragraph: Reading context 20.
E         - paragraph: Reading context 21.
E         - paragraph: Reading context 22.
E         - paragraph: Reading context 23.
E         - paragraph: Reading context 24.
E         - paragraph: Reading context 25.
E         - paragraph: Reading context 26.
E         - paragraph: Reading context 27.
E         - paragraph: Reading context 28.
E         - paragraph: Reading context 29.
E         - paragraph: Reading context 30.
E         - paragraph: Reading context 31.
E         - paragraph: Reading context 32.
E         - paragraph: Reading context 33.
E         - paragraph: Reading context 34.
E         - paragraph: Reading context 35.
E         - paragraph: Reading context 36.
E         - paragraph: Reading context 37.
E         - paragraph: Reading context 38.
E         - paragraph: Reading context 39.
E       - navigation "Page Map, 1 locations":
E         - toolbar "Changes, threads, items on me, delivery status, and activity":
E           - group "Page actions for paragraph · The distant passage to review. · “The distant passage”":
E             - button "Thread, Still queued for Claude, 1 of 1, 50 percent down, paragraph · The distant passage to review. · “The distant passage”"
E       - dialog:
E         - text: Thread 1 of 1
E         - region "Leaf":
E           - button "Back to Threads"
E           - heading "About this bit." [level=2]
E           - button "Show on page"
E           - button "Resolve thread"
E           - button "Close"
E           - blockquote: “The distant passage”
E           - text: Me
E           - time: 2m ago
E           - text: ·Still queued for Claude
E           - button "Edit message"
E           - button "Copy as Markdown"
E           - paragraph: About this bit.
E           - button "Page menu · Not answering — nudge the terminal"
E           - textbox "Reply to About this bit.":
E             - /placeholder: Reply c
E       - button "1 comment on § paragraph · The distant passage to review.": 1 comment

/Users/runner/work/leaf/leaf/tests/browser/navigation/test_threads.py:173: AssertionError

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

    The test was stale, not the product. #5039 opens threads in the floating panel on a window too narrow for the rail, so at 390px t never draws the .lf-margin-preview this case waited for. The failure's aria snapshot shows the thread open in the panel dialog instead. #5357 runs both arrival directions on a wide window, where the card is still the thread's surface. The failing case reproduced on main locally, and the two new cases pass there. The PR's CI is pending.

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