Skip to content

feat(stories): the whole widget, interactive, on fixtures alone - #481

Merged
Ardnived merged 8 commits into
mainfrom
claude/feat-ladle-interactive
Nov 25, 2026
Merged

Ardnived merged 8 commits into
mainfrom
claude/feat-ladle-interactive

Conversation

@Ardnived

@Ardnived Ardnived commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Ladle groundwork split out of #466, so it can merge first:

  • A whole-widget story. Interactive / Full Widget renders the real App on a stand-in host page, in a 640px box. You can browse, open a class and register, search and filter.
  • Ladle talks to no API. .ladle/backend.ts answers every SahajCloud read from the browser lane's fixtures, through the app's real fetchers. On main, a view story's idle prefetch reached production. Ladle also serves the Turnstile challenge on its own origin, using the page the lane already framed, now shared as src/mocks/challenge-page.ts.
  • A bigger demo atlas for the widget story, in src/mocks/sahajcloud-demo.ts: 28 countries, the UK's 12 regions, and enough classes that every list scrolls. sahajcloud.test.ts reads it through the real fetchers. The browser lane still reads sahajcloud.ts alone.
  • Maps that survive Ladle, in .ladle/react-map-gl.tsx:
    • It never reuses a map. A canvas carried between the viewport iframe and the page loses its WebGL context, so the map drew only its controls.
    • The canvas follows its own box.
    • mapbox-gl accepts a container that sits inside the viewport iframe.
  • Screen-reader strings in Ladle. Every aria-label from config/a11y/ read as its raw key, both in stories and to the accessibility gate.
  • Sidebar order: Atoms → Molecules → Organisms → Views → Interactive, with any new group below.
  • Five app-code exports and one move, so the playground reads the fixtures and the boot resource the app and the lane already had. Nothing the app does changes with them.

Change outline

Flow — what answers a story's SahajCloud read

installBackend patches the global fetch, the one the app's SDK calls, so a story's reads still go through the real fetchers and their zod parses.

 a story renders <App apiKey=… />                 src/App.stories.tsx
   the SDK's interceptFetch calls window.fetch    config/api/client.ts
-  → api.sahajcloud.com                           # a view story's idle prefetch reached production
+  → installBackend's patched fetch               .ladle/backend.ts
+    /api/**       → answerSahajCloud(request, demo)
+                    demo = the lane's fixtures, tree + feed + classes replaced
+                    src/mocks/sahajcloud-demo.ts, imported on the first read (~100ms to build)
+    ipwho.is/**   → mockIpLocation                src/mocks/regions.ts
+    anything else → the browser's own fetch       # Mapbox, picsum

Files — one set of fixtures, read by both the lane and the playground

 src/mocks/
+  sahajcloud-demo.ts          the bigger atlas, and `demo` for the backend to answer from
+  challenge-page.ts           the Turnstile stand-in, was inline in tests/browser/fixtures.ts
   sahajcloud.ts               the router takes `fixtures`; toJson/regionNodes/onePage/paginated/regionRefOf named
   regions.ts                  + mockIpLocation, was story-harness.tsx's own
   events.ts                   WEEKDAY_CODES named
 src/config/
   i18n-options.ts             + bootResources, which was built inside i18n.ts
   i18n.ts                     reads bootResources instead of building it
 src/hooks/use-ip-location.ts  IP_LOCATION_ENDPOINT named, so the backend can match its origin
 src/views/story-harness.tsx   imports mockIpLocation instead of declaring it
 tests/browser/fixtures.ts     frames the shared challenge page

Files — the playground's own wiring

 .ladle/
+  backend.ts                  every SahajCloud read and the IP lookup, from fixtures
+  react-map-gl.tsx            no map reuse, canvas follows its box, iframe realm bridge
   vite.config.ts              SahajCloud origin = Ladle's own; challenge page; map alias
   components.tsx              installs the backend; router fresh per story; widget story full-bleed
   config.mjs                  storyOrder by tier
   i18n.ts                     boots from the app's bootResources (snapshot + a11y strings)
 src/App.stories.tsx           + Interactive / Full Widget, on its stand-in host page

Preview

Design playground: interactive--full-widget (Interactive › Full Widget). The sahajatlas-design build succeeds, but no branch alias has been published for it yet, so preview pending.

Test results

  • Lean gate (.claude/skills/pr-prep/check.sh), re-run after the review commits: lint and typecheck pass, and 2412 unit tests pass across 191 files.
  • pnpm test:browser: 10 passed. The lane now frames the shared challenge page.
  • pnpm ladle:build passes and emits api/atlas/challenge.html.
  • Accessibility gate, run per story against local Ladle:
    • Without a token, as CI builds the playground: interactive--full-widget is clean.
    • With a token: views--region and views--registration are clean. organisms--mapbox shows its two known map-control findings (STORYBOOK.md).
    • With a token, interactive--full-widget has one finding: the collapsed sheet's "Show more" answers at 89×32px on a phone. That is the contained map's own sheet, which main already has. No story rendered it before. feat(widget): open every embed inline; expand the map over the page #466 replaces this form with the inline embed.

Notes for reviewer

No host can observe this change, and nothing it adds ships in the app bundle. The app-code edits are five exports plus bootResources moving from config/i18n.ts to config/i18n-options.ts — all behaviour-preserving — so CHANGELOG.md and docs/embedding.md stay untouched.

Four docs carry it: STORYBOOK.md, docs/testing.md, docs/environment.md (the playground's triggers need VITE_MAPBOX_ACCESSTOKEN too), and docs/rules/i18n-and-state.md.

#466 drops these commits when it rebases. Its version of the story then renders the inline form and adds the White background control.

Every thread of the adversarial review is adopted and resolved; nothing was rebutted. The run's comment carries each one and its commit.

🤖 Generated with Claude Code

Ardnived and others added 3 commits November 25, 2026 10:08
Ladle sorts groups alphabetically. A story order lists Atoms, Molecules,
Organisms, Views, then Interactive, with any later group below them and each
group still alphabetical inside.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ladle booted i18n from the English snapshot alone, so every aria-label from
`config/a11y/` read as its raw key in a story and to the accessibility gate.
It now boots from the app's own resources.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`Interactive / Full Widget` renders the real App on a stand-in host page, in
a 640px box: browse, open a class and register, search, filter.

- Ladle talks to no API: `.ladle/backend.ts` answers every SahajCloud read
  from the browser lane's fixtures, through the app's real fetchers, and the
  IP lookup with Cambridge. A view's idle prefetch no longer reaches
  production either.
- Ladle points the app's SahajCloud origin at its own and serves the
  Turnstile challenge there, from the page the lane already used, now shared
  in `src/mocks/challenge-page.ts`.
- The widget story reads a bigger atlas on top (`sahajcloud-demo.ts`: 28
  countries, the UK's 12 regions, classes enough that every list scrolls).
  `sahajcloud.test.ts` reads it through the real fetchers too. The browser
  lane still reads `sahajcloud.ts` alone.
- In Ladle, react-map-gl never reuses a map, the canvas follows its own box,
  and mapbox-gl accepts a container inside the viewport iframe. A canvas
  carried between that iframe and the page had lost its WebGL context, and
  the map drew only its controls.
- Each story starts its router at `/`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sydevs-dispatcher

sydevs-dispatcher Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running

recent dispatches
  • 17:27Z address-review · attempt 1 · session · done
  • 17:27Z address-review · attempt 1 · session
  • 17:14Z review-pr · attempt 1 · session · done
  • 17:14Z review-pr · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-dispatcher sydevs-dispatcher Bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 25, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

All three commits serve the one story: the Interactive tier needs the sidebar order, the a11y strings keep the gate honest on it, and the backend is what lets it render. Nothing is smuggled, and nothing a host can observe moves.

Four bespoke mechanisms plus a 533-line second atlas, for one story — so I checked the lighter answers: no msw in the tree, Ladle ships no network layer, and neither mapbox-gl 3.35.0 nor react-map-gl 8.1.3 observes its container, so FollowBox is forced. The one aggregate alternative, turning Ladle's width addon off, retires both halves of react-map-gl.tsx and costs the view stories their frame. Keep the frame.

Findings

  • should-fix .ladle/react-map-gl.tsx:32 — this docblock and Map.tsx:509 claim opposite things.
  • should-fix Streamline sahajcloud-demo.ts:532, sahajcloud-demo.ts:362, App.stories.tsx:14 — three threads below.
  • should-fix The body understates its reach: the outline lists 12 of 21 files, and "touches only Ladle, the mocks, and the lane's challenge page" omits four src/ files and three docs.
  • consider config/a11y/a11y.ts:15 still mounts EN_A11Y "into the boot resource (config/i18n.ts)". This PR moved that to i18n-options.ts.

What was checked

Read whole: six .ladle/ files, four src/mocks/ files, App.stories.tsx, i18n.ts, i18n-options.ts, a11y.ts, tests/browser/fixtures.ts, Map.tsx. mapbox-gl and react-map-gl read in node_modules for ResizeObserver/trackResize. Streamliner: 47 pieces walked, 43 kept, 3 of 4 posted — I dropped one that would tie a deterministic fixture to ICU data. Ladder walked the seven files the script skipped. .claude/workflow.json has no fixture block; the story id resolves and every path the body names is in git ls-tree. No new dependency, no contract surface.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread .ladle/react-map-gl.tsx Resolved
Comment thread src/mocks/sahajcloud-demo.ts Resolved
Comment thread src/mocks/sahajcloud-demo.ts Resolved
Comment thread src/App.stories.tsx Resolved
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
The padding comment claimed react-map-gl resizes its own container. Neither
mapbox-gl 3.35.0 nor react-map-gl 8.1.3 observes a container: mapbox-gl has
only `_onWindowResize` behind `trackResize`, which is why `.ladle/react-map-gl.tsx`
carries a ResizeObserver at all. The two docblocks said opposite things.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVbNg9Ukdx3R1vhdT2
`answerDemo` wrapped `answerSahajCloud(request, demo)` for a single caller,
and the two exported types existed for that wrapper's signature alone.
`.ladle/backend.ts` now calls the router itself and lazy-imports `demo`, so
the atlas is still built on the first read and nothing earlier.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVbNg9Ukdx3R1vhdT2
`taken` held exactly the slugs `nodes` already held — both seeded from
`regionNodes`, every push paired with an add — so it was a second binding to
keep in step for an invariant one array can answer. At ~200 nodes the Set
buys nothing over the `find` above it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVbNg9Ukdx3R1vhdT2
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
sahajatlas-design ea09767 Nov 25 2026, 05:37 PM

`HostPage` had one caller in the same file and no second in sight, so the
stand-in page is now the story's own return. The two reasons its docblock
carried — raw markup on purpose, and the host's `h1` above the widget's `h2`
— sit beside the markup they explain.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVbNg9Ukdx3R1vhdT2
`bootResources` moved to `config/i18n-options.ts` in this branch, so both
notes naming `config/i18n.ts` as where the English strings mount were false.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVbNg9Ukdx3R1vhdT2
@sydevs-bot

Copy link
Copy Markdown
Contributor

Every thread adopted, 8a444cb → ea09767. Nothing rebutted.

From the review body:

  • a11y.ts:15 and docs/rules/i18n-and-state.md named config/i18n.ts as where the English strings mount. Both now say i18n-options.ts. ea09767
  • The body understated its reach. Change outline rebuilt from all 24 files; Notes name the five app-code exports and the four docs.

Lean gate, test:browser and ladle:build all green.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026

@sydevs-dispatcher sydevs-dispatcher Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved for Ardnived, who wrote it: GitHub refuses an author's own approval. CI is green and the automated review has run. Enable auto-merge when you want it merged: the queue tests it against its base. 🤖 Written by the sydevs autonomous loop — see what this is

@sydevs-dispatcher sydevs-dispatcher Bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Pending to Awaiting in SYDevelopers Technical Roadmap Nov 25, 2026
@Ardnived
Ardnived added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit f796b68 Nov 25, 2026
79 of 84 checks passed
@Ardnived
Ardnived deleted the claude/feat-ladle-interactive branch November 25, 2026 18:05
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Awaiting to Done in SYDevelopers Technical Roadmap Nov 25, 2026
Ardnived added a commit that referenced this pull request Nov 25, 2026
- The inline column takes #476's header: Back names where it goes, above the
  view's own controls. `NavHeader` passes `isPlace` through, so a region's
  title still gives way to the page heading inline.
- "Close map" renders beside the cog now that the peek strips are gone, and
  reads the sheet's live top from a wrapper the sheet-top loop also writes.
- The inline embed reads #481's fixture names (`sahajcloud.ts`,
  `sahajcloud-demo.ts`); the branch's own copies of the Ladle backend and the
  demo atlas give way to main's.
- The deep-link scenarios assert #476's climb past one-class places, inline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ardnived added a commit that referenced this pull request Nov 25, 2026
Takes the loop's #481 merge and its glyph-tint expression. Its 78d0d76
dropped the cog's hide on the claim that both drawers cover the column whole.
They do on the desktop calendar, but at a 390x844 phone's near-full stop the
sheet's top sits at 25px and the column's at 16px, so find-me and the credits
showed 9px slivers above it (measured). The owner chose one switch that hides
the whole column there (`useMapControls`), which also serves the inline view's
toolbar later, so this side of those hunks is kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants