Repository navigation
Make item hints open comments - #393
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
The s rewrite reads clean. commentOnTarget is exactly the branch raiseTarget already took when focus was true, openComposer's focus = true default covers the flag that stopped being passed, and nothing else imported selectTarget or responseInstructions. I ran the four touched browser modules and, separately, the gallery cases in tests/test_site.py — all green. The new startup test does fail with body.inert removed, so it pins what it names. Worth noting tests/test_site.py is where the gallery demos actually play, and the PR gate won't reach it since the PR doesn't touch that module.
The gallery hunk collides with #383. That PR inserts at the same point in loadFrameDocument for the same bug, and its fix is the wider one: data-lf-contained also keeps the contained page from running restoreArrangements(), and marks the standalone export. inert covers the letGo() half alone, and it forecloses what #383 deliberately preserves — framed chrome free to run the browser's own focusing steps, with the outer document taking focus back. Probably worth deciding which lands rather than merging both and resolving the conflict afterwards.
test_a_selected_target_keeps_escape_when_the_layer_has_no_reactions stopped discriminating. The two .lf-live assertions were what tied the test to its emptied reaction registry. With them gone the remaining assertions hold identically when the layer does declare reactions — I checked by dropping the layer_registry override, and it still passes. The chip count stays 2 either way; only the second chip changes, from esc close to ⇥ other responses. Inline suggestion pins that.
Smaller: in skills/leaf/assets/runtime/keyboard/page.js, the comment above COMMENT_CREATE — "Selecting a more particular target is the second step; only then does React become an action" — is now the opposite of what s does, and it sits two lines above the selection.open row this PR rewrote.
…us and its exported copy (#383) ## Problem The nightly leg of [`ci` on `edd1c5a`](https://github.com/max-sixty/leaf/actions/runs/34083084673) went red on 17 readings. All but two came from one cause, and every one of them reproduces deterministically on that commit and on today's `main`. #354 gave the interaction gallery three contained frames, and each of them runs a whole second Leaf page. A Leaf page arrives: `restoreArrangements()` puts back the workspace this reader last had open, and `letGo()` puts them on the page's own body. Both run inside the frame, and a document has one focus — so `document.activeElement` out on the gallery became the `<iframe>`, and whatever the reader was holding was let go of. That is what closed the crowded margin cluster mid-test, dropped every `.lf-target-hint` on the corpus, and took `#bg-choice-ask` off its focus. The export half is separate and had been masked by the reading in front of it: the frame's `srcdoc` names the runtime, the theme, and the gallery adapter on a server a standalone file has not got, so an exported copy opened with four CORS failures. Its `<kbd>` chord caption was authored hidden, so the copy also held words with no script left to reveal them. ## Solution `data-lf-contained` marks both sides of the boundary — the frame element out in the gallery and the body of the page inside it. A contained page arrives restoring no arrangement and placing no focus, and the bake drops a contained frame with the scripts. The chord caption now lives with its own visibility rather than in authored markup. On a page that is not contained nothing changes: every guard reads a constant that is false there. Arrival is only half of it. The framed chrome still places focus once a replay runs it — a shown `<dialog>` runs the browser's focusing steps whatever the page around it wants. So the frame's body is written `inert` beside the mark: an inert subject ends those steps before they reach anything, so the focus never crosses the boundary and there is nothing to hand back. The replays are unaffected, because they drive that chrome through the adapter rather than by pointing at it. Measured on the `Open and close Threads` tab: without the line the reader loses the tab they just pressed the moment the framed panel opens, and `g T` and `w` then reach a document they cannot see. `inert` is the same one-line fix #393 carries, arrived at from the other side. The two conflict textually — both write it into `loadFrameDocument` on the line this branch marks the body on — and resolving either way is taking one copy of the line. `test_a_contained_replay_leaves_the_page_around_it_standing` pins both halves: it fails on `main` with `assert 'IFRAME' != 'IFRAME'` at arrival, and on the arrival fix alone at the replay, where the reader is no longer standing on the tab they pressed. Two readings are restated rather than repaired, because the gallery really did change: its swipe specimen sits in an unselected tab, so one margin row is withheld and the posture clear runs for it. (The Ask count 13 → 14 landed separately in #376.) <details><summary>The 17 readings, and what each was</summary> Focus taken by a frame — 14: `test_the_feature_gallery_keeps_its_real_actions_reachable[1440/1200/700/390]`, `test_ask_addresses_follow_the_feature_gallery_s_visible_margin_controls[1200/390]`, `test_margin_target_hover_requires_pointer_movement`, `test_a_workspace_lands_one_responsive_layout_and_carries_the_column_to_it[1440/1600]`, `test_selection_hints_do_not_name_page_content_behind_a_covering_panel`, `test_a_shipped_log_opens_its_example_on_a_live_thread`, `test_other_responses_can_turn_the_compact_field_into_a_suggestion`, and both `test_an_exported_page_fixture_stands_on_its_own` cases, which failed on the caption before they could reach the CORS errors. Restated: `test_an_unchanged_heartbeat_restates_no_margin_name[gallery]`, `test_the_feature_gallery_exercises_the_injected_core_surfaces`. **Not this branch's**: `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus` fails the same way on `06daeef3`, one commit before #354 — `pageSettled` never becomes true in the response bar of `ship-review`. It took [run 34079766897](https://github.com/max-sixty/leaf/actions/runs/34079766897) down too, so it is a red `main` of its own and I am carrying it separately. </details> ## Testing `uv run pytest tests` (899 passed), and the complete nightly modules the change reaches: `test_render_margin.py`, `test_render_navigation.py`, `test_render_export.py`, `test_render_semantic_selection.py`, `test_render_pages.py`, `test_render_widgets.py`, `test_site.py` — all green. The new test was checked against a tree with the two runtime guards reverted, where it fails. For the focus half added since: `test_site.py` (31 passed), and every gallery, contained-frame, export, standalone, accessibility and drawing reading in the suite (130 passed), plus `test_render_margin.py` whole and the two readings elsewhere this branch clears (83 passed). With the `inert` line alone removed, the contained-replay reading fails on the tab losing focus. ## One flake carried too `test_unchanged_margin_refresh_cost_is_bounded_by_refresh_count` took this branch's first CI run down at `LayoutCount: 29` against a bound of 20, and it does the same on `6b77b0a9` with none of this branch on it — once in six runs there, once in seven here. The corpus carries the gallery's contained frames, and a frame still arriving lays itself out in the measured page's own process, which counted against five dispatches that touch nothing reads as the heartbeat forcing layout. Both corpus cost measurements — that one and `test_margin_layout_batches_the_composed_page_without_refolding_controls`, which measures the same page the same way — now wait for the frames to be ready before opening the CDP session: fourteen runs green after, where it failed twice in thirteen before. ## What this does not clear One reading on `main` is still red and is not this branch's: `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus`, which I re-ran on this tree after #385 landed. It is tracked in #396, where the two possible repairs are written out — both are a product decision rather than a mechanical one. <details><summary>What it looks like</summary> The walk hangs on `pageSettled` in the response bar of `ship-review`: three transitions on one reaction chip's `.lf-margin-button-label` — opacity, transform, visibility, the label reveal — restart before they finish, indefinitely. `startTime` moves forward and `currentTime` goes back to 0 between two samples a second apart. Last green on [`934bfc4c`](https://github.com/max-sixty/leaf/actions/runs/34077249270); red from `06daeef3` (#365), which is what made a reaction a margin button with a label. The other readings that were red beside it have since been repaired on `main` and pass here: the three `test_render_reactions.py` cases went with #385, and `test_render_gate.py::test_a_reload_mid_flight_never_wedges_round_trip` passes on this tree. </details> ## Rebuilt on #378 #378 landed while this was open and rebuilt the contained page without `srcdoc`. The mark and the `inert` write both go on the document `loadFrameDocument` writes, and the frame element carries the mark beside it. `main` is merged in and the branch is green: `uv run pytest tests` (901 passed), and `test_site.py` and `test_render_margin.py` complete under `--run-nightly` (112 passed). --- Automated fix for [failed run](https://github.com/max-sixty/leaf/actions/runs/34083084673) --------- Co-authored-by: leaf-agent <[email protected]>
…us and its exported copy (#383) ## Problem The nightly leg of [`ci` on `edd1c5a`](https://github.com/max-sixty/leaf/actions/runs/34083084673) went red on 17 readings. All but two came from one cause, and every one of them reproduces deterministically on that commit and on today's `main`. #354 gave the interaction gallery three contained frames, and each of them runs a whole second Leaf page. A Leaf page arrives: `restoreArrangements()` puts back the workspace this reader last had open, and `letGo()` puts them on the page's own body. Both run inside the frame, and a document has one focus — so `document.activeElement` out on the gallery became the `<iframe>`, and whatever the reader was holding was let go of. That is what closed the crowded margin cluster mid-test, dropped every `.lf-target-hint` on the corpus, and took `#bg-choice-ask` off its focus. The export half is separate and had been masked by the reading in front of it: the frame's `srcdoc` names the runtime, the theme, and the gallery adapter on a server a standalone file has not got, so an exported copy opened with four CORS failures. Its `<kbd>` chord caption was authored hidden, so the copy also held words with no script left to reveal them. ## Solution `data-lf-contained` marks both sides of the boundary — the frame element out in the gallery and the body of the page inside it. A contained page arrives restoring no arrangement and placing no focus, and the bake drops a contained frame with the scripts. The chord caption now lives with its own visibility rather than in authored markup. On a page that is not contained nothing changes: every guard reads a constant that is false there. Arrival is only half of it. The framed chrome still places focus once a replay runs it — a shown `<dialog>` runs the browser's focusing steps whatever the page around it wants. So the frame's body is written `inert` beside the mark: an inert subject ends those steps before they reach anything, so the focus never crosses the boundary and there is nothing to hand back. The replays are unaffected, because they drive that chrome through the adapter rather than by pointing at it. Measured on the `Open and close Threads` tab: without the line the reader loses the tab they just pressed the moment the framed panel opens, and `g T` and `w` then reach a document they cannot see. `inert` is the same one-line fix #393 carries, arrived at from the other side. The two conflict textually — both write it into `loadFrameDocument` on the line this branch marks the body on — and resolving either way is taking one copy of the line. `test_a_contained_replay_leaves_the_page_around_it_standing` pins both halves: it fails on `main` with `assert 'IFRAME' != 'IFRAME'` at arrival, and on the arrival fix alone at the replay, where the reader is no longer standing on the tab they pressed. Two readings are restated rather than repaired, because the gallery really did change: its swipe specimen sits in an unselected tab, so one margin row is withheld and the posture clear runs for it. (The Ask count 13 → 14 landed separately in #376.) <details><summary>The 17 readings, and what each was</summary> Focus taken by a frame — 14: `test_the_feature_gallery_keeps_its_real_actions_reachable[1440/1200/700/390]`, `test_ask_addresses_follow_the_feature_gallery_s_visible_margin_controls[1200/390]`, `test_margin_target_hover_requires_pointer_movement`, `test_a_workspace_lands_one_responsive_layout_and_carries_the_column_to_it[1440/1600]`, `test_selection_hints_do_not_name_page_content_behind_a_covering_panel`, `test_a_shipped_log_opens_its_example_on_a_live_thread`, `test_other_responses_can_turn_the_compact_field_into_a_suggestion`, and both `test_an_exported_page_fixture_stands_on_its_own` cases, which failed on the caption before they could reach the CORS errors. Restated: `test_an_unchanged_heartbeat_restates_no_margin_name[gallery]`, `test_the_feature_gallery_exercises_the_injected_core_surfaces`. **Not this branch's**: `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus` fails the same way on `06daeef3`, one commit before #354 — `pageSettled` never becomes true in the response bar of `ship-review`. It took [run 34079766897](https://github.com/max-sixty/leaf/actions/runs/34079766897) down too, so it is a red `main` of its own and I am carrying it separately. </details> ## Testing `uv run pytest tests` (899 passed), and the complete nightly modules the change reaches: `test_render_margin.py`, `test_render_navigation.py`, `test_render_export.py`, `test_render_semantic_selection.py`, `test_render_pages.py`, `test_render_widgets.py`, `test_site.py` — all green. The new test was checked against a tree with the two runtime guards reverted, where it fails. For the focus half added since: `test_site.py` (31 passed), and every gallery, contained-frame, export, standalone, accessibility and drawing reading in the suite (130 passed), plus `test_render_margin.py` whole and the two readings elsewhere this branch clears (83 passed). With the `inert` line alone removed, the contained-replay reading fails on the tab losing focus. ## One flake carried too `test_unchanged_margin_refresh_cost_is_bounded_by_refresh_count` took this branch's first CI run down at `LayoutCount: 29` against a bound of 20, and it does the same on `6b77b0a9` with none of this branch on it — once in six runs there, once in seven here. The corpus carries the gallery's contained frames, and a frame still arriving lays itself out in the measured page's own process, which counted against five dispatches that touch nothing reads as the heartbeat forcing layout. Both corpus cost measurements — that one and `test_margin_layout_batches_the_composed_page_without_refolding_controls`, which measures the same page the same way — now wait for the frames to be ready before opening the CDP session: fourteen runs green after, where it failed twice in thirteen before. ## What this does not clear One reading on `main` is still red and is not this branch's: `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus`, which I re-ran on this tree after #385 landed. It is tracked in #396, where the two possible repairs are written out — both are a product decision rather than a mechanical one. <details><summary>What it looks like</summary> The walk hangs on `pageSettled` in the response bar of `ship-review`: three transitions on one reaction chip's `.lf-margin-button-label` — opacity, transform, visibility, the label reveal — restart before they finish, indefinitely. `startTime` moves forward and `currentTime` goes back to 0 between two samples a second apart. Last green on [`934bfc4c`](https://github.com/max-sixty/leaf/actions/runs/34077249270); red from `06daeef3` (#365), which is what made a reaction a margin button with a label. The other readings that were red beside it have since been repaired on `main` and pass here: the three `test_render_reactions.py` cases went with #385, and `test_render_gate.py::test_a_reload_mid_flight_never_wedges_round_trip` passes on this tree. </details> ## Rebuilt on #378 #378 landed while this was open and rebuilt the contained page without `srcdoc`. The mark and the `inert` write both go on the document `loadFrameDocument` writes, and the frame element carries the mark beside it. `main` is merged in and the branch is green: `uv run pytest tests` (901 passed), and `test_site.py` and `test_render_margin.py` complete under `--run-nightly` (112 passed). --- Automated fix for [failed run](https://github.com/max-sixty/leaf/actions/runs/34083084673) --------- Co-authored-by: leaf-agent <[email protected]>
…pen-comment # Conflicts: # skills/leaf/assets/runtime/composing/surface.js # tests/test_render_semantic_selection.py
leaf-agent
left a comment
There was a problem hiding this comment.
Two published pages still describe the two-step s route this change removes.
docs/index.html, in the loop-comment list item: "Selecting an item with s raises Comment and React beside it; choose Comment to open the compact field, or Alt-click the item to go there directly." After this PR there is no Comment/React choice to make, and the contrast the sentence draws with Alt-click is gone — the two routes are now the same one.
docs/how-it-works.html, in the reactions paragraph: "Select a passage, select an item with s, or stand in an agent reply, then open …, use the small reaction control in a hovered or focused reply, or press r." The s branch of that sentence no longer reaches r: the field is focused when the hint completes, so a letter goes into the draft. test_s_aims_at_the_item_named_by_its_hint pins exactly that (page.keyboard.press("s") now leaves s in the field). Tab and the ellipsis are the routes that survive for a hint-chosen item, and the paragraph's next sentence — "Selecting or Alt-clicking an item immediately focuses a compact comment field beside it" — is the one this PR makes true.
Both are a sentence each and sit outside the diff, so no inline suggestion; CLAUDE.md's Working on the repository asks for public docs a feature affects to move with it. Say the word and I'll push the two edits.
The three points from the previous round are addressed: the gallery inert hunk is out and the net diff no longer collides with #383, the keyline comment above COMMENT_CREATE now matches what s does, and test_a_selected_target_keeps_escape_when_the_layer_has_no_reactions pins the second chip and the absent ellipsis, so it discriminates against the default registry again.
`s` previously stopped at response-neutral target selection while Alt-click immediately opened Comment. This routes keyboard hints through the same canonical comment action, so the field receives focus and unsent drafts move consistently. Page-text search remains the deliberate selection-first route. The browser contracts now cover ordinary items, nested targets, visual parts, draft carry-over, reactions, absent reaction vocabularies, in-flight sends, and the keyline/reference wording. The product overview and explainer describe the same direct Comment route and its Tab/ellipsis response extension. Tested with `uv run pytest tests` (907 passed), a focused/nightly browser run (232 passed), `uv run pre-commit run --all-files`, and a live UI sweep at 390, 1200, and 1440 pixels in light and dark themes. > _This was written by Codex on behalf of max-sixty_
spreviously stopped at response-neutral target selection while Alt-click immediately opened Comment. This routes keyboard hints through the same canonical comment action, so the field receives focus and unsent drafts move consistently. Page-text search remains the deliberate selection-first route.The browser contracts now cover ordinary items, nested targets, visual parts, draft carry-over, reactions, absent reaction vocabularies, in-flight sends, and the keyline/reference wording. The product overview and explainer describe the same direct Comment route and its Tab/ellipsis response extension.
Tested with
uv run pytest tests(907 passed), a focused/nightly browser run (232 passed),uv run pre-commit run --all-files, and a live UI sweep at 390, 1200, and 1440 pixels in light and dark themes.