Skip to content

Wire a declared button's activation when it is declared, not at paint - #1968

Merged
max-sixty merged 1 commit into
mainfrom
fix-held-replies-tab-back-flake
Oct 7, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix-held-replies-tab-back-flake

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A declared native button only began answering its clicks once the next repaint ran reflectButtons, which is where its click listener was attached. A press arriving between the declaration and that repaint did nothing.

The margin card's thread step showed it (test_a_shared_passage_steps_between_single_thread_cards):

  • Next builds the second thread's card and focuses it.
  • r, pressed right away, runs the thread scope's resolution row, which clicks the new card's Resolve.
  • That button has no listener yet, so no resolve is sent and the card keeps both threads.

On main the test failed 17 of 18 concurrent runs and every serial run. It passed when the test paused 300 ms before r. Bisecting puts the start at #1788, which moved button activation into the command owner.

attachScope now wires each button a declaration names as an element when the declaration is made. A control named by a getter may not exist yet, so it is still wired at paint. The listener resolves its command at the press, as before, so availability, replacement and refusal keep their meaning.

The margin test now passes 18 of 18 concurrent runs. A new runtime test in tests/runtime/command-controls.test.mjs clicks a button before any paint, and it fails without the change. These also pass:

  • npm run test:runtime (228 tests).
  • 133 browser tests selected by command, button, resolve, press and settle across the controls, navigation, widgets, margin and threads files.

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

A native button's click listener, which runs its declared command, was added
only by `reflectButtons` on the next repaint after the declaration. A press
reaching a button in between did nothing. The margin card's thread step
(`test_a_shared_passage_steps_between_single_thread_cards`) showed it: Next
builds the second thread's card and focuses it, and `r` pressed right away
ran the thread scope's resolution row, which clicked a Resolve no listener
had been attached to yet. No event was sent, so the card kept both threads.
The test failed 17 of 18 concurrent runs and every serial run on main, and
passed with a 300 ms pause before `r`. It started with #1788, which moved
button activation into the command owner.

`attachScope` now wires each button a declaration names as an element when
the declaration is made. A control named by a getter may not exist yet, and
is still wired at paint. The listener resolves its command at the press
either way, so availability and replacement keep their meaning.

The margin test now passes 18 of 18 concurrent runs. A runtime test clicks
a button before any paint, and fails without the change.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 55ba7de into main Oct 7, 2026
6 checks passed
@max-sixty
max-sixty deleted the fix-held-replies-tab-back-flake branch October 7, 2026 07:01
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.

2 participants