Skip to content

feat(widget): one slot question, and a compact card that works in an iframe - #162

Merged
Ardnived merged 42 commits into
mainfrom
feat/compact-card
Aug 24, 2026
Merged

Ardnived merged 42 commits into
mainfrom
feat/compact-card

Conversation

@Ardnived

@Ardnived Ardnived commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • A host slot too small to hold the interface now renders a compact card — one button, no data requests, no mapbox-gl — instead of painting a cramped map over the page or warning into a console nobody reads.
  • The card works in an iframe, which is the case the ticket was written for (sahajayoga.nl embeds at a hard-coded 400×600). Where the widget can grow in place it opens a full-screen dialog over the host's page; where it cannot, the same control is a link to wemeditate.com/map in a new tab.
  • The eager payload drops 382 → 299 KiB (standalone) and 384 → 301 KiB (embed), because the whole map-bearing interface moved behind a lazy FullInterface seam.

Changes

One question replaces three. src/lib/embed-slot.ts went 463 → ~175 lines. mapSlotWarning, resolveEmbedForm/embedForm, compactFit, slotDecision, containingBlockProperty and ten constants are gone, along with src/lib/compact.ts and DynamicCompactCard.tsx. What remains asks one thing — is the space we have meaningfully smaller than where the button would take the visitor? — as resolveDestination (overlay / link / none) and embedLayout (full / compact), composed in src/lib/slot-decision.ts, the single entry point both Widget.tsx and main.tsx call.

Three corrections that shaped the model, each of which would have shipped a bug:

  • A frame is a viewport. position: fixed resolves against the frame and window.innerHeight is the frame's height, so map mode is not broken inside a 400×600 iframe. An earlier "framed ⇒ link" rule would have degraded a working framed map embed and shipped the visitor off-site.
  • "Am I framed" is the wrong discriminator. The question is whether the local viewport is bigger than the slot; framing only decides the fallback when it isn't. This also fixes a web component inside a generously-sized iframe (page builders, CMS previews), which the naive rule sent off-site while a 1200×800 overlay sat available.
  • Unmeasured is per-axis, not per-input. In map mode the height axis is always unmeasured at first render — the element is still empty. A whole-input bail would have made map mode never compact.

src/views/CompactEmbedView/ — the card plus the dialog it opens, as one view rather than an organism and a separate Dialog atom. The dialog is @radix-ui/react-dialog with a margin, so the host's page stays visible behind it and Escape / × / a click on the margin all return there.

src/views/FullInterface.tsx — new, lazy. Extracting it is what keeps mapbox-gl (485 KiB gz) out of a compact embed's graph. This needed three edges cut, not one: use-map-controller is split so the seam module carries no react-map-gl import, and both App.tsx and the story harness import past barrels that re-export Mapbox.

Framing is now a documented delivery. docs/embedding.md leads with two configurable embed codes — loader and iframe — and states the model that no doc carried before: the loader is primary, the iframe secondary for hosts that cannot run it, and sahajatlas.com is a by-product of both rather than a destination. It gains a Permissions-Policy table beside the CSP one (geolocation, clipboard-write, web-share — each fails silently rather than erroring), and the iframe contract: don't sandbox, or include allow-popups and allow-same-origin.

Removed: the compact configuration option. Host-observable, so it is in CHANGELOG.md under Removed. With one predicate there is nothing left for a three-valued override to mean.

Three review passes, and what the later ones caught

The first pass caught the critical vaul regression. The later two mostly caught my own fixes, which is worth stating plainly:

  • The analytics move broke analytics. Analytics mounts inside the interface, which the dialog unmounts on close — so ownsTracker (a ref) reset on reopen while 'fathom' in window was by then true because our own script set it. Load returned early, the flag never re-armed, and pageviews stopped for the document's life. Both latches are module scope now.
  • A claim I put into .claude/rules/tests.md was false. I wrote that renderToStaticMarkup "renders no portals"; measured, it throws on one. The real cause of the vacuous spec is Radix's <Presence> — a closed portal never calls createPortal. The rule now states both halves, and the asymmetry (blind to a closed portal, loud about an open one) is the useful part.
  • The auto-open spec failed to catch its own bug twice — once because a sibling test had latched the module-scope flag, once because a bare createRoot render doesn't double-invoke and the whole StrictMode bug is invisible outside <StrictMode>.
  • The review server had a second crash path (existsSync is true for a directory → unhandled EISDIR), bound 0.0.0.0 while serving pages with the API key in them, and its map page showed the compact card on any display wider than ~1455px.

Every fix above was verified by reintroducing the defect and watching the guard go red.

Verification

  • Lint: ✓ (pnpm lint)
  • Types: ✓ (pnpm typecheck)
  • Tests: ✓ 1263 passing (pnpm test:run)
  • Build: ✓ (pnpm build) — assert:css 1161 rules confined, assert:maps clean
  • Size: ✓ (pnpm size) — budget ratcheted 395 → 310 in the commit that won the space, per the script's own rule

Manual / visual verification

Measured in a real browser (Playwright MCP), because these are the claims no lane can hold:

  1. A sandboxed iframe does not block pushState. I asserted it did, in code and in docs. Measured: localStorage throws under sandbox="allow-scripts", replaceState/pushState succeed, and window.open is blocked. Code and docs corrected; the file:// insurance was deleted rather than kept for an unsupported situation.
  2. Icons. The defensive all: revert erased all 53 SVG paths in the widget — under SVG 2, geometry properties like d are CSS, and presentation attributes are zero-specificity author rules. Fixed with :not(svg, svg *) and pinned in postcss-scope-widget.test.ts.
  3. Scrolling inside the dialog, both map branches, with a real trusted wheel event (0 → 126 of 126). Synthetic wheels don't scroll in Chrome and scrollTop = 200 clamps, so the first two attempts here were inconclusive and I had read them as passing.
  4. The dialog's margin, across all four consumers of viewport units — a --sy-frame-h token plus vaul's container prop, since vaul otherwise computes snap offsets from window.innerHeight.

Notes for reviewer

  • The CSP table is unchanged. The new Permissions-Policy table sits beside it and is not iframe-only: a host sending Permissions-Policy: geolocation=() breaks the locate control in a script embed too.

A collapsed card does nothing a visitor did not ask for

Four things fired from a collapsed compact card that had no business firing there, all found after the first CI-green pass. Each was the same mistake wearing different clothes — an effect mounted with the shell rather than with the interface:

Fired while collapsed Now
The home-region redirect, writing ?atlas=/nl onto the host's URL Moved into FullInterface
warmCaches() — the whole events feed and the region tree, on every page view Warms when the interface mounts
A Fathom pageview of /, plus injecting our tracker into the host's page Analytics mounts with the interface
— Browser-verified: 3 data requests before, 1 after (clients/me, which the card needs)

One property underwrites all of them: React never renders the card's children until the dialog opens. That is also what keeps mapbox-gl unfetched. Nothing pinned it, and each fix has its own spec that would keep passing if it broke — so it now has a jsdom spec of its own.

  • ?atlas= is not written while a compact card sits collapsed. The home-region redirect moved from AppShell into FullInterface, so it cannot run while nothing but the card is on screen — otherwise a visitor who reloaded that address got a dialog over the host's page having never asked for one. This is structural, not a condition to remember; note the Ladle story cannot demonstrate it, since it runs on a MemoryRouter.
  • Auto-open on a page-URL ?atlas= is intended, and the loader now mounts eagerly in that case rather than waiting for a scroll — the route is why they clicked. A script-URL default still lazy-mounts and does not auto-open. One provenance signal drives both, so they cannot disagree.
  • The fallback link carries no route. wemeditate.com/map serves the legacy hash-routing build until the origin cutover (chore(build): stop the sahajatlas.com zone overriding the loader's Cache-Control #148 Part 2), so an appended ?atlas= would be silently dropped. Revisit there.
  • Not implemented, scope reduced by the owner: a "View event" copy variant for the Event route.

Closes #161

🤖 Generated with Claude Code

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 19, 2026 •

Copy link
Copy Markdown

Deploying sahajatlas-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0b5ac87
Status: ✅  Deploy successful!
Preview URL: https://85af44c6.sahajatlas-design.pages.dev
Branch Preview URL: https://feat-compact-card.sahajatlas-design.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 19, 2026 •

Copy link
Copy Markdown

Deploying sahajatlas with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0b5ac87
Status: ✅  Deploy successful!
Preview URL: https://32b46b55.sahajatlas.pages.dev
Branch Preview URL: https://feat-compact-card.sahajatlas.pages.dev

View logs

@Ardnived Ardnived changed the title feat(widget): degrade to a compact card in a slot too small for the interface feat(widget): degrade to a compact card sized to the host's slot Aug 19, 2026
@Ardnived Ardnived changed the title feat(widget): degrade to a compact card sized to the host's slot feat(widget): one slot question, and a compact card that works in an iframe Aug 20, 2026
@Ardnived
Ardnived force-pushed the feat/compact-card branch 2 times, most recently from db5e816 to 5f08df0 Compare August 20, 2026 15:55
Ardnived and others added 24 commits August 20, 2026 11:06
`embedForm` beside `mapSlotWarning`: absolute pixel floors, because "does the
interface fit?" is a question about the interface rather than about the host's
intent — and a false positive changes what renders instead of costing a console
line. `MIN_EXPANSION_GAIN` is what stops those floors mistaking a phone for a
cramped slot: a compact card is only worth offering when the overlay it expands
into would be bigger than the slot.

Nothing reads it yet.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`useExpansion` is the same seam shape as `MapController`: nothing branches on
whether expansion is possible, and the framed provider E1/E2 needs slots in
beside the two here.

The surface is Radix Dialog directly rather than the Modal atom — the whole
viewport, no chrome — because expansion is map mode's layout made explicit and
reversible, which is what makes vaul's window-height arithmetic correct inside
it. Every portal in the app is redirected into it while it is open, since a
modal dialog would otherwise leave the drawer stack unreachable by keyboard.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Three rows off the already-cached feed — nearest when the session's IP guess is
there, soonest otherwise, since a card promising "near you" with no location
would be picking three classes at random from the world. No fetcher of its own;
`toSlim` is exported so the route guard on a CMS `webPath` keeps one definition.

The one control is named for the task, not the product, and the file joins the
#158 ratchet's list so it stays that way.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…interface

AppShell picks the form, and it has to be AppShell: it is the only component
above MapProvider, so it is the only place from which the map subtree can be
left unmounted — which is what keeps mapbox-gl unfetched. The interface is
passed as children, so React never renders it until the surface opens.

Widget.tsx measures once, on the first render, from the element itself. One
pass answers both questions and emits at most one line: where the widget now
renders compact, the map-slot warning has nothing left to warn about.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Three findings from driving the real drawer stack inside the surface, none of
which a node spec could have reached.

Focus on open landed on the settings cog — the first tabbable — announced with
no word about what had opened; it now lands on the dialog. Focus on close landed
on <body>, because Radix restores to a `Dialog.Trigger` and expansion is
requested through the seam instead: the surface remembers the opener itself,
skipping anything inside its own subtree, since the dialog's own mount focus
fires while that listener is still attached.

And a host ancestor with transform / filter / contain confines the overlay to
its box — re-measured here, `container-type` does not — so a compact embed under
one now says so rather than expanding into the slot it was degrading out of.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`compact` has been documented and inert since #149; the guide now says what the
three values actually do, what the floors are, that the decision is taken once,
and that an ancestor with transform/filter/contain confines the overlay.

The card's list scrolls rather than clips — a row cut in half by the slot reads
as a broken card, where a scrollbar reads as more to see.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Escape does not reach this dialog and never will: the drawer stack inside it is
vaul, which is Radix Dialog underneath, so its dismissable layer is the topmost
one and Radix delivers the key there. That is the right behaviour — Escape
dismisses the drawer the viewer is looking at — but it makes the collapse
control the only way out, so the docblock had better say so.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The ancestor walk's docblock claimed it names the outermost offender; it walks
outward and stops at the first, so it names the innermost — which is the better
one to name anyway, and now the comment says what the loop does.

`forEach(reportIntegrationWarning)` handed the callback an index and the array
as well; wrapped, so a second parameter on that function can never be fed a
number. And the surface's `onOpenChange` returned a discarded boolean.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`.claude/rules/components.md` gains the form decision (and a row in the
responsive table saying it is NOT one of the three signals), the portal
redirect, the two browser-only findings and the containing-block hazard;
tests.md's enumerated jsdom list grows a fifth entry rather than going stale.
CLAUDE.md and DESIGN_SYSTEM.md pick up the two new components and the seam.

The overlay's `aria-hidden` over the host page is host-observable, so the
integrator guide and the changelog say so alongside the scroll lock.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
A modal that covers nothing is worse than no modal. The surface locks the host's
scroll, hides their page from assistive technology and — because vaul's layer
swallows Escape — leaves its collapse control as the only exit. A host who hides
the slot, confines it with a transform or scrolls it out of view therefore gets
a page nobody can scroll, read or click, recoverable only by reload. No attacker
required.

Two exits. `DrawerStack` finishes the Escape ladder: once the stack can neither
dismiss nor collapse further, the key belongs to whatever contains the widget,
so it calls `useExpansion().collapse()` — a no-op with no surface, which is the
seam doing its job. And the surface watches its own box while open, closing
itself with a warning rather than trapping anyone when it turns out not to cover
the page.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Two wiring bugs, both invisible under `auto` and both wrong in the one mode that
still paints over somebody's page.

The map-mode takeover warning was suppressed whenever the compact decline had
already spoken — which is exactly `compact=never`, the case `embed-slot.ts`
promises it survives. A map embed in a 300px sidebar was told the interface
would be "cramped" when it was about to cover the whole page.

And the measurement named an axis it had not measured. `<sahaj-atlas>` is still
empty when this runs, so a bare element reports 0 tall — the headline case for
the whole feature reading as "300×0px", pointing at the opposite of the fix.

The composition is now `slotDecision`, a pure function with a spec: every part
was already covered and the join was where the fault lived, exactly as
`tests.md` records for `timeoutStatus`.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…d cannot parse

The IP lookup was ungated where every other call site gates it, so a visitor who
had dismissed the nearby prompt was pinged again and `docs/embedding.md`'s
promise that it is skipped when no feature needs it stopped being true.

The card also rendered before its titles arrived — nameless rows — and ran the
only `toSlim` in the repo that sits in a render body, so a schema drift React
Query would have handled threw past it and replaced the whole embed with an
error panel in a 300px box. No rows is a state this card already has.

`ReportIssueModal` portals through `overlayContainer()`, so collapsing with it
open would strand it in a detached node with its scroll lock still on the host
page; it is closed first.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The guide, the changelog and the components rule all recorded "Escape does not
close the overlay" as an accepted limitation. It is closed, so they said the
wrong thing.

Three other corrections a review caught: the height floor has no column
fallback, so an element with no height of its own is never called too short; the
IP lookup has a third consumer and honours the session dismissal; and a deep
link into a compact embed opens the card rather than the route, which is a
decision worth stating rather than leaving a host to discover.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The card assumed it had a box to fill. `h-full` resolves against nothing when the
host gave the element no height — the common way a bare <sahaj-atlas> lands in a
column, and one the guide already says is never called too short — so the embed
collapsed to invisible in exactly that case.

A third question, beside the two already here: `mapSlotWarning` asks whether
somebody intended a box, `embedForm` whether the interface fits, and `compactFit`
whether anything beyond the button fits. All three come off the one measurement
taken at mount. The button is irreducible — a 200px box still gets it, centred —
and rows appear above it only with room to spare.

A card with no rows now reads nothing at all: no feed, no titles, and no IP
lookup. That is a better answer to the review's gating finding than honouring the
dismissal alone, because a button-only card has nowhere to put the answer.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`mapSlotWarning`, `embedForm`/`resolveEmbedForm` and `compactFit` were three
predicates over one measurement, which is three places the answers can
disagree — and they did, in the wiring bug this branch already fixed once.

What survives is the question underneath all three: is the space we have
meaningfully smaller than the space the button would take the visitor to?
That needs two boxes rather than one, because "too small" is meaningless
alone — 360px is cramped in a 1440px page and is simply the screen on a
phone. `resolveDestination` answers where the button goes, and `embedLayout`
answers what to render, from the same numbers.

Three constants become one. 0.8 is not a midpoint: it preserves the old
`boxed` boundary to the pixel, converts a 1000px map takeover that was
silent, and fixes a live false positive where a normally padded phone layout
degraded a working map-less embed.

Map mode that does not own its viewport now renders the card rather than
warning and then painting over the host's page — so `mapSlotWarning` has no
remaining job. `containingBlockProperty`'s ancestor walk goes too: it cost
~80 lines to name at mount what `SURFACE_CONFINED_MESSAGE` already says at
the first press, and only for causes it enumerated.

The card is now the button. Preview rows were sized by a per-row pixel
estimate that a wrapped title or a larger default font made wrong, and cost
a feed read, a titles read and a third-party IP lookup on every page view of
a sidebar embed nobody scrolls to. A compact card now makes no data requests
at all.

`compact` is removed from the loader. A documented knob for a measurement we
can get right is a permanent edge case traded for a misconfiguration we would
rather fix.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The ticket's reference case — sahajayoga.nl at 400x600 — is an IFRAME
client, and the compact card was unreachable there twice over: main.tsx
never measured anything, and even if it had, the slot IS the viewport in a
frame so an in-page overlay would gain nothing.

A frame cannot expand, so a framed embed too small for the interface gets an
anchor to a page that fits, opened in a new tab. Rendered through the Button
atom's href form rather than a new JSX anchor, so it inherits the isSafeHref
gate that href.test.ts pins to three components.

"Is a new tab bigger?" is answered against min(outerWidth, screen.avail*).
screen alone reports the DISPLAY, so a small frame in a small window on a
large monitor would be told a new tab gains far more than it does.

main.tsx also gains two things it should have had already. It mounted a bare
BrowserRouter, so a sandboxed frame threw SecurityError on the visitor's
FIRST navigation rather than at boot — a live failure the frame delivery
walks straight into. And it composed share links against
window.location.origin, handing out sahajatlas.com URLs from inside a frame
whenever an event had no canonical of its own: a dead end for the visitor
and the branding leak #158 exists to close.

A page-URL ?atlas= now mounts the widget eagerly and opens onto that route.
Eager-loading is not an optimisation — the loader lazy-mounts behind an
IntersectionObserver, so auto-opening without it would slam a modal over the
page MID-SCROLL. One provenance signal drives both, so they cannot disagree,
and a script-URL default view does neither.

Documents the browser permissions a host must grant. geolocation,
clipboard-write and web-share are denied to a cross-origin frame by default
and all three fail silently. Our own source does not enumerate them:
<GeolocateControl /> is our JSX but the call is inside mapbox-gl, so a grep
of src/ finds nothing and concludes wrongly.

Closes #161

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Measured in Chrome 151 against a real `sandbox="allow-scripts"` frame,
because this branch was about to ship a claim built on the old one.

The guide has said since #154 that "in a sandboxed iframe the browser
refuses to let us write the URL at all", and I repeated it in this branch's
own comments as the justification for the MemoryRouter fallback. It is
wrong. The frame IS opaque — `localStorage` throws SecurityError — and
`replaceState`, `pushState` and a replaceState to a different URL all still
succeed. So `urlWritable` does not detect a sandbox, and the fallback is
insurance for `file://` and stricter engines rather than the fix it was
introduced as.

What a sandbox does block is `window.open`, which returns null without
`allow-popups` — so the compact card's link, which is the one thing in this
branch that depends on opening a tab, is the real casualty. That was the
documented host requirement already; it is now a verified one, and the
troubleshooting table names the symptom, since the browser blocks it in
silence.

Also verified in a real cross-origin frame, since the framed path rests on
it: `window.outerWidth` reads 1200 where `screen.availWidth` reads 1440, so
taking the smaller of the two is load-bearing rather than defensive.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The MemoryRouter branch this branch added to main.tsx was justified as
insurance for a sandboxed iframe. Measuring that turned out to be wrong —
Chrome 151 permits replaceState and pushState in a real
`sandbox="allow-scripts"` frame — which left `file://` as the branch's only
remaining trigger.

`file://` is not a supported way to run this build: it has no origin the API
will accept and no CORS, so the widget fails long before its router does. A
branch whose only case is a configuration we do not support is never
exercised and never right, so it is gone along with `lib/url-writable.ts`
and the cross-seam pin it needed.

The loader keeps its own probe, privately, because it answers a different
question: whether a page can carry a shareable route, which is what decides
canonical viability in the embed report.

Recorded in `.claude/rules/components.md` so the next reader does not
re-add it.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ghbour

`h-full` was joined onto the class list with a template literal, and
prettier-plugin-tailwindcss re-sorts the static half and eats the leading
space — so a filling card shipped `text-foregroundh-full`: a class present in
the DOM, matching no rule, with lint, typecheck, the unit lane and the
production build all green. The card sat 91px tall at the top of a 600px slot
instead of centred in it.

This is the silent-Tailwind failure `.claude/rules/code-style.md` warns
about, and it survived a computed-style check because that check read the
inner column rather than the root. A screenshot of the deployed preview is
what caught it.

`clsx` for the conditional half, which is what the rules already prescribe
for conditional joins. The spec now splits the class attribute into tokens
and asserts membership rather than substring containment — the old
`toContain('h-full')` passes happily on `text-foregroundh-full`, which is
precisely why it missed. Verified by reverting the fix and watching it fail.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Every overlay story passed `onOpen: () => {}`, so the buttons did nothing —
which made the one interaction worth reviewing the one thing a reviewer
could not see. Only the framed fallback worked, because an anchor needs no
handler.

The overlay stories now compose the real `useExpansion` seam with a real
`ExpandedSurface`, the way `AppShell` does, so pressing a button opens the
surface, Esc steps out, the collapse control works and focus returns to the
button. The framed story stays an anchor, and its docblock now says why that
difference is the feature rather than an inconsistency.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`all: revert` over a bare `*` was applied to SVG internals too, and in SVG 2
the geometry IS css: `d`, `fill`, `cx`, `r`, `x`, `y` are properties, and a
presentation attribute is only an author rule of zero specificity. So the
reset beat every `d="…"` in the app and rolled it to `none`.

The failure is total and silent. The `<path>` stays in the DOM at its full
28x28 with a computed fill; `getBBox()` reports 0x0; nothing paints. Measured
at 53/53 paths in a PRODUCTION build, so this is shipping — every icon in the
embedded widget renders as nothing, and lint, typecheck, the unit lane and
assert:css are all green while it does.

The reset exists to keep a host's CSS out of our HTML. SVG internals are not
a surface a host styles, so excluding them costs nothing it was there to buy.

Pinned in postcss-scope-widget.test.ts as a string check, which is the honest
limit of the node lane: whether a browser paints a glyph is not something it
can answer, but it can stop the exclusion being simplified away — which is
exactly how this would come back.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Five named exports, each a context the card turns up in, against a repo
where every other story is one `Default` with sections and a `storyName` —
and contexts are a view's concern, not an organism's.

Now one story whose sections are the component's two actual props: `action`
(overlay vs link) and `fill`. Which one an embed gets is `decideSlot`'s
answer, which is measurement rather than configuration, and is specced in
the node lane rather than previewed here.

Includes the `storyName` convention applied to ReportIssueForm.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Renamed and re-scoped. The old name described one caller; what the component
is, is a large chrome-less dialog — the widget's own interface over the page
rather than in it. `Modal` remains the small `max-w-md` panel with a
title/description header; the difference is size and whether the content is
a panel or an application.

It now keeps a margin, and the margin is the point: a full-bleed `inset: 0`
layer reads as a navigation, with the host's page simply gone and no way for
a visitor to judge that they are still on it. A visible frame plus
click-outside-to-close makes it legibly a layer over their site.

⚠ `contain: layout` on the content is what makes the margin possible, not an
optimisation. Everything inside is `position: fixed` — the map canvas, every
drawer, the peek strips, the cog — and a fixed descendant resolves against
the VIEWPORT unless an ancestor establishes a containing block. Measured in
Chrome 151: a `fixed; inset: 0` child of a `fixed; inset: 16px` parent lands
at 0,0,1440,900 plain and at 16,16,1408,868 under `contain: layout`. Without
it the interface escapes the margin and paints to the screen edge. That is
the same property the rules forbid on the SCOPE ROOT, for the same mechanism
pointed the other way.

Custom code removed rather than moved: the `ResizeObserver` that watched the
surface's own box and closed it when it stopped covering the viewport, plus
`surfaceCoversPage`, `SURFACE_MIN_COVERAGE` and `SURFACE_CONFINED_MESSAGE`.
That machinery existed because the × was the only exit and a host could hide
it. Radix maintains two more exits for free — click-outside and Escape — so
a confined dialog is now a cosmetic problem rather than a trap, and there is
nothing left for it to guard.

Verified in a browser: opens inset on all four sides, `contain: layout`
active, clicking the margin closes it, focus returns to the opening button.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… slot

**A view rather than an organism, because it is a whole screen.** It is what
the widget IS in a slot too small for the interface — the alternative to
`DrawerStack`, chosen by `decideSlot` at mount — not a piece something else
composes. Its stories were already describing contexts rather than props,
which is the symptom of a view filed under components.

**`fill` is gone.** It takes the height its content needs and no more, in
the host's own flow, whatever box they gave. Filling was wrong in both
directions: against an element with no height `h-full` resolved to nothing
and the card collapsed to invisible, and against a tall one it stretched a
two-line card down 600px of empty background. A card the size of a card is
right in every slot, and removing the prop removes the whole class of bug
that produced `text-foregroundh-full`.

That deletes `fill` from `CompactState` and `decideSlot` too — the element's
own height was measured only to feed it.

The story now opens the REAL `CountriesView` inside the dialog, seeded
through `ViewHarness`, so the whole path is reviewable end to end without a
backend rather than mocked at the last step.

⚠ It does NOT settle the vaul question. `ViewHarness` substitutes a flex
panel for the vaul sheet, so no `position: fixed` drawer is in play — there
were zero fixed descendants inside the dialog when measured. Whether a real
snap-point sheet computes its travel correctly against a dialog 32px shorter
than the window still needs the app with a live key.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Ardnived and others added 14 commits August 20, 2026 11:07
Setting a viewport in Ladle stripped every component in every story back to
UA defaults — unstyled buttons, Times body text, no tokens.

The scope class was added at module scope to `document.documentElement`, and
Ladle's viewport control re-renders the story inside an iframe. The side
effect ran against the document that loaded the module, not the one the
story lands in, so the iframe received the stylesheet and no `.sy-atlas` —
and since the PostCSS pass scopes every emitted rule to `:where(.sy-atlas)`,
the whole sheet matched nothing.

The wrapper `<main>` now carries the class as well, which is the only form
that travels with the story into whatever document renders it. Harmless
where both apply: `:where()` contributes no specificity and the
inherited-property block sets the same values at either level.

Measured before and after in the iframe: button background
rgb(239,239,239) (UA) → rgb(26,92,97) (brand), content font Times → Atlas
Raleway.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Two components called Modal and Dialog sat side by side in atoms/ appearing
to do the same job, and the one that looked generic was not. It published
itself as the app's portal target, it needed `contain: layout` because THIS
app's interface is fixed-positioned throughout, and it had exactly one
caller. That is domain knowledge in an atom and a single-use composition
exported as a primitive — `.claude/rules/components.md` rules against both,
in the same section.

So it moves into `CompactView`, module-private, and `Modal` becomes
unambiguously the dialog atom: small, centred, chrome-ful, generic.

`CompactView` now owns the whole compact screen — the card, the dialog, the
expansion providers and the report-modal handoff — which also deletes
`CompactShell` and `CompactForm` from App.tsx. App's branch is one line: the
compact view, or the interface.

Also collapses the duplicated `autoOpen`, which was stored both on the
action and hoisted beside it.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Renamed from CompactView throughout — "embed" is the word that says which
slot this is about.

The story collapses to a single example with controls, matching every other
view story: an Interface select (Countries / Search / Region / Event /
Calendar), an "In context" toggle that renders it in a mock host page, and a
Map toggle, on by default. No fixed viewport, so the embed gets the whole
canvas and how it sizes itself in an unconstrained slot is what is on screen.

**The map was missing because the harness never rendered one.** `ViewHarness`
hard-coded `hasMap: false` and `NoopMapControllerProvider`, so every view
story — not just this one — previewed the map-less arm. It now takes `map`,
which moves all three together: the mode flag, `MapProvider` + a real
`<Mapbox/>`, and `RealMapControllerProvider`. A flag on `WidgetMode` alone
would tell the tree a map exists without rendering one and without a real
controller, which is a state the app never has. Falls back to the map-less
arm without a token rather than previewing a broken canvas.

⚠ Then the view floated transparently over the map, and the cause is worth
recording: the map wrapper is `position: absolute` and the drawer column was
static, and **a positioned element paints above a static sibling whatever the
DOM order**. The column is now positioned, and with a map behind it is an
anchored panel rather than a full-bleed column — which is what map mode
actually renders.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The expanded dialog appeared unscrollable. It was not — the scroll range was
94px and worked programmatically — but the harness column is `h-screen`
(900px) inside a dialog that is 868px with `overflow-hidden`, so the bottom
32px of the scroll area, scrollbar included, was clipped. Scrolling you
cannot see is indistinguishable from scrolling that does not work.

32px is exactly the dialog's margin, which makes this the first concrete
instance of the tension that margin introduces: anything inside the dialog
that sizes off the VIEWPORT is wrong by the margin. `ViewHarness` now takes
`height`, and the compact story passes `container`.

⚠ We own that arithmetic. We do not own vaul's: it computes a snap-point
sheet's travel from `window.innerHeight`, so a real bottom sheet inside the
dialog has the same exposure and cannot be fixed the same way.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The countries list still would not scroll with the map on — the default, and
the branch my previous fix did not check.

The column carried `relative` in the shared half and `absolute` in the map
arm. Tailwind emits `.relative` after `.absolute`, so `relative` won,
`inset-y-0` did nothing, and the column grew to its content: 994px inside an
868px dialog, clipped, with no height bound for the body to scroll within.
Nothing was scrollable at all — `scrollables: []`.

Now exactly one position class per branch. Verified in BOTH map states with
a real trusted wheel rather than a synthetic event (synthetic wheels do not
scroll in Chrome, which is what made the first check read as inconclusive):
0 → 126 of 126 either way.

Checking one branch and shipping the other is what produced the bug; the
comment says so where the next person will be tempted to merge the strings
again.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`compactState()` had exactly one caller and lived in its own 43-line module.
Its result type now sits with the function that returns it, which is one
fewer module and one fewer import hop for a feature that was spread over
four.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Two rule/reference files described machinery the branch deleted:

`.claude/rules/components.md` said the surface "watches its own box while
open (`surfaceCoversPage`)". That observer is gone — the dialog's margin and
click-outside are what replaced it, and the passage now says so rather than
describing a guard that no longer exists.

`DESIGN_SYSTEM.md` still listed a `Dialog/` atom. It was folded into
`CompactEmbedView`, so `Modal` is now named as the dialog atom outright.

Also records the margin's one real cost while it is fresh: anything inside
the dialog sizing off the viewport is wrong by the margin — ours is fixed,
vaul's is not ours to fix and is unverified against a live drawer stack.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… were false

**autoOpen never fired in a dev build.** The once-per-document latch was
written inside a `useState` initialiser. React double-invokes initialisers
under StrictMode — which `providers.tsx` mounts unconditionally — and keeps
the SECOND result, so pass 1 set the flag and pass 2 returned false. Three
reviewers reproduced it independently: committed state false, flag true.
Production strips the double-invoke, so the shipped path works today — but
only while nothing below the provider suspends before it commits, which is
not a property anything holds. The latch is now an effect, which runs only
for a commit that survived.

**An unmeasurable screen degraded every framed embed.** `newTabBox` `||`-ed a
zero reading up to Infinity, making "is a new tab bigger?" unconditionally
true — so a browser reporting 0 for both `outerWidth` and `screen.avail*`
(WebViews, prerender, hardened privacy modes) sent every framed embed,
however large, to the card and then off-site. Zero now means "no evidence",
which is the bias every other predicate in the file takes.

**Focus fell to the host page's body on two real paths.** `preventDefault()`
ran unconditionally, suppressing Radix's own restore, while `opener` is empty
both on the auto-open path (the recorder effect never runs for a dialog open
on its first render) and on Safari/Firefox, which fire no focusin from a
button click. It now pre-empts Radix only when it has somewhere to send focus.

Also fixed: the framed `hrefFor` composed routes against the fallback base and
fabricated `wemeditate.com/<route>` 404s, where the contract already models
"no link" as `undefined`; `fromPage` was read twice from `location.search`
either side of a dynamic import, so a host SPA adding `?atlas=` after boot
could lazy-mount and still auto-open mid-scroll; the story seeded the Search
key at [0, 20] against a store default of [0, 0], so that arm hit the absent
backend; and the scrim had drifted to /40 against the Modal atom's /50.

Docs corrected rather than defended: both host-facing files promised an
overlay self-close this branch deleted, and claimed the collapsed card makes
"no data requests at all" when the client read, the cache warm-up and the
embed report all still run. The guide now names `wemeditate.com` as the
framed fallback destination — a host can observe it and nothing told them.

Housekeeping: `toSlim` re-privatised, `canExpand` removed (declared, set by
both providers, read by nothing), four stale comments fixed, the `+`
continuation markers a blanket Prettier run flipped in three governance files
restored, tests.md's jsdom list corrected to six, and `responsive.test.ts`
extended to police raw `window.inner*` / `screen.avail*` reads — the
closed-list gate could not see the one this branch added.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The claim was false, and I made it in five places. `react-map-gl`'s
`exports-mapbox.js` runs `const mapLib = import('mapbox-gl')` at MODULE
scope, so importing it anywhere in the eager graph fetches 485 KiB gz
whether or not a map renders. A 300px sidebar embed — a heading and one
button — downloaded the entire map library on every page view.

Three eager edges had to go, not one:

- `FullInterface` is now its own module behind `lazy`, carrying `MapProvider`,
  `Mapbox` and the real camera provider.
- `use-map-controller.tsx` keeps only the seam — context, `NOOP`,
  `useMapController`, `NoopMapControllerProvider` — and can no longer import
  `react-map-gl`, directly or transitively. The real provider moved to
  `use-map-controller-real.tsx`. While they shared a module, even `map=false`
  pulled the library in.
- `App.tsx` imports `ReportIssueModal` from its own path rather than the
  `@/components/organisms` barrel, which re-exports `Mapbox`.

That last one is why measuring mattered: after the lazy split, static
analysis said mapbox-gl was no longer reachable from `embed.js`, and a
browser said it was still fetched — through the one remaining barrel import.

Measured in a production build, real page, real network log: mapbox requests
went 1 → 0, and the eager payload 375 KiB → 301 KiB (embed) and 373 → 299
(standalone), a 74 KiB drop on top of the 485 KiB that left the critical path
entirely.

`check-bundle-size.mjs`'s docblock said dynamic-import targets are "a second
hop, not the first-load cost" — the sentence that let this hide for a whole
PR. It now says a dynamic import is only a second hop when the module holding
it is itself lazy.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The dialog keeps a margin, so it is 16-32px shorter than the window — and
every drawer, peek strip and sheet inside it is `position: fixed`, which
means `100dvh` was only ever correct while nothing had taken the containing
block. The dialog takes it, via `contain: layout`. Four consumers were wrong
by exactly the margin: the sheet overran the clip edge, the peek strips sat
below the sheet they cap, the sticky Register bar was offset, and the
fallback bodies mis-measured their max height.

One token fixes three of them. `--sy-frame-h` is `100dvh` on `.sy-atlas` and
`100%` on `[data-sy-expanded]`; `100%` on a fixed child resolves against its
containing block, which is the dialog there and the viewport everywhere else,
so a single value is correct in both places without anything branching.

`--sy-sheet-top` needed the matching correction: it is written from
`getBoundingClientRect().top`, a viewport coordinate, and consumed as `top:`
on fixed peek strips and `bottom:` on the sticky bar. The dialog's own top is
now subtracted — zero offset everywhere else, so it is the same number it
always was outside one.

vaul turned out not to need a patch. It measures `container` when given one
and `window.innerHeight` otherwise, so the Drawer atom forwards `container`
to `Vaul.Root` — the same element it portals into, so the box vaul measures
can never differ from the box it renders in.

Verified with a REAL snap-point sheet in a contained 768px box at an 800px
viewport, which nothing had tested before: the sheet computes 768px rather
than 800, and its peek is exactly the 80px snap. The story harness could not
answer this — it substitutes a flex panel for the vaul sheet — so the
measurement was taken against a throwaway probe story.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`AppShell`'s home-region redirect ran whenever the shell mounted, including
when a compact card was the only thing on screen — and `navigate` pushes
`?atlas=/nl` onto the HOST page's URL. A visitor who then reloaded,
bookmarked or shared that address got a full-screen dialog over the host's
page on load, having never asked for one: auto-open fired by our own
bookkeeping rather than by a link anybody followed.

The redirect moves into `FullInterface`, which renders only when the
interface is actually on screen — always in the full form, and only once the
dialog opens in the compact one. That is a structural guarantee rather than a
condition somebody has to remember: there is no longer a state in which the
redirect can run while nothing but the card is rendered.

Note the Ladle story cannot demonstrate this — it runs on a MemoryRouter, so
no URL write would reach an address bar there either way.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…hips

`pnpm size` failed UNDER budget, which is the gate working: 395 KiB was set
against a 383 KiB payload and this branch put both graphs at ~300, so the
budget had quietly stopped being able to detect anything.

Lowering it to 310 locks the win in, per the rule the script's own header
states — ratchet down in the commit that won the space. The ~3% headroom is
the same margin the previous line carried, and clears the ~2.1 KiB a
credentialed build adds that CI cannot measure.

  standalone  382.1 → 299.3 KiB
  embed       383.6 → 301.3 KiB

The space comes from `FullInterface`: the map-bearing interface now sits
behind a lazy seam, so a slot too small to hold it mounts a card and a dialog
and never fetches mapbox-gl.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The branch forwarded `container` to `Vaul.Root` as well as to its portal, on the
reasoning that measuring the box we render in cannot be the wrong box. It is.

vaul computes every snap offset as `containerSize.height - height`
(`snapPointsOffset`, vaul dist), and the element we portal into is not always
something with a height. Embedded, it is the theme root, which is
`display: contents` and measures **0×0** — verified in Chrome 151. Standalone it
is `<html>`, which in map mode holds nothing but `position: fixed` children and
measured **195px against an 844px viewport**. At zero, the ladder
`['80px','300px',0.97]` becomes `[-80,-300,0]` instead of `[764,544,25]`: the
bottom sheet translates UP and covers the top of the screen, with the map in a
strip beneath it. That is the default phone experience of a map embed.

Passing a container also sets vaul's `data-vaul-custom-container`, which disables
the `::after` background extension — so over-dragging the sheet revealed the map
behind it.

The portal target and the measurement box are different questions, so they are
now different props. Only the expanded dialog supplies a measurement box, which
is the one case that genuinely needs one: it keeps a margin, so it is 16–32px
shorter than the window and a fractional snap measured against the window
overruns its clip. Everything else falls back to `window.innerHeight`, which is
what shipped before this branch.

Lint, typecheck and all 1263 unit specs were green with this live, so the fix
comes with a jsdom spec that fails against it — asserted by restoring the defect
and watching two of its three cases go red.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
A collapsed compact card was still fetching the world. `warmCaches()` ran from
`App`'s mount effect regardless of layout, so every host page view of a sidebar
embed nobody presses pulled the whole events feed and the wholesale region tree
— the exact cost #161 removed by deleting the card's preview rows, arriving back
through a component two levels above the one whose spec asserts those rows are
absent. Verified in a browser: three data requests before, one after
(`clients/me`, which the card legitimately needs). `FullInterface` warms them
instead, so pressing the button still does; the full form keeps `App`'s call,
where the point is overlapping the client bootstrap rather than following it.

`fallbackUrl` validated a parsed URL and returned the unparsed string. The
WHATWG parser strips leading and embedded ASCII whitespace before parsing, so
` https://…` — the likeliest .env typo there is — passed the https check here
and was then refused by `isSafeHref` at the sink, whose scheme test is anchored,
producing precisely the dead unlabelled card this module exists to prevent. It
now returns the parsed URL, with the whitespace cases in its spec.

`--sy-sheet-top`'s offset came from `document.querySelector('[data-sy-expanded]')`
— the HOST's whole document, where an element of theirs carrying the attribute
would win on document order and offset every peek strip by its box — re-run on
every animation frame, sixteen lines below a comment explaining why the sibling
lookup is cached. It reads the node `lib/overlay` already tracks.

Also: `toSlim` was exported for preview rows that no longer exist; the
`react-map-gl` invariant that `use-map-controller-real.tsx` cross-references was
never actually written down, leaving the branch's headline perf claim defended by
a pointer to nothing; `Modal` was the one viewport-unit consumer the
`--sy-frame-h` sweep missed; and the mangled comment in `EventsList/index.ts` was
collateral from an earlier agent's stray edit, reverted to origin/main.

Docs: `CHANGELOG.md` promised a self-closing overlay this branch deleted,
`.claude/rules/components.md` justified a deletion by citing a message that no
longer exists, `docs/embedding.md`'s privacy section credited the IP lookup with
ranking card rows that were removed, and both host docs said the card is "centred
both ways" when it is centred across and sits at the top.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Ardnived and others added 4 commits August 20, 2026 12:08
The Fathom effects lived in `AppShell`, which renders for every embed — including
one whose entire appearance is a collapsed card. So every host page view of a
sidebar nobody pressed recorded a pageview of `/` for an interface nobody opened,
and injected our tracker into the host's page to do it.

They move into an `Analytics` component rendered from `interfaceElement`, so they
cannot run before the interface does: immediately in the full form, and only on
opening in the compact one. Same reasoning that moved the home-region redirect
into `FullInterface` and the cache warm out of a collapsed card — a collapsed
card should do nothing a visitor did not ask for. The tracker script is no longer
loaded at all while the card is closed, which is the better half of the fix.

Pinned with a jsdom spec, and the route to it is worth recording. I wrote the
assertion first in the SSR sibling, where it passed — and kept passing with the
regression deliberately reintroduced, because the dialog's content is a Radix
portal and `renderToStaticMarkup` renders no portals. That is a spec covering the
door rather than the state. The jsdom version fails when the interface is mounted
alongside the card, which is the shape the regression would actually take.

It pins one property that three fixes on this branch all rest on — unfetched
mapbox-gl, unwarmed caches, and now this — each of which has its own spec that
would keep passing if the collapsed card started rendering its children.

Verified in a browser that a collapsed embed makes one request (`clients/me`) and
no others. The Fathom half is NOT browser-verified: `VITE_FATHOM_ID` is commented
out locally, so no probe could observe a tracker request either way.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…k one command

Seven changes from the session reflection, each traceable to a specific way this
branch cost time or nearly shipped something wrong.

Two go to `.claude/rules/tests.md`, both from the same afternoon. First:
`renderToStaticMarkup` renders NO portals, so an SSR assertion about what is
inside a drawer or dialog passes whether the content rendered or not — asserting
ABSENCE is the trap, and this app is portal-dense enough that it will recur.
Second: a regression spec is not finished until it has failed. Two freshly written
specs here passed against the very bug they were written for, the second because
the simulated regression flipped a gate Radix already made unreachable.

`.claude/rules/components.md` gains the invariant behind four separate bugs: an
effect in `AppShell` runs for a collapsed card too, so anything that writes the
host's URL, fetches, injects a script or reports must mount with the interface.
The redirect, `warmCaches`, and both Fathom effects were each fixed in isolation
before the pattern had a name.

`.claude/rules/code-style.md` records that `react/jsx-sort-props`' autofix moves
props but leaves comments where they sat, so a commented prop added out of order
ends up documenting its neighbour — silently, with lint green afterwards.

`finalize-pr` gets two: dispatch review subagents READ-ONLY (one with write access
edited 17 files on an earlier pass, including a file the branch never touched), and
run `pnpm build && pnpm size` before pushing when the import graph moved, since the
budget fails UNDER as well as over and the lean gate cannot see it.

And `pnpm review:embed` (`scripts/serve-embed-review.mjs`) serves `dist/` as real
host pages — full map, narrow sidebars, hostile host CSS, iframes, a page-URL deep
link. Hand-rolling this cost a dozen turns and has four traps, all hit: the element
observes no attributes so config must ride on the script URL; locales come from
`VITE_HOST` and their absence renders NOTHING with no error; python's http.server
sends no CORS; and `_redirects` makes a leftover server answer 200 with the app
shell for a page it does not have. It refuses to start on an occupied port for that
last reason.

Verified by running it: locales resolve same-origin, zero mapbox requests on the
sidebar page, one data request, and the documented backend caveat reproduces
exactly.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
**The analytics move I made last commit was broken, and its own reviewer caught
it.** `Analytics` mounts inside the interface, which the compact dialog unmounts
on close — so `ownsTracker`, a ref, reset on the next open, while
`'fathom' in window` was by then TRUE because our own script had put it there.
The load effect returned early, never re-set the flag, and the pageview effect
short-circuited for the rest of the document's life: analytics silently dead
after the first collapse, in exactly the compact form the move existed to serve.
Both latches are module scope now, like `autoOpened` in `use-expansion` — and
`lastTracked` too, since the contract is one pageview per real NAVIGATION and
closing and reopening on the same route is not one.

It also moves into `FullInterface`, which is the module whose documented purpose
is being the interface, alongside the redirect and the cache warm. Verified with
`VITE_FATHOM_ID` set: `fathom-client` lands in the `FullInterface` chunk and
`dist/index.html` does not preload it. The eager payload is unchanged at
299.3/301.3 — no size claim, since without the ID the module is eliminated
either way.

A comment in `App.tsx` still told readers that `analytics="false"` on the element
keeps the tracker out. It does not: the element observes no attributes and the
loader parses no such parameter, so that was the last surviving claim of a
host-side opt-out that no longer exists.

The review server gets four fixes, three of them real failure modes: an unguarded
`decodeURIComponent` made `curl 'http://localhost:5173/%'` an uncaughtException
that killed the process — leaving a dead port and no message, which is trap 4
wearing a different hat; `listen(port)` bound 0.0.0.0, handing every page (each
with the client API key substituted in) to the whole subnet on shared Wi-Fi; and
the port probe was a TOCTOU proxy for a question `listen` answers exactly. It
also stops writing its index into `dist/`, and reads env through vite's own
`loadEnv` rather than a hand-rolled parser that mis-handled quotes and inline
comments.

Verified each: malformed escape now 400s with the server still up, the LAN
address refuses the connection, no file is left in `dist/`, and the key still
substitutes.

Also: `main.tsx` shares `framed()` rather than keeping an inverted copy of a
predicate whose `catch` arm is the subtle part (with a note that the loader's
third copy must stay duplicated — importing across that seam fails `pnpm size`);
`parseConfig` drops an object built only to be spread; and two orphaned comments
now sit above what they describe.

Dismissed: excluding `?atlas=/` from auto-open. `fromPage` is a boolean and the
route is not in scope, so it would mean threading a value through a function
whose design point is asking one question — and `/` opens the countries view,
which is what the button opens anyway, so it removes a spelling rather than any
impact.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
**The tests.md section I added two commits ago was wrong, and it was wrong in the
way that section is about.** It said `renderToStaticMarkup` "renders NO portals",
inferred rather than measured. React 18.3.1 THROWS on one — "Portals are not
currently supported by the server renderer" — which I have now actually run. So
the broad conclusion it drew ("the node lane can never assert a portal's
subtree") was backwards in the direction that matters: an eagerly-mounted portal
fails loudly.

What genuinely made the #161 spec vacuous is a Radix property, not a renderer
one: `Dialog.Portal` wraps its child in `<Presence present={open}>`, so a CLOSED
dialog never calls `createPortal` and there is nothing to serialize or throw
about. The section now states both halves as a table, with the asymmetry — blind
to a closed portal, deafening about an open one — as the useful part.

**The auto-open spec did not catch the bug it was written for**, twice over.
First it went in `CompactEmbedView.mount.test.tsx`, where a sibling test's click
had already latched the module-scope `autoOpened`, so it observed a closed
surface for the wrong reason; `vi.resetModules()` does not rescue that, since it
governs future imports rather than the instance the file already resolved. It
now has its own file, where vitest gives it a clean registry. Then it passed
against the restored defect anyway, because a bare `createRoot` render does not
double-invoke — the whole StrictMode bug is invisible outside `<StrictMode>`,
which `providers.tsx` mounts and the spec now does too. Confirmed failing against
the initialiser version.

The review server had a second crash path beside the malformed escape:
`existsSync` is true for a directory, so `/assets` or `/locales` passed the
guard, sent a 200, and then died on an unhandled EISDIR from
`createReadStream`. Both are 404s now, with a stream error handler as backstop.

And `full-map.html` — the one page whose note says "map mode, full page" —
showed the compact card on any display wider than ~1455px. The shared shell caps
content at 1100px, so the element's parent measured 1164, which IS the slot,
which is meaningfully smaller than a 1512px viewport. Verified with a control:
the map page no longer warns at 1512 and the sidebar page still does.

Also: the `probeUrlWritable` docblock claimed `canonicalViable` is "the only
thing that reads" `urlWritable` — it also decides the router in `mountDecision`
and rides in the readiness marker, and a reader trusting "only" would delete a
load-bearing field with the report. `docs/embedding.md` blamed a blocked
`window.open` for the framed card; it renders an anchor. And the `review:embed`
insert had orphaned the map rule's fallback instruction.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@Ardnived
Ardnived merged commit 7ef11b2 into main Aug 24, 2026
5 checks passed
@Ardnived
Ardnived deleted the feat/compact-card branch August 24, 2026 18:05
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.

feat(widget): degrade to a compact card in a slot too small for the interface

1 participant