Skip to content

feat(everything-dev,every-plugin,host,ui): the @/ui facade renders server-side; the expose ships primitives only (#1260) - #1264

Open
efizzybot wants to merge 2 commits into
t3/hostsurface-ui-facade-and-ssr-smokefrom
t3/optimize-syntax-and-ssr
Open

efizzybot wants to merge 2 commits into
t3/hostsurface-ui-facade-and-ssr-smokefrom
t3/optimize-syntax-and-ssr

Conversation

@efizzybot

Copy link
Copy Markdown
Collaborator

Closes #1260. Stacked on #1258 (base is its branch).

What landed

SSR for facade components (spike-verdict 077 item 2, ADR 0064): the host compose threads a session-bound expose resolver through constructTree into the generated routeConfig loaders, which register it — via a dynamically imported, import-free stash module (everything-dev/ui/ssr-registry) — into the caller's own module graph before route modules evaluate. Facade components resolve through the SAME container generation the tree was minted from (integrity-verified, generation-keyed caches). The render-null-on-server gate is gone: real markup streams, and React selective hydration keeps server HTML visible until the browser expose lands — no flash, no mismatch. Any composed source's exposes resolve server-side (the auth profile section remotes get it for free).

Expose slimmed to shadcn primitives (the #1260 decision): ./components points at ui/src/components/expose.ts — everything under ui/, nothing else. App-flavored components (ConfirmDialog, Markdown, stepper, info rows, local-date, UnderConstruction) and the error surface stay source-owned in the core barrel; @/components is unchanged (it re-exports the expose plus the app-flavored files). The scaffold prune protects the expose file (a child is its own provider; bos mf check gates it). The @/ui syntax is untouched — the generator maps symbols.

Preload: SSR documents preload the expose's STATIC dependency chunks (assets.js.sync from the core's mf-manifest — the async list is the app's whole dynamic graph and is never a source), attached to the core remote in the compose payload; dev-local sources derive the manifest URL from the entry. Best-effort: no manifest, no hints.

Discovery: the core's manifest carries the expose surface (components: [{ expose, exports }]).

Dev loopback fix (required by the above): the loopback plane rewrites the SSR container entry's stamped publicPath to its own origin — served unmodified, a container with a real routeConfig chunk fetches it from the plugin's web dev server, where a same-named web chunk shadows the node bytes (self is not defined).

Verification

Numbers (dev build, ui/dist)

…rver-side; the expose ships primitives only (issue #1260)

SSR (ADR 0064, closes spike-verdict 077 item 2): the host compose threads a
session-bound expose resolver through constructTree into the generated
routeConfig loaders, which register it — via a dynamically imported,
import-free stash module (everything-dev/ui/ssr-registry) — into the caller's
own module graph before route modules evaluate. Facade components resolve
through the SAME container generation the tree was minted from
(integrity-verified, generation-keyed caches); the render-null-on-server gate
is gone, real markup streams, and React selective hydration keeps server HTML
visible until the browser expose lands. Any composed source's exposes resolve
server-side, not just the core's. The core ui's node container ships the
./components expose; the dev loopback plane rewrites the container's stamped
publicPath to its own origin (a same-named web chunk otherwise shadows the
node bytes for routeConfig, which ships in both environments).

Expose (ADR 0059 §4 generic-only, per the #1260 decision): ./components
points at ui/src/components/expose.ts — shadcn primitives only; the
app-flavored components (ConfirmDialog, Markdown, stepper, info rows,
local-date, UnderConstruction) and the error surface stay source-owned in the
core barrel, which re-exports the expose unchanged for @/components. The
scaffold prune protects the expose file (a child is its own provider and
bos mf check gates it).

Preload: SSR documents preload the expose's static dependency chunks
(assets.js.sync from the core's mf-manifest — the async list is the app's
whole dynamic graph and is never a preload source), attached to the core
remote in the compose payload; dev-local sources derive the manifest URL from
the entry. Best-effort: no manifest, no hints.

Discovery: the core's manifest carries the expose surface
(components: [{ expose, exports }]).

Tests: unit (stash, SSR markup via renderToReadableStream, chunk-URL parser,
expose-surface guard), manifest-generator/loader shapes, browser spec
(SSR markup pin, preload hints, one-request-per-session).

KNOWN: issue #1259 (auth slot double-opens its PGlite dir) reproduces
intermittently in dev on this tree AND on main — the browser regression
runner refuses stacks with failed plugins, so the spec runs there once #1259
lands. Everything else verified against a live dev session: /docs serves the
remote Input's real markup (data-slot="input") with 13 facade preload links.
The SSR/expose commit re-expanded the capability-exports paragraph past
the validator's 500-line budget (503 counted). Fold the toast-copy
example into prose and drop the wrapped ensureQueryData call to one
line — the facade guidance keeps its substance.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants