Repository navigation
Give packages independent Thread views and typed actions - #1288
Merged
Merged
Conversation
Use one Thread collection and action path for core and package consumers. Scope panel interaction state per instance and keep optional mirrors from delaying core presentation.
…interface # Conflicts: # skills/leaf/assets/runtime/thread/thread-list.js
leaf-agent
approved these changes
Sep 27, 2026
max-sixty
added a commit
that referenced
this pull request
Sep 27, 2026
…he remaining tests, and locate margin controls by kind (#1295) #1276, #1285 and #1289 moved the suite onto the product's own readings; #1288's parallel thread work re-introduced two of the copies they had removed, and `test_render_controls.py`, `test_render_threads.py` and `test_render_application_boundary.py` still carried a few more. **Runtime modules.** Two sites in `test_render_threads.py` still resolved `/runtime/…` from the page's `<script data-lf-entry>` inline, instead of the harness's `window.__lfRuntimeImport`. Both now go through it, the way #1276 moved every other page-side import. **Interaction log.** Four sites in `test_render_application_boundary.py` still split `interactions.jsonl` with `read_text().splitlines()`, which also splits on a U+2028 inside a recorded value. They now read it through `interaction_log.lines`, the product's own reader, already used the same way for `events.jsonl` via `event_log.read_events`. **Margin controls by kind.** `render_harness.py` had `margin_control`, `draft_control` and `suggestion_control` for one exact id, but four sites in `test_render_controls.py` and one in `test_render_threads.py` still spelled `[data-lf-margin-entry-owner^="suggestion:"]` or `^="draft:"` inline, to find any instance of a kind rather than a particular one. `any_owner_entry`, `any_draft_control` and `any_suggestion_control` cover that case, and every site now uses them. A sixth site read a suggestion's id back out of its margin entry by slicing the `"suggestion:"` prefix off the owner attribute in browser JS; it now asks `marginEntrySource`, the runtime's own link from a margin control to the widget that registered it, for the widget's element directly. The `tests-readings` TODO item is done. Checked by running each touched test and the whole `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus`, which exercises the `any_owner_entry` table entry, the draft locator, and the `marginEntrySource` lookup together, plus `npm run test:runtime`. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 5 <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Sep 27, 2026
…e-root :has() (#1324) A comment on the corpus page painted about 60 ms late because of two things on the send path: the composer ran its own paint beside the runtime's render loop, and a `:has()` on the chrome root made each of that paint's geometry reads restyle the whole chrome. ## The composer paints in the standing paint Every `refresh()` in `wireInput` repainted the send button, placeholder and `aria-disabled` synchronously, then called `layout()`. For the floating composer that was `refreshFab` → `placeFab`, which reads geometry right after those writes. One send ran `refresh` three times (the sending flag, the settle's `load("")`, and `syncSuggestMode`), each forcing a chrome-wide style recalculation, and an open ran it three more times. The standing paint (`repaint.js`) already does this work once per frame: chrome layout's `syncLayout` places the response bar through `refreshFab`, and `paintStandingGeometry` paints inputs through `paintInputs`. Now `refresh()` marks its box stale and asks for that paint, and `paintInputs` paints every stale box along with the focus and hint boxes it already painted. The paint writes through `keeps`/`keepsText`; the old one replaced the placeholder's text nodes on every call. What stays synchronous, and why: - The box's value (`hydrate`): the field's caret and every reader after the writer (`sync.value()`, the draft save) depend on it. - The `sending`/`uploading` flags: `submit()` guards on them against a second press in the same turn. - Focus and the showing/hiding of the bar (`showFab`, `showComposer`): `showFab` decides from geometry whether the bar fits at all, and focus landing waits on that placement. The standing paint now runs its text boxes first in `paintStandingGeometry`. The Go-to chips that follow read each send button's `aria-disabled` to decide whether it is a destination. The boxes' contextual hints read which box is shown, so they stay after chrome layout, and nothing a box paints changes geometry. `standing.js` states that order. An interactive export, which attaches no chrome and used to mount no standing paint, now mounts it with the inputs' paint as its one phase (`repaint.js` runs the phases a document supplies), so a choosable group's addition field paints offline as it does live. The input module's own `focusin` paint is gone, since the keyboard controller already asks for the standing paint on every focus move. The `layout` option becomes `paint`, the caller's own rendering run inside the box's paint. Only the options addition widget uses it, for its empty-field flag. The standing paint runs in the frame the change first shows in (a `nextRender` from an input handler runs before the next paint), so the button, placeholder and placement show up in the same frame as the words. ## No `:has()` on the chrome root The Page Map toggle's `:scope:is(…, :has(> .lf-margin-projection > .lf-margin-toolbar[data-lf-pins]))` put a `:has()` on `.lf-chrome`. Chrome re-reads such a rule on every insertion below it and then invalidated the whole chrome subtree (about 800 elements), so any text node written anywhere in the chrome, including a Lit render of the thread list, made the next forced recalculation cost about 4 ms. I confirmed it by dropping the arm: style in the input-to-paint window went from 115 to 34 ms. The margin pass now writes `data-lf-pins` on the chrome root, where chrome layout already writes `data-lf-rail-covered`. `test_no_has_rule_stands_on_the_chrome_root` keeps a `:has()` off the root in every layer sheet: `.lf-chrome` anywhere, and `:scope` or a top-level `&` inside the chrome's `@scope`, including inside `:is()`/`:where()`. It fails on the old rule and on each of those planted shapes, and `assets/AGENTS.md` states the rule. `responseAction` now returns early when the control already shows the requested glyph and label. Before, `syncSuggestMode` rebuilt the Suggest button's children on every composer sync. ## Measurements The machine was shared with other suites (load 35–90), so read the paired numbers. | `corpus`, head vs origin/main | base | head | | --- | --- | --- | | `comment` painted median, 8 paired runs, round 1 | 224 ms | 123 ms | | `comment` painted median, 8 paired runs, round 2 | 186 ms | 126 ms | | `reply` painted median, round 1 | 377 ms | 352 ms | | `reply` painted median, round 2 | 377 ms | 299 ms | | `comment` style per run, `scripts/profile_page.py`, 3 runs | 87.7 ms (86.4 forced) | 37.5 ms (35.1 forced) | | `comment` send task (keydown task) | ~145 ms | ~85 ms | | UpdateLayoutTree events / ms inside the send task (`LEAF_INVALIDATIONS=1`) | 36–37 / 71–82 ms | 23–24 / 19–23 ms | Per-step, on a less-loaded run: the composer change alone took the send task from 119 to 87 ms by removing the three `refreshFab` recalculations and the key-scope one they set up. The `:has()` change then took it to 69 ms. The forced recalculations that remain (CodeMirror selection reads, thread-list scroll hold, focus return in `letGo`, `pageSelection` in the send's reveal check) now touch at most about 120 elements each. ## Tests - `npm run test:runtime`: passes. - `test_render_export.py` and `test_render_options_addition.py` (52): pass. The new `test_an_interactive_export_paints_a_widget_owned_text_box` fails without the offline mount. - After the phase-order change, two concurrent runs of the selection below plus Go-to cases (82 tests): 82 passed both times. - Two concurrent runs of the composer, placeholder, send, draft, map and pin selection across `test_render_{navigation,threads,margin,controls,aim,anchors}.py` (78 tests): 78 passed on the final code. An earlier concurrent pair at load ~70 failed `test_live_specimens_keep_real_gestures_and_drafts_inside_the_child` on a 5 s wait for a child page to present. It passes alone and in two further concurrent runs. - `test_render_drafts.py`, `test_render_outbox.py`, `test_render_options_addition.py`, `test_render_semantic_selection.py` (183): all pass except `test_a_single_space_is_message_content_in_every_composer[reply]`, which fails the same way on the base runtime. #1288 gave replies `hasContent: raw.trim()`, so a single space leaves Send disabled. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Sep 28, 2026
#1371 set the rule that an eval case stays only once it has separated two arms, and left the older cases that had not in place pending a decision. This removes them. - **Deleted:** `shot-pair-matches`, `shot-pair-differs`, `findings-show-the-defect` and `landed-work-goes-on-the-page` passed on both arms; `follow-up-asks-show-their-subject` swung between runs with its clause unchanged. - **Kept:** `thread-widget-mirrors` had no base result. Run against cb6de1f, before #1288, it failed 0 of 3 against main's 3 of 3, which its header comment now records. - `/developing-leaf` no longer notes older cases that predate the rule, since none remain. Nothing outside `evals/` names the deleted cases. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Leaf's standard Thread panel and package widgets now consume the same immutable conversation reading and typed Thread actions. A package can render complete Thread views in its own outlets; those mirrors remain independent of the page, margin, and standard panel, so a slow or removed package consumer cannot hold core presentation.
The standard panel now has per-instance DOM, filtering, disclosure, focus, and scroll state. Reply, resolve, reopen, and reaction controls use the same action path exposed to packages. Accepted approvals have moved out of the Thread collection into page-wide application state.
The public contract and examples are in
skills/leaf/references/packages.mdandskills/leaf/assets/runtime/widget-api.js. The implementation is concentrated inruntime/thread/actions.js,runtime/thread/mirrors.js, and the panel controllers; the browser tests exercise two independently filtered instances, shared Thread updates, cancellation, and slow optional consumers.Validation on the merged branch:
uv run pytest tests -q -n2(1,436 passed, one expected xfail); after the final panel identity fix, the two-panel browser test, 132 runtime tests, 67 browser tests, browser type check, and pre-commit passed.