Repository navigation
Add live interaction gallery - #341
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
The gallery itself works. I ran both new tests, then tests/test_site.py and tests/test_render_pages.py in full (75 passed), and regenerated the corpus (no diff). One nightly gate goes red on this branch, though.
test_render_export.py fails on the feature gallery
FAILED tests/test_render_export.py::test_an_exported_page_fixture_stands_on_its_own[feature-gallery]
AssertionError: the copy draws a hand over a gesture it cannot take — the pointer promises
something the file has no script to do: ['button.interaction-control', 'button.interaction-control']
Play and Replay are authored as bare <button>s, so the bake has nothing to key on and they survive into the standalone copy with cursor: pointer and no script behind them. offer() in runtime/widget-elements.js is the door — it writes lf-ui, data-lf-gen, and data-lf-offer="button" together, and the third is what standalone.js removes on. Its own comment names this case: "A widget writes none of the three by hand: they are what make an element chrome, and one of them going missing is invisible until something breaks." Building the controls in installInteractionGallery rather than authoring them would also retire the Loading… placeholder, since a page that never installs the gallery would simply have no controls. Same markup in examples/corpus.html; it passes only because the section sits in an unselected lf-tab, so checkVisibility() is false there.
tests/test_render_anchors.py::test_one_key_keeps_one_keyboard_face_across_the_page also fails, but it fails on the merge base (83f6956) too — that is #339's, not this branch's.
The runtime module ships to every page
runtime is one of BROWSER_DIRS in skills/leaf/scripts/leaf/schema.py, so the layer composes the whole directory into every page. I checked a preview directory for an unrelated fixture and runtime/interaction-gallery.js is vendored there — 404 lines for one developer page, plus a [data-interaction-gallery] query in leaf.js on every lf-actions. Packages ship widgets rather than plain modules, so there is no other home for a page driver today; noting it as the seam rather than as something to fix here.
leaf-agent
left a comment
There was a problem hiding this comment.
The four points from the last pass are answered: the buttons go through offer(), the reduced-motion read comes from motion.js, the tab keeps focus and the new assertion pins it, and the catalog locator is page-wide again. test_render_export.py::test_an_exported_page_fixture_stands_on_its_own[feature-gallery] and test_the_interaction_gallery_drives_real_widgets both pass on this head, and scripts/corpus.py regenerates with no diff.
Two things the move into installInteractionGallery brought with it — one about the row the buttons now sit in, one about what lf-ui does to the page's own CSS. Both inline.
leaf-agent
left a comment
There was a problem hiding this comment.
Both threads from the last pass are answered. offer() on the row and the readout puts them behind the chrome markers, so pageWords/says look away and the bake takes them out of the copy: tests/test_render_export.py is green across all 42 fixtures on this head (204s), and test_the_interaction_gallery_drives_real_widgets passes with the new assertions. I read the widened scriptedOffer against the other offer() call sites too — the case its old comment named (a box holding static words the copy keeps) still has element children, so it stays outside the new branch.
The specificity fix took one rule with it, inline.
Three nightly tests have been red on `main` since #341, and nightly runs after `main` moves, so PR CI and `wt merge` both stay green while nobody sees them. All three are the same seam: the live interaction gallery injects its playback row from the runtime and leaves the authored page owning it. **The ring census.** The page drew `outline: var(--here-ring)` on the injected presses without naming the ring, so the floor below divided by a population short of it. It was drawing the ring twice over: `offer` marks those buttons `data-lf-offer="button"`, so the theme's pressable floor already carries the hand, the hover tint, the disabled treatment, and a ring that names itself. The page's copies are gone and the floor's answer stands alone. No other authored page in the corpus draws the layer's ring. **The control-row sweep.** The row is a control row nothing had declared. Declaring it means proving it holds still, and it did not: the toggle rewrites its own word as a demo runs — Loading…, Play, Pause, Played — so pressing Replay moved the button beside it, and the live status line changed length on the same line as both presses. The toggle now reserves the width of every word it can say, through `reserve`, the layer's own helper, called where the runtime builds the row — `scripts/corpus.py` copies each source's `<main>` and none of its `<head>`, so a rule in the gallery's head would not reach the generated corpus, which is the page this sweep actually walks. The status line stands under the two presses at every width rather than only on a phone; reserving its width instead would hold the row open at the width of its longest sentence. `interaction-playback` is the new archetype; an archetype may now name an `example`, because a demo is a scenario the module names rather than markup the synthetic stability page can compose, so its proof runs on the gallery itself. Replay is the press for the same reason the diff's review press is: the button that has to hold still is the toggle, and pressing Replay is what sends it through every word it has. **The injected-surfaces walk.** The gallery's own counts had moved on: #341 added a live undecided suggestion and a second stored version, and merging `main` brought the playground package's ask, so the walk now sees thirteen asks and three version rows. `tests/test_site.py` asserted the status line's `margin-left: 0` at 390px, which the layout change makes vacuous; it now reads the invariant that replaced it. ## Checks `uv run pre-commit run --all-files` is clean, and `uv run pytest tests --run-nightly` passed whole — 2096 tests — on this branch before `main` moved under it. On the merged tree that full run reports 11 failures. A paired control, a detached checkout of `ca4ac82d` with none of this branch on it, fails 10 of the same tests, so they arrived with the eight PRs that landed while the first run was going. The eleventh, `test_a_failed_preview_bootstrap_hears_the_replacement_server[theme.css]`, passes on its own here and on the control: a flake in a 27-minute run. The three tests this PR is about pass. Nightly is red on `main` for two reasons this PR does not reach, both worth someone's attention: - the playground package's Reset, Copy instruction and Apply card share rows and match no archetype, so `test_the_composed_corpus_declares_every_control_row_archetype` fails on `main` for that reason now instead; - `.lf-resolve.lf-icon-action` (#347) has the left edge of its focus ring under `.lf-react-trigger` (#349) in the ship-review thread, two independent PRs whose rows now overlap by two pixels, which `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus` reports as 2 faults over 714 stops. Plus pre-existing reds in `test_render_anchors`, `test_render_export`, `test_render_projection` and `test_render_widgets`, all present on the control. **#340 is the standing fix for the shape of this: nightly modules a PR touches never run before it lands. ## Overlapping PRs **#353 repairs the same three readings, and opened while this branch's first suite was running. It took the `reserve` route from the start, which is where this one has now arrived; it also rehomes the scenarios' `#bg-motion-*` lookups onto the stage, which this does not. One of the two should close, and which is Max's call. ## Note for #351 **#351 deletes this same block of gallery CSS and rehomes none of it, which would leave the injected buttons without their pill shape or their `--aim-floor` aim target. Whichever lands first, the other conflicts here. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q7ZBoNLYxFVhWgDsXH1RTx --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Summary
Testing
pre-commit run --all-filesuv run pytest tests(897 passed)feature-gallerynpm test --prefix worker(9 passed)uv run scripts/site.py(30 pages built)