Repository navigation
Commit 1d3ec5d
Stage 8 Part B: live server components — frames consume live, document face, conditional reconnect, GET end to end (#3660)
* frames: tear the render down when its reader is gone (Stage 8 B1)
A frame render lived as long as its sources did: `serverComponentResponse`'s
body `cancel()` only dropped writes, and nothing carried the request's
abort to the render — a frame's emission never touches the document
writable, so `renderToStream`'s disconnect path could not fire. Now
`renderToStream` takes `signal?: AbortSignal` and aborts through that
same path (`abandon("signal")`, `SSR_STREAM_ABANDONED` with
`data.reason: "signal"`). The frame responses own a teardown controller:
the body's `cancel()` aborts it, the request's signal (passed by
`frameTransformResult` / `frameTransformFlightResult` from
`event.request.signal`) chains into it, and the body closes itself on
abort since a torn-down render never ends its sink. A flight response
stops at the frame in progress and skips the rest.
The other half was in the reactive core: the frame-scope pump noticed
`comp.disposed` only when `next()` settled, so a source parked on a wait
was held until its next yield. The pump closes its source from the
compute's disposal now (`onDisposed`, run by the owner's disposal flag);
both pump sites share one `pumpIterator`.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* frames: consume live — a live server component is the loop's connection
A server component called through `live(fn)` is now a standing render
whose lifetime is the reference's loop. The call arrives at the live
address, `frameTransformResult` learns it from the invocation record
(`getServerFunctionInvocation().live`) and `serverComponentResponse({
live })` frames the chunks as server-sent events with the live headers,
the idle heartbeat and the dev chaos knob (`armLiveBody`, shared with
the codec stream). On the client the loop's wire slot rides on the
`responseHandler` ctx; `applyFrames` reads an event-stream body through
the loop's reader, tracks the frames started and not completed, and
resolves the connection's end for the loop: open frames at body end are
a death (backoff, reconnect, one morph — no fallback, no remount, same
binding), none is a completion. Supersession from another response
cancels the live connection so the loop reconnects, and the handler
holds one live connection per address — a second live reader's body is
ended and its loop joins the first's lifetime, otherwise two readers of
one call supersede each other's stream for as long as both are mounted.
Without a loop, a frame response ending before a started frame's
`complete` is now that frame's error (undeclared death is an error, RFC
11 §9.5 D1); the truncated-stream matrix cell moves accordingly.
`dynamic` is untouched: the memo pumps the live iterable as it pumps
any async iterable, and the re-yielded binding is equality-quiet on its
own.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples/room: the room as a live server component (Stage 8 B2 demo)
Page `/`: `roomPanel` is `live(GET(async (room, me) => component))` —
presence and the transcript rendered on the server from the same
in-memory watchers `/live` reads, arriving as markup that keeps changing
over one connection. Joining is the render (`onCleanup(join(room, me))`;
the request's abort disposes it, which is the leave), the composer is a
client slot the server positions, and `send` answers nothing — the row
reaches every tab as markup through its open render.
Verified in two tabs: joins and leaves arrive as morphs; killing every
connection cycles the pill `connected → reconnecting → connected`, the
render number climbs, no fallback appears, the frame element and the
composer's input keep their identity and the half-typed draft survives;
a post lands through the standing render with no reconnect.
`dynamic`'s source type admits `AsyncIterable<T>` so the page mounts
the panel as `dynamic(() => roomPanel(room, me))` — type-only, `dynamic`
is a memo and already pumped the iterable.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* frames: document face — a live server component takes first values, the client adopts and reconnects
Stage 8 B3. A component a `live` server function answers with renders into
the document under a live scope: every async source it reads takes its
first value into the markup and is closed, nested server components
inherit the scope, and the document completes. The scope flag is set by
`runInServerComponentScope(fn, { live })` and read at RENDER time from the
brand `brandLive` leaves on the wrapped component. `processResult` judges
the scope from the memo's owner rather than `currentOwner`: a stream that
arrives through a promise is classified in a continuation with no owner
current — which also fixes an unbranded thenable-resolved stream in
server-component scope serializing instead of pumping (pinned).
Client half. `live()` consults the frames intercept synchronously at the
call and files its answer on the iterable as `LIVE_LOCAL`; a hydrating
node with no serialized value (`dynamic`'s `serialize: false` memo) adopts
that answer as its value — the markup is the value, no request, no pending
beat — and arms its takeover, whose iteration re-yields the adopted
binding first and connects once at the live address with the intercept
skipped (`wire.adopted`). A consumer outside any hydration scope iterates
instead: seed first, then the connect. The intercept answers a boundary
the page may still deliver with a promise that lands at the reveal (or is
a miss once nothing is left to deliver it), so a live frame under a
streamed `<Loading>` connects after its fragment lands, never ahead of the
document's own render — and a plain `dynamic(() => call())` over a
streaming boundary waits for the document instead of fetching it twice.
`dynamic`'s memo `equals` is `sameInstance`: same component and address is
the same instance (placeholder vs per-address binding), and a same-
component/other-address pair delivers the address instead of swapping. No
live bit in the shell record: the client derives the call's address from
its own `(id, args)`.
Safety cap (open (c), decided: fixed dev-only warning, no knob):
`SSR_UNDECLARED_LIVE_SOURCE` after 5s of a document render still pumping an
async iterable in server-component scope; the render context carries
`document` so frame-stream renders are never judged.
Tests: server document-face spec (brand → first value + close, unbranded
pumps, nested inherits, thenable-resolved streams both ways, the cap);
parity pair artifact → hydrate in loaded and streamed modes (adopt with
zero requests, one connect after the scope release, same frame/h1/composer
input with its draft through the morph and a death → reconnect, no key
miss); client-only reader of a shown call; deferred intercept lands /
misses after exhaustion. Live-response helpers moved into the shared
lifecycle-matrix harness.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* dynamic: the binding gate reads (prev, next) — a reconnect after the source switched arguments stays put
The room demo's document call and its standing call differ: the page
renders `roomPanel(room, null)` (the browser mints the identity), and
the client's source switches to `roomPanel(room, me)` during hydration.
That switch is a kept resolution — same function, new address — and the
adopted instance follows it. The FIRST reconnect after that swung the
frame back to the document's address: presence went blank and the
reconnect's render landed in a store nothing was bound to.
`sameInstance` read "the address that is not the delivered one" as the
incoming address, assuming the gate's argument order was unknowable.
But the memo HOLDS the document's binding forever (a kept resolution
never replaces its value), so the reconnect's re-yield of the standing
binding was compared against the first address, and the other one — the
document's — was delivered. The gate now reads its arguments as
`(prev, next)` and delivers `next`'s address when it is not the one
showing.
That order is what every commit path in the signals core uses except
one: the lane landing in `asyncWrite` called a user comparator as
`equals(value, prev)`. Corrected to `(prev, value)`.
Pinned in test/hydration/frame-live-document-switched.spec.tsx (its own
file — the frames client's boundary index is module state): adopt at
t=0, connect, switch arguments → re-bound to the standing address,
death → reconnect stays there with the reconnect's render showing and
the composer draft intact. The frame-live-document harness gains a
third mode (`switched`) for its artifact, and the hydration specs share
their replay helpers.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* examples/room: the document face — the panel SSRs into the page and hydration adopts it
`/` no longer holds the panel behind `<Show when={me()}>`: the page's
render calls `roomPanel(room, null)` in process, the live scope takes
each source's first value and closes it, and the transcript, presence
row and composer range are in the HTML. Hydration adopts that markup
with no request and no fallback; the identity the tab mints during
hydration switches the source to `roomPanel(room, me)`, a different
call of the same function that `dynamic` delivers into the adopted
instance — that connection is the one that joins the room (`join` runs
only with an identity; the document's render watches).
Verified against the dev server in the browser: transcript present at
t=0, zero fallbacks, exactly one live request (at the standing
address), the same `solid-frame` and composer `input` through the
morph, and three chaos rounds each reconnecting onto the same nodes
with the draft intact and presence unchanged.
README: the `/` section describes the document face.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* server: projections pump in frame scope — createProjection/createStore over an async iterable behaves like a memo
Stage 8 B5. A server-owned frame render's binding ledger re-reads at
commits, and an async-iterable MEMO read there pumps: each yield lands,
commits, and holds the response (Stage 4). A projection over the same
source locked its reads at V1 and pumped nothing — the trace existed for
the hydration channel, and in a frame render nobody pulled it.
createProjection now judges its scope from its own owner (the rule
processResult applies to memos) and takes the memo's effective-mode
rule: declared hybrid, or any source under a live component's document
render, or a branded live source wherever the server consumes it —
except the frame pump, where staying connected is the stream face
working as intended. The frame pump drives the projection's SHARED
trace pump (a slot-border subscriber may be pulling the same iterator;
the source has one consumer) under a response hold with the document-
face cap — `openPumpHold`, factored out of the memo's pumpIterator —
committing per batch; reads follow the live state (no hydration claim
to lock for); disposal closes the source from the disposal. A
thenable-resolved iterable takes its first value as a resolution and
pumps the rest once it has landed. The trace log stays empty while no
subscriber reads it.
The trace subscriber's stable point is now "no undrained writes" rather
than "no pull in flight": under the pump a pull is always in flight,
parked on a standing source, and waiting for it held the slot-border
snapshot until the world moved.
Pinned in test/server/frame-live-holes-projection.spec.tsx: per-yield
hole re-emits for a value-yielding projection and a draft-mutating
createStore, memo and projection over one source emitting identically,
a thenable-resolved iterable pumping, a live-branded source staying
connected and closing on abort, and the live document scope taking the
first value with the document completing. The welcome/status parity
artifacts re-generate with the same shell; in `rest` the trace's batch
lands ahead of the slot re-emission now that the pump pulls eagerly.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* web: conditional reconnect for live server components (B4)
A live frame's reconnect now carries what the mount already shows, and
the server answers with only what differs.
Server: every content chunk the frame sink emits carries a digest —
`html` the digest of the root's skeleton (hole and slot ranges emptied,
markers kept) plus a `holes` map of the live holes inside it (`lh:N`
over the range, `lha:N` over the attr baseline the engine registers via
the new `sink.attrBaseline`); `fragment` its own plus `holes`; `hole`
and `attr` their own (document `sc:live` ops too). A render given a
have-list (`FrameStreamOptions.resume.have`; `frameTransformResult`
reads `X-Frame-Have` at the live address only) skips the root and its
assets when the skeleton digest matches, emits each top-level hole and
addressed attr whose digest differs, skips a fragment the list names in
favour of its differing holes (its keyed error still surfaces), streams
a fragment the list lacks as it settles, and never ships a fallback
reveal over listed content. A differing skeleton re-ships the root and
the render is the progressive stream it always was.
Client: `FrameImpl` keeps a ledger of applied content (`Frame.have()`)
— reset by a digest-carrying root, extended at each reveal, kept
current by hole/attr applies. The live loop asks the response handler
per connect (`responseHandler.resume(info)` → `{ position, headers }`);
the frames handler answers with the address's version ordinal for
`Last-Event-ID` and the ledger encoded under `X-Frame-Have`
(`key=digest` pairs; omitted over 4096 bytes → full snapshot).
`FrameChunk` gains `hole` and `attr` members. `FRAME_HAVE_HEADER` /
`FRAME_HAVE_BUDGET` exported from the frames entries; `textDigest`
added to server-functions/shared (internal).
Not built: seeding the ledger from the document face — the document's
hole engine numbers holes page-wide and fragment keys are
document-global, so the adopted interior's names do not align with a
frame render's; the connect after adoption stays a full snapshot
(morph over adopted content, no fallback). Design recorded in the plan.
Known limitation: a resumed attr hole carries no `removed` list.
Demo: the room panel's render counter is a live hole (`{renderNo()}`)
so a chaos reconnect transfers it alone — verified in the browser at
279 bytes (start, slot, one hole) on the same nodes.
Tests: test/server/frame-live-resume.spec.tsx (server rule),
test/frames-live-resume.spec.tsx (ledger + loop over three connects),
frame-live-framing (header through handleServerFunctionRequest).
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* web: GET server components end to end; serverFunctionUrl refuses live (B6)
Pins the GET path for server components, which was already whole: a
`GET(fn)` reference dispatches over GET at the data address with the
arguments in the url — the url `serverFunctionUrl` renders, so a preload
of it is the call — and the frames handler claims the frame-stream
answer off `X-Frame-Stream` whatever the method; the live address
answers the same records as an event stream (`curl -N` shows one
`data:` line per record); the `GET()` grant governs a frame response as
it governs a codec one (undeclared → 405 same-origin, 403 cross-site,
the body never runs); arguments too long for a url fall back to a JSON
POST at the data address and the same stream comes back.
Open decision (d) decided: `serverFunctionUrl(live(GET(fn)), ...args)`
now throws. It used to return the data address — an address the live
call never requests (it connects at the live address), the class of
answer the helper already refuses for a POST reference; a preload of
the live address would open a stream nothing reads. The error names the
alternatives: call the reference to warm the address, or render the
one-shot url from the inner `GET(fn)`.
Tests: test/server/frame-get.spec.tsx, test/frames-get.spec.tsx.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* web: serverFunctionUrl(live) is the live address; attr holes match whole text on resume
Open decision (d), revised by the maintainer: `serverFunctionUrl` on a
`live(GET(fn))` reference returns `<endpoint>/live/<id>[?args=...]` — the
url the reference's own call requests, so a fetch of it is the call: a
standing event stream to fetch by hand (`curl -N`), documented as not a
preload target. The previous pass refused instead, which removed the
manual/debug url with no other public source for it. The one-shot url
is the inner `GET(fn)`'s.
Attr holes: a conditional reconnect's `attr` re-emission carries no
`removed` list (the server holds the client's previous text only as a
digest). The client no longer needs one — the emission is the tag's
whole attribute area, so `#applyAttrs` matches the element to it the
way the root morph matches server output: sets what is present, removes
what is not, keeps `data-lha` and a `<details>`/`<dialog>` `open`. The
server's list is still honored where it comes.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* docs(stage8): ledger the attr whole-text morph; mark SERVER_WRITE (open (a)) as not built in Part B
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* chore(size): ledger for Stage 8 Part B live server components (#3660)
Three caps ratcheted against next (7742b28), attribution from per-module
esbuild metafiles at both ends: hydrating + stores 31.55 -> 31.65 KB (+164 B
minified in solid.js, the LIVE_LOCAL adoption in the hydration compute
wrapper); CSR observe 17.75 -> 17.80 KB (0 B minified, brotli layout on a
cap 13 B from full); frames eager consumer 11.67 -> 12.40 KB (+2,275 B
minified in the frames client — live consumption, promise-answering
intercept, the ledger and resume path — and +68 B in the retained transport
slice). The other seven scenarios are at or under next.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* test(web): type the thenable-resolved projection derive through the cast the flatten tests use
`pnpm --filter @solidjs/web test-types` (CI's Testing & Coverage job) failed
on the new frame-live-holes-projection spec: the public derive type of
createProjection does not admit Promise<AsyncIterable<T>> — promise-of-
AsyncIterable flattening is a runtime posture (signals' flatten-async-
iterable tests cast the same way). Test-only; no runtime or type change.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* test(signals): pin the lane landing's comparator order — a user equals reads (prev, next)
The asyncWrite lane branch now calls equals(prevValue, value) like every
other commit path; nothing pinned it (the dynamic specs land on the plain
async path). An async memo over a createOptimistic write inside an action
routes its landing through the lane: the comparator sees ({v:0}, {v:1}) —
red on the old (next, prev) order.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* web(frames): export FRAME_HAVE_BUDGET from the client and server entries, as ledgered
The plan's public API ledger, the PR body and the frame-conditional-
reconnect changeset all say FRAME_HAVE_HEADER and FRAME_HAVE_BUDGET (= 4096)
are exported from @solidjs/web/frames client and server; only the header
was. 0 B on the frames size scenario (the constant was already retained by
encodeHaveList). Covered by .changeset/frame-conditional-reconnect.md.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* docs(diagnostics): SSR_UNDECLARED_LIVE_SOURCE in the code table; SSR_STREAM_ABANDONED's "signal" reason in the repair guide
The new code had its entry in 08-dev-diagnostics.md and the repair guide
but no row in the summary table; the repair guide's SSR_STREAM_ABANDONED
entry listed consumer/sink only.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* docs(stage8): close open (a) — SERVER_WRITE is blanket, no persistent-render scope
The plan, the principles ledger and the open-decisions table still carried
"SERVER_WRITE throw scope in persistent renders" as an open question. It
was answered twice: RFC 11 §5 makes the rule blanket (no server write is
legitimate anywhere; server input is derived), and the maintainer
reaffirmed it for Part B. Nothing is built; the warning→throw flip follows
the deprecation window, not the arrival of persistence. Also corrects the
open-decisions row for (d), which still said `serverFunctionUrl` refuses a
live reference — it returns the live address (the prose already did).
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
---------
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>1 parent a360ad0 commit 1d3ec5d
67 files changed
Lines changed: 5528 additions & 354 deletions
File tree
- .changeset
- documentation
- plans
- server-components
- solid-2.0
- examples/room
- src
- lib
- routes
- packages
- signals
- src/core
- tests
- solid
- skills/reactivity-diagnostics
- src
- client
- server
- web
- frames/src
- server-functions/src
- src
- test
- harness
- __artifacts__
- hydration
- lifecycle-matrix
- server
- scripts/size
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments