Skip to content

Playground resilience and [alt.ai] sample policies - #1

Merged
elementmerc merged 4 commits into
mainfrom
feat/v0.1-scaffold
Jun 9, 2026
Merged

Playground resilience and [alt.ai] sample policies#1
elementmerc merged 4 commits into
mainfrom
feat/v0.1-scaffold

Conversation

@elementmerc

Copy link
Copy Markdown
Owner

Makes the playground hold its shape under real use and shows the AI collaboration convention in the samples.

Changes

  • Charts reflow with their container. A uPlot chart was sized once at mount and never again, so a narrower or resized column left a fixed-width canvas spilling past its bounds and forcing a horizontal scrollbar. The chart element now tracks its width through a ResizeObserver, pushes each change into the plot, and tears the observer and plot down on unmount (the live re-render previously leaked a detached canvas per keystroke). Benefits every embed, not just the playground.
  • Preview stays inside its column. Media is clamped to the pane, long unbroken tokens wrap, wide tables scroll in their own box, and the page tracks the dynamic viewport so mobile browser chrome no longer crops the bottom pane.
  • Every example carries an [alt.ai] edit policy. Each sample now declares which of its sections an AI agent may edit, and the starter explains the block. The policy renders to nothing; it is metadata in the source.
  • Sanitiser regression seed checked in. The NUL plus BOM idempotency case proptest found, now saved alongside the other crates' regression files.

Verification

typecheck clean, 13 unit tests, eslint clean, build 45 KB, 14 Playwright e2e green. CLI confirms each sample policy parses, every policy key resolves to a real heading anchor, and the policy block leaves no trace in rendered output. Live reflow on resize is verified by construction; an eyeball on a window drag is still worth it.

A uPlot chart was sized once at mount and never again, so a narrower or
resized column left a fixed-width canvas spilling past its bounds and
forcing a horizontal scrollbar. The live re-render path also leaked a
detached canvas on every keystroke. The chart element now tracks its
container width through a ResizeObserver, pushes each change into the
plot, and tears the observer and plot down when it unmounts.
The preview pane could be pushed wider than its column by an image, a
long unbroken token, or a wide table. Clamp media to the pane, wrap long
tokens, scroll wide tables in their own box, and track the dynamic
viewport so mobile browser chrome no longer crops the bottom pane.
The samples showed off components but never the AI collaboration
convention, so a reader never saw what an [alt.ai] policy looks like in
practice. Each example now declares which of its sections an agent may
edit, and the starter explains the otherwise invisible block.
proptest found a NUL plus BOM input the sanitiser cleaned
non-idempotently; the fix landed earlier but its seed stayed untracked.
Saving it re-runs the case for everyone, matching the other crates'
regression files.
@elementmerc
elementmerc merged commit 69e6954 into main Jun 9, 2026
5 checks passed
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.

1 participant