Skip to content

Margin suggestion tests error at teardown since #7481: an unchanged aria-expanded write on the margin's More button #7500

Todo

Description

@leaf-agent

Two tests error at teardown with unchanged write: aria-expanded on button.lf-margin-face.lf-margin-more.lf-ui.lf-ui-face.lf-margin-entry:

  • tests/browser/margin/test_clusters.py::test_suggestion_actions_stay_reachable_through_a_decision_and_its_undo
  • tests/browser/test_render_margin.py::test_a_decision_undone_leaves_every_suggestion_pin_where_it_stood

#7481 gathers the threads a closed box hides under one marker, and a box opening or closing costs one more render. margin-cluster-view.js sets aria-expanded on the More button through keeps(this.#more, "aria-expanded", model.optionsOpen), and the suite's unchanged-write watch reports a write that leaves the value as it was. The extra render most likely rewrites it without a change. The repair belongs in the code that writes the value, not in the watch.

First failing run: 46099887165; every push run after it through 46099887165 also fails.

All of these fail on cd2495ac7 (current main when diagnosed) on the Tend runner, running each node id with uv run pytest -n 3. A bisect over main's first-parent commits put the first failing commit at the PR named in the title: each test passes at the commit before it and fails at it.

Cause of a failure tracked in #7387.

Activity

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

    @leaf-agent
    CollaboratorAuthor

    The diagnosis holds, but the writer isn't keeps: each attribute write there is already guarded. The cluster is presented twice in one script with different models: first unfolded, then folded. The watch sees a value that went false → true → false. I don't have a fix I can defend yet, so this needs a call on where the fold should be decided.

    What happens on the undo. Both tests fail the same way, and I reproduced both on d0618e073 with uv run pytest -n 2 <node ids>. In each, a suggestion's pin that the decision had left with no options gets them back:

    1. The reading's effect presents the pin unfolded. It has never stood folded, so standsFolded is false, optionsOpen is true and the More button gets aria-expanded="true".
    2. In the same script, the contribution's focus landing settles with immediate: true (contributions.ts). That flushes the layout synchronously (application.ts). The pass finds no room and folds the pin (seatEntry → standFolded → fold.changed).
    3. fold.changed is now refreshAfterPass, which calls afterScript(renderAnnotations.refresh) (margin-projection.js). The request arrives while settleScript is already running, so it joins that loop and the folded render runs before the mutation observer delivers. aria-expanded, data-lf-options-open and the options group's hidden all end the script where they started.

    Why #7481 surfaced it. At #7481's parent the same three presents happen in the same task; I checked with the same probes. The fold's refresh ran through queueMicrotask then (refoldQueued), so it was queued after the observer's delivery and the watch saw two scripts. #7481 folded that refresh into refreshAfterPass on afterScript. That moved the second render ahead of the delivery but didn't add the write. The restatement predates #7481; the watch just didn't see it before.

    What the fix has to decide. The fold depends on seating room, which the layout pass reads from the page. So the projection can't know whether to present the pin folded until a pass has run, and an immediate flush puts that pass in the same script as the render.

    • Putting the fold's refresh back on a plain microtask makes both tests pass. But it only moves the second render back behind the observer's delivery. That is the watch's blind spot, not a fix in the writer, and afterScript's own header calls this pattern "a write that changes nothing".
    • A fix in the writer would have the pin presented once in the form the pass decides on, at least when the flush is immediate. For example, the pass could decide the fold of a row that newly becomes foldable before the projection presents it. That changes how the projection and the layout share the fold, a core render/layout mechanism (AGENTS.md, "Complicating the core").

    The next step is choosing between those two directions, or a third. Assigning @max-sixty as #7481's author.

    Probe trace (head, test_a_decision_undone_leaves_every_suggestion_pin_where_it_stood)

    Each line is one present of a cluster's More button, or one fold change, grouped by task:

    task 10  s-insert  was null   open false folded false   (new host after the decision)
    task 11  s-insert  was false  open true  folded false   renderNow < paintAnnotations < follow (effect)
    task 11  s-insert  FOLD true  seatEntry < layoutMountedRows < flushLayout < settle < landFocus < settleScript
    task 11  s-insert  was true   open false folded true    renderNow < paintAnnotations < follow
    

    The parent of #7481 shows the identical task-11 sequence. test_suggestion_actions_stay_reachable_through_a_decision_and_its_undo folds through the same landFocus → flushLayout path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

tend-ci-cause

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions