Skip to content

Playground: example feeds from the adopters registry, and links that open configured (#185, #146) - #198

Merged
hhkaos merged 4 commits into
redesign/playground-tabs-and-chromefrom
feat/adopters-picker
Nov 26, 2026
Merged

hhkaos merged 4 commits into
redesign/playground-tabs-and-chromefrom
feat/adopters-picker

Conversation

@hhkaos

@hhkaos hhkaos commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Stacked on #197 — review that one first; this PR's base is its branch, so the diff here is only the three commits on top.

Public bundles are still byte-identical to main (md5 verified), so no version bump.

#185 — pick an example feed

The playground started on one hard-coded feed and offered nothing else, so anyone evaluating the widget either already had an OTE feed URL or saw a single example — and every layout and density decision got exercised against one shape of data. The "Example feed" button becomes the picker the converter's landing page already has: one control that reaches an example and the other eight.

The default feed changes too, on measured grounds. A demo whose calendar is mostly empty months and whose cards have no images teaches that the widget is thin. Across the nine registered feeds on 2026-11-26, HackBarna Digest has 216 events, 77 upcoming and 214 with an image, and declares spec 0.6.0 — where the previous default declares 0.3.0, which has since fallen out of the support window. The playground was demonstrating OTE on a spec version OTE no longer supports.

One validator, two pages, and not by copy-paste. The issue assumed workers/convert/src/adopters.ts was an importable loader. It is a template string served as a classic <script src="/adopters.js">, which cannot import anything at runtime — so the shape of the work is different from the issue's. The shared piece is the part that matters, the shape check, as a pure dependency-free function in apps/embed/src/adopters.ts. The playground imports it; the worker embeds its source text, bound to a const rather than relied on by name, because the worker bundle is minified and that renames a declaration but not a name written inside a string.

workers/convert importing across a package boundary is the same relative import it already makes into apps/validator for fetchDocument. The root CLAUDE.md calls that "the one thing in this repo that does" — it is now the second, which seemed worth saying out loud rather than leaving to be discovered.

#146 — ?tab= and ?preset=

?feed= already round-tripped, but a link always landed on the Events tab showing the default calendar. For the "Crear widget" button on the adopters list that is the wrong half of the demo.

One writer for all three parameters, reading the current URL each time, so adding one cannot drop another, and a value at its default is absent rather than written out. An unknown tab or preset is ignored rather than erroring — a link that outlives a renamed preset should still open the playground. ?preset= names the configuration the form is in, so touching any control clears it: a link claiming "Cards grid" that opens something else is worse than one making no claim.

Verification

403 tests in apps/embed, whole repo green.

By execution rather than by reading the diff:

  • Deleting the protocol check in apps/embed/src/adopters.ts fails workers/convert's own test/adopters.test.ts — proof the worker runs the shared code and not a stale copy of it.
  • 22 new cases on the validation branches: every rejected scheme (javascript:, data:, file:), credentials in the URL, a hostile entry not costing the page its whole list, the feed URL preserved exactly including its query string, and that the function still closes over nothing — a new import there would break the converter's picker, silently.
  • Driven in Chrome: nine adopters load, the open feed arrives pre-selected, picking one drives the field, the live element and the snippet together, typing a URL by hand clears the selection, and ?tab=subscribe&preset=cards&feed=… opens all three together.

Also fixed

The Cards grid preset rendered one card wide — at 320px (card-width: large) two cards do not fit the preview column, so a preset named "grid" was not showing one. It takes the 220px default instead.

Closes #185. Closes #146.

🤖 Generated with Claude Code

hhkaos and others added 3 commits November 26, 2026 20:48
The playground started on one hard-coded feed and offered nothing else, so
anyone evaluating the widget either already had an OTE feed URL or saw a
single example — and every layout and density decision got exercised against
one shape of data. The "Example feed" button is replaced by the picker the
converter's landing page already has: one control that reaches an example
*and* the other eight.

**The default feed changes too, on measured grounds.** A demo whose calendar
is mostly empty months and whose cards have no images teaches that the widget
is thin. Across the nine registered feeds on 2026-11-26, HackBarna Digest has
216 events, 77 of them upcoming and 214 with an image, and declares spec
0.6.0 — where the previous default declares 0.3.0, which has since fallen out
of the support window. The playground was demonstrating OTE on a spec version
OTE no longer supports.

**One validator, two pages, and not by copy-paste.** The issue assumed
`workers/convert/src/adopters.ts` was an importable loader; it is a template
string served as a classic `<script src="/adopters.js">`, which cannot import
anything at runtime. So the shared piece is the part that matters — the shape
check — as a pure, dependency-free function in `apps/embed/src/adopters.ts`.
The playground imports it; the worker embeds its *source text* and binds it to
a `const` rather than relying on its name, because the worker bundle is
minified and that renames a declaration but not a name written inside a
string.

`workers/convert` importing across a package boundary is the same relative
import it already makes into `apps/validator` for `fetchDocument`. That was
"the one thing in this repo that does"; it is now the second, which is worth
saying out loud rather than discovering later.

Verification, by execution:

- Deleting the protocol check in `apps/embed/src/adopters.ts` fails
  `workers/convert`'s own `test/adopters.test.ts` — proof the worker runs the
  shared code and not a stale copy.
- 21 new cases on the validation branches, including every rejected scheme,
  credentials in the URL, a hostile entry not costing the page its whole
  list, and that the function still closes over nothing (a new import would
  break the *converter's* picker, silently).
- Driven in Chrome: nine adopters load, the open feed arrives pre-selected,
  picking one drives the field, the live element and the snippet together,
  and typing a URL by hand clears the selection.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…146)

`?feed=` already round-tripped, so a link could point the playground at
someone's feed — but it always landed on the Events tab showing the default
calendar. For the "Crear widget" button on the adopters list that is the
wrong half of the demo: someone exploring a feed there may well want the
subscribe widget, and a configured widget is closer to "the code and the
preview" than a pre-filled URL alone.

- `?tab=events|subscribe|reference`
- `?preset=<id>`, resolved against `EVENT_PRESETS`

One writer for all three parameters, reading the current URL each time, so
adding one cannot drop another — and a value at its default is *absent*
rather than written out, which keeps a plain link to the playground plain.
An unknown tab or preset is ignored rather than treated as an error: a link
that outlives a renamed preset should still open the playground.

`?preset=` names the configuration the form is *in*, so it survives only
while that stays true — touching any control clears it, and so does Reset. A
link claiming "Cards grid" that opens something else is worse than a link
making no claim.

Preset ids are public API now, so a test guards that they are unique and need
no escaping in a query string.

Also fixes the Cards grid preset, which rendered one card wide: at 320px
(`card-width: large`) two cards do not fit the preview column, so a preset
named "grid" was not showing one. It takes the 220px default instead.

Verified in Chrome: `?tab=subscribe&preset=cards&feed=…` opens all three
together; switching tab writes it and returning to Events removes it;
touching a control drops `?preset=`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`CLAUDE.md` called the validator-fetcher import "the one thing in this repo
that does", which the adopters picker makes false in the same branch that
makes it false. Exactly the shape of stale prose the file's own rule warns
about: a true sentence that stopped being true with nothing to notice.

Names the direction both share — a worker reaching into an app's `src/` — so
the sentence describes the rule rather than listing the instances, and points
at #158, where the extract-or-document decision actually lives. #158 now
carries the same note.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@hhkaos
hhkaos force-pushed the redesign/playground-tabs-and-chrome branch from d032a1d to 46ea11b Compare November 26, 2026 19:50
@hhkaos
hhkaos force-pushed the feat/adopters-picker branch from 375fe21 to 31259a6 Compare November 26, 2026 19:50
`let adopters = []` was overwritten on every path that reads it — the catch
returns rather than falling through — so the seed value was a value nothing
could observe. ESLint's `no-useless-assignment` is right, and this was caught
by CI rather than here: build, typecheck and tests all passed, and `pnpm lint`
is the step I had not run.

Declaring it without an initialiser is also the clearer statement: the only
way past the block is through the assignment.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@hhkaos
hhkaos merged commit 1dd5976 into redesign/playground-tabs-and-chrome Nov 26, 2026
1 check passed
@hhkaos
hhkaos deleted the feat/adopters-picker branch November 26, 2026 21:48
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