Skip to content

Make catalog preview generation reproducible - #342

Merged
max-sixty merged 2 commits into
mainfrom
codex/generate-example-previews
Sep 6, 2026
Merged

max-sixty merged 2 commits into
mainfrom
codex/generate-example-previews

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Adds one reproducible local command for refreshing the public catalog previews. The generator builds the site with Playwright's locked headless shell, serves each example through the canonical website adapter, refuses fallback fonts, and buffers all captures before replacing output files.

Development setup moves into wt setup. uv run owns Python environment synchronization and the locked pre-commit dependency; the alias retains the browser and npm installs that uv cannot provide.

Generated JPEGs and catalog hashes are intentionally excluded. Image publication will move with the upcoming Cloudflare asset-storage work.

Part of #176.

This was written by Codex on behalf of max-sixty

@max-sixty
max-sixty merged commit 0395dee into main Sep 6, 2026
7 checks passed
@max-sixty
max-sixty deleted the codex/generate-example-previews branch September 6, 2026 19:41
max-sixty added a commit that referenced this pull request Oct 11, 2026
…build (#2327)

Code-quality survey batch for `tests/`, `dev/` and `build/`: the test
page pool's regression, plus small cleanups, one commit each.

**Test page pool (F125).** Since #2155 put the `work` fixture package in
`serve`'s default selection by path, every default `serve(markup)` ran a
full `page init`. `serve` pooled only selections of bare package names,
because it named each template directory after the selection.
`initialized_page` now owns the key and the `page init` command. A shape
is keyed by the selection, the package directories it resolves to as
`page init` resolves them, and an optional named preparation step: an
example's stamped versions, or `page_dir`'s document. `serve`,
`page_dir` and the fixture check share that one keyed lend, templates
are numbered, and a selection naming a package under the test's own
`tmp_path` (a `layer_registry` or `./.leaf` page) is initialized in
place. On this host under load 40 to 58, a default `serve(markup)` went
from about 6 s to about 0.75 s after each worker's first.

pytest's own fixture caching can't hold this pool by itself. `serve`'s
selection is an argument of a call made inside the test body, sometimes
twice in one test, and fixture caching keys only on scope and
collection-time params. So the pool keeps the shape it had: a
worker-scoped `_page_pool` with a function-scoped lender.

**Wait deadlines (F79).** The deadline lint loses its per-file
allowance. The 33 literal deadlines it held now take the suite's
default, `HANDOVER_DEADLINE_MS` for a reload, or a bound past the
runtime's 10 s presentation wait. The gate tests whose deadline is meant
to expire share `EXPECTED_STALL_MS` (5 s), so two of them now wait 5 s
where they waited 2 s and 1 s.

**Console errors (F39).** `render_gate.scheme` gains `console_error`,
the error branch `console_problem` already had, and
`collect_page_errors`. probe, verify-site and the plain arrangement gate
use them: still errors only, and a failed load now names its URL. A
layout case drops its `response` listener, since the console entry
already reports error statuses.

**Stylesheets (F128).** `build/styles.mjs` exports `styleOutputs()`,
which `build/browser/build.mjs` merges into the outputs it writes and
checks. `build:styles` and `check:styles` are gone, and `check:bundles`
no longer rebuilds the sheets. The sheets' banner now names
`build/styles.mjs`.

**Framework facade (F66).** The ESLint rules now refuse deep imports
into `vendor/browser-runtime/`, which bypassed both the semantic
publisher's ownership rule and the content-module boundary. The rule
also drops a check on `createApplicationPublisher`, which the facade
never exported.

**Smaller items.**

- From #2308: the focus-ring sweep now reads the Question ring by
`question`, the canonical name since #2252. #2308 can close once this
lands.

- F131: `leaf-dev probe --do drive:NAME` reaches all 71 stills drivers.
13 were refused before.
- F130: `publish-site` now runs on any `dev/` change. Its hand-written
list had missed `startup.py`.
- F75: two unused test helpers are deleted.
- F117 and F118: maintainer docs now match the CLI and the suite, and
let `--help` own leaf-dev's flags.

**Not done.**

- F40, launching catalog previews through `chrome()`: #342 chose
Playwright's locked headless shell to keep previews reproducible, and
this would reverse that.
- F129, moving the package-lock check: #2317 deleted both lock checks
when it moved to pnpm.
- F58, the shared Lit binding: verification rated it low value and
recommended folding it into the next change to either binding.
- F34, the usability eval scorers: rewriting eight scorers onto
`SourceDocument` needs the stored runs re-scored before and after, which
is more than a small change.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 12, 2026
…-card sample, and bring the What-needs-you note up to date (#2619)

Three small changes from the code-quality survey.

**Catalog previews wait the way every other browser command does.**
`leaf-dev refresh-previews` keeps launching the locked headless shell
the browser suite uses, so published preview pixels do not follow each
host's Chrome (#342). It now opens its tab with `leaf_dev.browser.tab()`
and waits with `load()`, which runs `settle()`: ready, fonts loaded, and
the runtime's `pageSettled`. Its own `wait_until_ready` call is gone.
Captures also take reduced motion, as other stills do. A one-example
capture through the real command (publishing stubbed out) produced the
expected still.

**The feature gallery's "Move a card" live sample is cut.** It repeated
the drag the delivery board on the Data & work tab already offers. The
Interactions guide now links to that board (`#bg-delivery`, which opens
its tab), the eyebrow drops the board elements, the site test expects
three interaction samples, and the corpus is regenerated.

**`notes/what-needs-you/page.html` matches the current model.** It said
an Ask is a task on you and that a record says how it `ends`. Since
#2240, #2451 and #2506, an ask is its own record the lists select
directly, the shared work record is a to-do with no `ends` field, the
lists are `queues.questions` and `queues.tasks`, and replies ask with
`--ask`. The lede, plan, naming sections, "How it works" (with a fresh
`page state` reading) and open questions now say so. The step-5 tab
keeps its decision record in the past tense and notes what holds now.
The `#task-hierarchy` and `#task-done` anchors cited by TODO.md are
unchanged.

No user-visible Leaf behaviour changes beyond the gallery losing one
sample.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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