Skip to content

test_a_press_in_the_task_a_script_repeats_a_marked_phrase_opens_nothing: an ambiguous quote's press opens a margin card (since #7563) #7581

Done

Description

@leaf-agent

tests/browser/test_render_anchors.py::test_a_press_in_the_task_a_script_repeats_a_marked_phrase_opens_nothing, in both [browser] and [firefox_browser], fails on every run from #7563 (6e7004dbd) through current main (3cce8ff2c), and passes on its parent b67c5abf7.

In the test, a script adds a second copy of a marked phrase, and a press on the phrase in that same task should open no margin card, since nothing tells the two copies apart (AGENTS.md, "Validate once and share readings": an ambiguous quote stands on its section or in Threads). Instead a card opens:

assert card.count() == 0
AssertionError: assert 1 == 0
  where count = <Locator … url='…/versions/v1.html?thread=…'> selector='.lf-margin-preview:not([hidden])'>.count

#7563 changed the render's handling of the selected card in margin-projection.js. Before, a card whose entry left the inventory closed (closePreview()). Now followCardThread first tries openInlineThread(id, { unfold: false, card: true }) for the card's thread, and showNextAtTarget then opens the next thread threadEntryAt finds at the old target. Either path may now reopen a card that the ambiguous quote should have taken out of the margin. The mechanism I'd check first is that threadEntry(id) or threadEntryAt(target) still finds an entry for the thread while its quote is ambiguous. This is a code reading I haven't confirmed.

Seen in run 46202905667 on 73e842a64. Reproduced locally on 3cce8ff2c with uv run pytest -n 3 -p no:randomly over that node id. Bisected over 25f9d33f9..73e842a64 by running the test at b67c5abf7 (pass) and 6e7004dbd (fail).

Cause of a failure tracked in #7579.

Activity

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

    @leaf-agent
    CollaboratorAuthor

    Fix in #7584. The ambiguous quote did move the thread off the phrase. The press reopened the card because the anchor paint's replace returned to a whole repaint before it dropped the passage's pieces from the hit-test index, so markHit in the same task still found the old mark. That press already opened a card at b67c5abf7, but the next margin render closed it again. #7563's followCardThread now keeps the card with the thread in its new row, which is why the test went red at that commit. Neither threadEntry nor threadEntryAt was at fault, and #7563's behavior stays as it is.

    The test fails in both engines on 9e2e64d34 and passes with the fix, and the threads, margin-opening and runtime tests pass too. The PR's own CI and landing are next, and tend-land handles them.

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