Skip to content

fix: restore synchronous margin contribution controls - #4451

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-4449
Oct 27, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-4449

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

#4330 changed mechanical annotation refreshes from synchronous drawing to queued presentation. A contribution's immediate control lookup therefore returns null; the first-placement test throws inside its frame callback without rejecting the promise Playwright is awaiting, hanging the worker for 30 minutes.

Partially revert that annotation scheduling change, restoring synchronous contribution lookup, retained-control updates and focus preparation. Keep #4330's disclosure-motion correction. The test now awaits the frame before creating and measuring the row, so an exception rejects the evaluation instead of stranding it.

This withdraws #4330's separate age-refresh repair: a newly opened card's message age can stay “just now” while a reply is drafted. The existing pointer disclosure test still fails at its “1m ago” assertion; its preceding motion assertions and the keyboard case pass. #4443 remains open for the presentation/clock-dependency decision and restoring that behavior without breaking control lookup. No age assertion is removed or weakened.

Validation: the revised first-placement test fails promptly against the broken runtime and passes with this repair. Both retained-control cases, Page Map reconciliation, More-click focus and spilled-thread opening pass (six focused browser tests); all 682 runtime tests pass and the browser kernel rebuild passes. Local Ruff is unavailable; CI owns lint. The existing plan-card-reply and plan-card-aging stills are unchanged; the latter does not reproduce the failing disclosure journey, so it does not establish that age repaint is preserved. Served review-a-plan startup retains 35 requests (31 code requests) through widget upgrade and first server-state presentation, with 203 fewer JavaScript bytes and no console errors or layout shifts.

Refs #4443. Closes #4449 — automated triage

Partially revert #4330: routing mechanical annotation drawing through the queued presenter makes registration.control return null in the same task. The first-placement test then throws inside a frame callback without rejecting its returned promise and hangs until the worker timeout. Restore synchronous drawing and let the async test propagate errors after its frame boundary. The first-placement and both retained-control browser cases pass.

This keeps the disclosure motion correction but withdraws the separate newly-opened-card age refresh; that behavior needs a repair which preserves contribution lookup and immediate updates. The existing age assertion is retained.

Closes #4449
@leaf-agent
leaf-agent merged commit 37e9061 into main Oct 27, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-4449 branch October 27, 2026 13:39
leaf-agent added a commit that referenced this pull request Nov 5, 2026
An open margin card's message ages stayed "just now" as time passed.
This restores the ages without giving up synchronous annotation drawing,
as decided on #4403: a direct annotation redraw now follows what it
reads and repaints through the presenter when one of those values
changes, the clock included.

**Cause.** #4451 restored synchronous annotation drawing so a
contribution's control and the focus prepared on it stand when the call
returns. That withdrew #4330's age repair. A direct redraw, and the card
that opening it draws, read their ages outside the annotation
presenter's tracking, so the clock tick never repainted them.

**Change.**
- `application.js`: `renderAnnotations` runs its paint inside an effect.
The first run paints synchronously. Any later change to a value it read
calls the presenter's `present()`. The presenter's next paint drops that
effect, because it reads everything again under its own tracking. A
direct redraw nested inside a paint is kept and released with it.
- `margin-projection.js`: opening a card redraws the margin directly, as
#4330 did, so the card's ages are among the values that redraw follows.
Cost: a card open now does one full annotation paint inside the click's
task. Before #4451, the same paint ran through the presenter.
- `tests/shift_watch.js`: a text reflow region (`data-lf-reflow="text"`)
is now bounded by what the text paints, not by its unclipped range. When
the age widened, the card's ellipsized receipt moved inside its head, as
the inline thread's does. Its clipped glyphs past the head's edge were
being reported as leaving the region. The inline case passed only
because its head is wide enough.

**Verification.** Three cases failed at "1m ago" before this change and
pass after it:
-
`tests/browser/test_render_shift_watch.py::test_message_age_may_shift_metadata_but_leaves_the_thread_in_place[card]`
and `[inline]`
-
`tests/journeys/margin/test_card_placement.py::test_a_press_in_the_card_keeps_the_pressed_spot_still[press]`
(the second caller named on #4403)

The tests from #4443, #4444, #4445, #4446 and #4449 still pass:
retained-control order, Page Map reconciliation, More-click and Tab
focus, spilled-thread opening, contribution lookup. So do the shift
watch's reflow and append controls, `pnpm run check:framework`, and
`pnpm run test:runtime` (812 pass).

<details><summary>Inherited failures in tests/browser/margin</summary>

Running the whole directory, four tests fail with identical messages on
both `main` and this branch:
-
`test_page_map.py::test_the_current_obligation_marks_its_selected_margin_reading`
(colour)
-
`test_status.py::test_an_acknowledgment_uses_status_until_an_active_claim_restores_a_disclosure`
(`Unknown contribution entry option: className`)
-
`test_entries.py::test_an_inline_contribution_name_needs_no_physical_margin[page]`
and `[overlay]`

This change does not cause them.

</details>

Closes #4403

Co-authored-by: leaf-agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Main browser worker times out during margin placement test

1 participant