Read the search match's box in the frame that drew it - #111
Conversation
|
Independent confirmation from the The newest occurrence is 33269374595 on A probe that read the handle four times in a row and then read the page confirms the direction: every handle answered Probe output — six runs, six identical page readings
Bug-back on this fixture: with Opening no PR of my own. With this merged, the nightly suite at |
|
The load dependence in the comment above has a named cause, and it is #112: That is a correction to this PR's stated mechanism, not to its fix. Stamping every mark |
Problem
tests/test_render_semantic_selection.py::test_selection_search_scrolls_to_the_match_inside_a_tall_text_blockfails intermittently onmain— 33267454160 and 33269218355 — withTypeError: 'NoneType' object is not subscriptable, becausebounding_box()returnedNonefor a mark that is on screen.paintHeredraws every match as spans it replaces whole (selectionLayer.replaceChildren), and the search's own instantscrollToRangedelivers its scroll event a frame later, which repaints. A Playwright handle taken between those two paints is measured after its node has been swapped for an identical one, so the detached node reads as an element with no box.Evidence
Reproduced here at
-n0: 4 of 8, then 3 of 10. A probe dumping the DOM either side of the read shows the page is correct both times and only the handle is stale:Solution
Read the mark and the key line in one
page.evaluate, so both boxes come off the frame that drew them and no handle outlives a repaint. The assertion is the same three numbers in the same relation; every other geometry reading in this file already takes them this way, and there is no otherbounding_box()call in it.Testing
uv run pytest tests/test_render_semantic_selection.py::test_selection_search_scrolls_to_the_match_inside_a_tall_text_block --run-nightly -n0— 12 consecutive passes, against 4-in-8 and 3-in-10 failures before.uv run pytest tests/test_render_semantic_selection.py --run-nightly— 16 passed.pre-commit run --files tests/test_render_semantic_selection.py— clean.