Skip to content

Margin and Page Map update tests read stale control order #4443

Closed

Description

@leaf-agent

Push CI run 40503090888, on 7edb75c0fb1007dcd56e5b651a0c5e539da59364, records this failure.

Affected cases:

  • tests/browser/margin/test_entries.py::test_lit_margin_projection_reorders_retained_controls_without_moving_the_user
  • tests/browser/margin/test_entries.py::test_lit_inline_margin_projection_keys_controls_inside_thread_chrome
  • tests/browser/margin/test_page_map.py::test_page_map_keyed_reconciliation_preserves_user_current_location

Immediately after registration.update({immediate: true}), the margin reading retains direct a and options [b,c] instead of direct b and options [a,c]; the inline reading retains [a,b] instead of [b,a]. Page Map likewise retains [keep,peer] instead of [peer,keep], and Action 1 instead of Moving action. Node identity and focus assertions pass. These are stale synchronous readings, distinct from #4427’s missing accessible name. Establish the update/presentation contract before deciding whether the tests or implementation need repair.

These cases passed in preceding push run 40494038541.

This report session read the CI diagnostic; it did not reproduce locally or establish the introducing change. Reproduce on current main and read the introducing change’s intent before choosing a repair. Consolidate with another cause only when reproduction establishes a shared mechanism.

Cause of a failure tracked in #3985.

Activity

  1. added
    tend-ci-cause
    on Oct 27, 2026
  2. leaf-agent commented on Oct 27, 2026

    @leaf-agent
    CollaboratorAuthor

    Reproduced all three failures on current main, 7edb75c0fb1007dcd56e5b651a0c5e539da59364. The introducing change is #4330: its annotation refresh now calls the application presenter so newly visible messages register their clock dependencies. That preserves the stale-age repair, but changes when contribution updates reach the DOM.

    The remaining choice is a contract conflict. Contributions promise synchronous settling for immediate updates, whereas presenters paint at the microtask checkpoint. The contribution subscriber still flushes layout immediately, before the newly scheduled inventory paint. This explains both the stale margin order and the stale Page Map inventory.

    Verification and repair boundary

    Ran the three node IDs in the issue together with uv run pytest … -q -n0: all failed with the reported old orders. In a temporary diagnostic, waiting for a frame followed by a task between each update and its DOM reading made all three pass, including the remaining identity, focus, press, retargeting, query, scroll and command-scope assertions. That diagnostic was removed; no tracked files changed. This establishes deferred presentation, not a permanent failure to reconcile.

    Simply restoring direct annotation painting would bypass the dependency tracking that #4330 added to fix message ages. Conversely, adding waits to these tests would withdraw the explicit synchronous-update guarantee. A repair should settle that boundary and preserve the clock dependency tracking rather than silently choose either side.

    @max-sixty, please settle whether registration.update({immediate: true}) must finish painting before returning, or whether callers should await the shared presentation pass. I recommend the shared presentation pass, consistent with the repository's presentation rule; that choice would require updating the contribution contract and these tests together. Leaving this issue open for that decision; no fix PR was opened.

  3. leaf-agent commented on Oct 27, 2026

    @leaf-agent
    CollaboratorAuthor

    #4445 reproduces the same deferred-annotation-paint mechanism on an ordinary More click, so this boundary also affects user focus rather than only synchronous test readings. The exact case is tests/browser/margin/test_clusters.py::test_one_target_has_one_primary_margin_entry_and_inline_secondary_margin_entries.

    On main at 7edb75c0fb1007dcd56e5b651a0c5e539da59364, options become visible but Reject remains inactive. Temporarily replacing the presenter call in renderAnnotations with direct paintAnnotations() makes the complete test pass (1 passed in 9.64s). The diagnostic was removed. setOptionsOpen requests the first option immediately after refresh; before the queued paint, that option is still hidden and its fallback reads the closed cluster. The eventual repair must preserve that intended focus destination while retaining #4330's clock dependency tracking. Consolidating #4445 here.

  4. leaf-agent commented on Oct 27, 2026

    @leaf-agent
    CollaboratorAuthor

    #4446 establishes a user-visible consequence of this same deferred annotation refresh. Its unchanged browser test fails on current main: Page Map's Open thread falls back to the panel because margin preparation reads its control before the requested redraw connects it, and the card closes immediately. Temporarily restoring direct paintAnnotations() in renderAnnotations makes the entire test pass, including card focus, closed-panel and reply-key assertions; the diagnostic change was removed.

    The repair here therefore also needs to cover tests/browser/margin/test_opening_threads.py::test_a_spilled_thread_opens_the_full_thread_without_a_hidden_anchor. Adding waits only to the synchronous-order tests would leave this product regression unresolved. #4446 retains the detailed reproduction and affected card-preparation path.

  5. leaf-agent commented on Oct 27, 2026

    @leaf-agent
    CollaboratorAuthor

    #4444 confirms the same refresh-before-focus mechanism for native Tab arrival in a folded pin. Both unchanged browser tests reproduce on current main: tests/browser/controls/test_press_away.py::test_a_press_away_folds_a_pin_s_unfolded_actions and tests/browser/margin/test_pins.py::test_a_pin_with_no_room_for_its_actions_stands_folded_and_unfolds_in_place (2 failed at Accept focus).

    A leaf-dev probe comparison across #4330 makes the user consequence explicit: the first Tab previously landed on Accept, followed by Reject and More; now it lands on More, then leaves the cluster on the next Tab. setOptionsOpen requests the first option before the queued annotation paint has exposed it and selects the toggle as its fallback. The repair tracked here needs to preserve this keyboard destination alongside #4445's More-click destination. #4444 holds the detailed reproduction and remains open for that shared repair; the pending contract decision stays with @max-sixty.

  6. leaf-agent commented on Oct 27, 2026

    @leaf-agent
    CollaboratorAuthor

    #4451 partially reverts #4330's annotation scheduling change under Reading a red suite. #4449 reproduces a concrete product-contract failure in the same path: creating a contribution and looking up its control returns null. In its original test this throws inside an animation-frame callback, leaving the promise Playwright awaits unresolved. Moving the test's work after an awaited frame exposes the TypeError promptly; restoring synchronous annotation drawing makes it pass. The two retained-control cases, Page Map reconciliation, More-click focus and spilled-thread opening also pass with that restoration.

    The repair preserves #4330's disclosure-motion correction but withdraws its separate age-refresh change. Both disclosure-motion routes still reach their motion assertions successfully; the pointer case then fails at tests/journeys/margin/test_card_placement.py:216, with “just now” instead of “1m ago”. That assertion remains intact. Existing card stills do not reproduce this disclosure sequence and are unchanged, so they provide no evidence that the age behavior survives.

    @max-sixty, this issue remains open for your judgment on the presentation boundary and returning the newly visible messages' clock dependencies without breaking synchronous control lookup and focus preparation. #4451 repairs the active hang without settling that design choice; its CI and review are still pending. No new scheduling mode, fallback or duplicate paint is added.

  7. leaf-agent commented on Oct 28, 2026

    @leaf-agent
    CollaboratorAuthor

    #4403 also belongs to this presentation-boundary decision. On current main, 809f0927bf1d6fbe394b243ee137d04f9c1e2fee, tests/browser/test_render_shift_watch.py::test_message_age_may_shift_metadata_but_leaves_the_thread_in_place[card] reproduces the unchanged “just now” failure after the first clock advance; its inline counterpart passes.

    Temporarily restoring #4330's two-part age repair—routing annotation refresh through the presenter and refreshing after opening the card—makes both cases complete their age and geometry assertions at one minute, ten minutes and three hours. The diagnostic is not a clean test pass: the card's teardown reports a 7px horizontal shift of .lf-msg-sending. It establishes the missing clock subscription as the age failure's mechanism, rather than a timer or fixed-Date failure. All diagnostic source and generated-kernel changes were removed.

    The existing decision for @max-sixty remains: restore clock tracking while preserving the synchronous contribution lookup and focus behavior that #4451 recovered. The eventual repair also needs to verify this exact card case, including its watches; #4403 stays open until that path is resolved.

  8. max-sixty commented on Nov 5, 2026

    @max-sixty
    Owner

    Closing as done. Its three stale-order tests, and the tests consolidated into it from #4444, #4445 and #4446, have passed on every run since #4451 restored synchronous contribution controls. What remains, how age refresh gets its clock subscription, is #4403's failing test and decision.

    This was written by Claude Code on behalf of max-sixty

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