Skip to content

Commit d9395e3

Browse files
frames: C2 — live wire tier (lean): connection, have-list ledger, resume in a lazy chunk; live coverage closure
The live wire moves out of the eager frames client into the sixth lazy tier, `@solidjs/web/frames/wire` (frames/src/wire-tier.ts → wire.js, 1,922 min / 934 br): `connect` — the per-address connection a live() loop's response runs under (the open-frame count its end is judged by: a death with frames open vs a completion; the join of a second loop onto an address already live; `connection.ended` / `cancel`; the SSE reader selection, proxied so a drained body applies nothing further), `cancel` (supersession from `bump`), `have` / `haveOf` (the have-list ledger per mount, RFC 11 §9.5, fed by the client's `#recordHave` at its three sites) with `encodeHaveList` and the FRAME_HAVE_* literals bundled, and `resume` (the ordinal + the have-list header). The eager client keeps: `applyFrames` reading `options[LIVE_WIRE]` as its reader; `handle`'s live arm awaiting `prepareTier("wire")` before the body is read; `onLive` → `prepareTier("wire")`; `resume` and `bump`'s cancel delegating through `tierLoads.wire?.r`. Preload-at-call: `live()`'s makeIterable fires the new optional `responseHandler.onLive()` before the first fetch, so the import races only the request; a non-live call never loads the tier. Accepted degraded case: content applied before the chunk was resident kept no ledger, and `resume` answers nothing while the tier is absent — that first connect sends neither X-Frame-Have nor Last-Event-ID and gets a full snapshot (the server never read the ordinal for a frame render); pinned. Public surface: `Frame.have?()` removed from the Frame interface (the ledger is the tier's `haveOf(frame)`); `encodeHaveList` moved from frame-transport to the tier (@internal); `@solidjs/web/frames/wire` export path added; `responseHandler.onLive?()` and `ServerComponentHandler.onLive()` added. `ServerFunctionsClientConfig` gains no key. Pins: consistency/tier-wire-preload.spec (3) — the hook starts the import at the call before any fetch, the arm awaits residency, X-Frame-Tiers: wire joins the same load, a non-live call never loads the tier, reconnect through the tier with Last-Event-ID + the have-list, the degraded first connect. frames-live-resume re-pointed to the tier's haveOf / encodeHaveList; frames-live / frames-live-showing warm the tier. The coverage closure: server-functions-live-loop.spec (19, client suite) drives live()'s loop over hand-framed chunk / SSE bodies — first-connect failure, the fail-fast 4xx set and 408 / 425 / 429 / Retry-After, the cursor as Last-Event-ID, the online wake, return() mid-connect / mid-backoff / mid-seed, invoke's signal mid-stream / mid-backoff, no global EventTarget, live(GET(fn)), the handler's local answers — `live` per-function branch coverage (audit §2.4 method, client + hydrate) 26/59 sites (91/129 paths) on the base → 57/60 (129/132). Size (scripts/size, this head vs the base 55eb4c3): frames eager 33,767 / 11,193 → 32,802 / 10,888 (−965 min / −305 br; cap 11.21 → 10.90 KB); page base 112,938 / 36,071 → 112,003 / 35,722 (−349 br; cap 36.09 → 35.74); page live 124,810 / 39,747 → 123,903 / 39,412 (−335 br eager; cap 39.76 → 39.43; the page loads wire.js at its first live() call — total transfer 40,345 br, +598 against the base); non-SC scenarios 0 / 0; no cap raised. Measured before writing on edited dist copies through the harness's bundler: ceiling −1,432 / −472, lean −965 / −310, the carrier ≈ +467 / +162. Suites: web client 130 / 1,218, hydrate + consistency 89 / 452, server 159 / 1,511, solid 42 / 833, types + test-types clean; harness 500 × {3289, 91501} SC arm 0, generic arm (CONSISTENCY_IGNORE=C1,C9,C19,E) 0. Docs: savings plan §1 wire row built, §3 row C2 landed, §4 chunk table; residue doc status + §7e. Co-authored-by: Cursor <[email protected]>
1 parent 55eb4c3 commit d9395e3

20 files changed

Lines changed: 1533 additions & 233 deletions
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@solidjs/web": patch
3+
---
4+
5+
frames: the live wire moves into a lazy tier (`@solidjs/web/frames/wire`, the sixth chunk). The connection a `live()` loop's response runs under — the open-frame count its end is judged by (a death with frames open vs a completion), the join of a second loop onto an address already live, the supersession cancel, `connection.ended` / `cancel` — the have-list ledger per mount with its encoder, and the resume shape (`Last-Event-ID` + `X-Frame-Have`) load with the chunk. The eager client keeps the arm that awaits the tier's residency before a live response's body is read, so a live connection without the chunk cannot happen; the chunk's import starts at the `live()` call, before its first fetch (preload-at-call, through the new optional `responseHandler.onLive()` hook the sf client fires), and a non-live call never loads it. One accepted degraded case: content applied before the chunk was resident kept no ledger, so that first connect sends no have-list (and no ordinal) and receives a full snapshot.
6+
7+
Public surface: `Frame.have?()` is removed from the `Frame` interface (the ledger is the tier's `haveOf(frame)`, `@internal`); `encodeHaveList` moves from `frame-transport` into the tier (`@internal`; `decodeHaveList` and the `FRAME_HAVE_*` constants stay); the `@solidjs/web/frames/wire` export path is added; `ServerFunctionsClientConfig.responseHandler` gains the optional `onLive()`; `ServerComponentHandler` gains `onLive()`.
8+
9+
Pins: `consistency/tier-wire-preload.spec` and `server-functions-live-loop.spec` — the latter drives `live()`'s reconnect loop from the consumer's side (first-connect failure, the fail-fast 4xx set and 408 / 425 / 429 / `Retry-After`, the cursor as `Last-Event-ID`, the `online` wake, `return()` and a caller's signal at every phase, `live(GET(fn))`, the handler's local answers), closing the loop's branch-coverage gap.
10+
11+
Size: frames eager −965 min / −305 br (10.89 KB); pages −349 / −335 br eager; the `wire.js` chunk 1,922 / 934 (lazy; the live page loads it at its first `live()` call). Caps ratcheted to measured + 10 B.

‎documentation/plans/frames-residue-pass.md‎

Lines changed: 135 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,16 @@ by the key's `data` chunk and rejected when the response ends; frames
6464
keeps the `record.pending` count — **frames eager 11,367 → 11,193 br
6565
(−505 min / −174 br)**, the decode chunk (lazy) +420 / +161; the carrier
6666
measured +374 min / +110 br over a −879 / −280 ceiling, against the row's
67-
+40 br estimate — see §3.2 "As built" and §7d._
67+
+40 br estimate — see §3.2 "As built" and §7d.
68+
**C2 landed** (`feat/frames-wire-tier`, on step 4's head, 2026-10-07): the
69+
live wire tier in the `lean` form — the connection, the have-list ledger and
70+
its encoder, the resume shape in a sixth lazy chunk (`wire.js` 1,922 / 934),
71+
the eager client keeping the await-residency arm and the
72+
`responseHandler.onLive` preload hook — **frames eager 11,193 → 10,888 br
73+
(−965 min / −305 br)**, against §2's −292 (arithmetic from the C2 pass's own
74+
measurement); the carrier ≈ +467 / +162 over a −1,432 / −472 ceiling. The
75+
coverage closure the plan tied to it: `live` 26/59 → 57/60 branch sites. See
76+
§7e._
6877

6978
---
7079

@@ -1007,6 +1016,131 @@ ended without delivering a {$ref}.`).
10071016

10081017
---
10091018

1019+
## 7e. Landed — C2 (2026-10-07): the live wire tier, `lean`
1020+
1021+
Branch `feat/frames-wire-tier` on step 4's head (`55eb4c346`, frames eager
1022+
**33,767 / 11,193**; page base 112,938 / 36,071; live 124,810 / 39,747).
1023+
§2's C2 row (−292, arithmetic) and the savings plan's §3 row C2. The
1024+
maintainer's ruling: the `lean` form, with `FRAME_HAVE_*` already off the
1025+
entry (5a), the hook on `responseHandler.onLive` (not a config key),
1026+
`Frame.have?()` leaving the public `Frame` interface (approved class), the
1027+
trace update-site wait landed apart (#3861). Re-measured before writing on
1028+
edited dist copies of the frames client and the sf client through the
1029+
harness's bundler (`.wt-logs/c2b-edit.mjs`, `c2b-measure.mjs`) — the
1030+
step 1–4 base had moved under the phase-1 edits (the sync loop,
1031+
`insert`-placed fills, the table-owned pending read), so every anchor was
1032+
re-derived; the four non-SC scenarios 0 / 0 on every row. min / br.
1033+
1034+
| item | measured on this head | note |
1035+
| --- | ---: | --- |
1036+
| the ceiling (`del`) — the wire out whole: `connections` / `hold` / the join-or-hold arm, `resume` + `encodeHaveList`, the ledger (`#have` / `have()` / `#recordHave`), `applyFrames`' connection wiring, `isEventStream` + the reader selection | **−1,432 / −472** (pages −1,404 / −483 and −1,399 / −464) | unsound alone: a live response read as a plain stream, no reconnect |
1037+
| `lean` — the tier owns the connection, the ledger and the resume; the client keeps the await-residency arm, `onLive`, `resume` delegating, `#recordHave` forwarding through `tierLoads.wire?.r` | **−965 / −310** (pages −979 / −285 and −946 / −300) | the carrier ≈ +467 / +162 over the ceiling |
1038+
| the hook alone (`onLive` fired by `live()`'s `makeIterable`) | ≈ 20 / 15 (page live +85 br) | the config-key form measured ≈ 45 br heavier on the pages |
1039+
| the ledger's residue (`#recordHave` ×3 forwarding) | ≈ 112 / 27 | kept: the digests are known only to the client's apply |
1040+
| the field residue (the record fields the ledger reads) | ≈ 106 / 14 | kept: they feed the apply too |
1041+
| **built** | **−965 / −305 → 32,802 / 10,888**; pages **−349 / −335** → 35,722 and 39,412; **`wire.js` 1,922 / 934** (lazy, reported not counted) | +0 min / +5 br over the copy |
1042+
1043+
**What the tier owns** (`frames/src/wire-tier.ts` → `@solidjs/web/frames/wire`,
1044+
`@internal`): `connect(response, wire, address, binding, host, bump, begin)`
1045+
— a live response's connection: the join of a second loop onto an address
1046+
whose connection is not done (one wire per address; the second loop reads
1047+
the same store), else `bump` / `begin`; the reader (`wire.open(body)` for
1048+
an event stream — the loop's `EventStreamReader`, which records each event's
1049+
`id:` as the position — else a `ChunkReader`), proxied so a drained body
1050+
applies nothing further; the open-frame count the body's end is judged by
1051+
(`start` opens, `complete` / a keyless `error` closes; a nested region's
1052+
chunks ride inside its parent's) — an end with frames open is a death the
1053+
loop reconnects from, with none a completion; `connection.ended` / `cancel`
1054+
(supersession by a later response for the address cancels the reader,
1055+
which ends the drain as a clean body end); `have(frame, key, record)` /
1056+
`haveOf(frame)` — the have-list ledger per mount (RFC 11 §9.5): the root
1057+
apply resets it to the root digest plus the holes' (`""` → `{ "": digest,
1058+
…holes }`), a hole / attr / reveal apply sets its key; `encodeHaveList`
1059+
(the `FRAME_HAVE_HEADER` / `FRAME_HAVE_BUDGET` literals bundled — they were
1060+
already off the entry); `resume(host, info, versions)` → `{ position:
1061+
String(version), headers: { [FRAME_HAVE_HEADER]: encoded } }` for an
1062+
address the host shows, else `undefined`; `cancel(host, address)`.
1063+
**What the client kept:** `applyFrames` takes `options[LIVE_WIRE]` as its
1064+
reader (one line); `handle`'s live arm — `prepareTier("wire").then(() =>
1065+
tierLoads.wire.r.connect(…))` — awaits residency, never reads the body
1066+
without the tier; `onLive() { prepareTier("wire") }`; `resume(info)`
1067+
delegating; `bump` ending with `tierLoads.wire?.r?.cancel(host, address)`;
1068+
`#recordHave(key, record)` forwarding to `tierLoads.wire?.r?.have(this,
1069+
key, record)` at its three sites. **The hook:** `live()`'s `makeIterable`
1070+
fires `handler.onLive()` before the first fetch, per call — the import
1071+
races only the request, and the arm awaits it, so a live connection
1072+
without the chunk is impossible by construction; a non-live call never
1073+
loads it.
1074+
1075+
**The degraded case, accepted.** Content applied before the chunk was
1076+
resident (`#recordHave` forwarded to nothing) kept no ledger, and `resume`
1077+
— the tier's — answers nothing while the tier is absent: that first
1078+
connect sends neither `X-Frame-Have` nor `Last-Event-ID` and gets a full
1079+
snapshot. The plan's row described it as "the ordinal with no have-list";
1080+
the `lean` form drops the ordinal too, and the server never read it for a
1081+
frame render (`liveSource` compares `Last-Event-ID` to a value digest a
1082+
frame answer does not have; only `decodeHaveList(X-Frame-Have)` is read in
1083+
the frame sink) — the same full snapshot either way. Pinned as accepted in
1084+
`tier-wire-preload.spec` (3): the plain call's content lands with its
1085+
digests while the tier is gated, the live call's first connect carries
1086+
neither header, the tier's release lands the live root, the reconnect
1087+
after a death carries `Last-Event-ID` and the live root's ledger.
1088+
1089+
**Pins.** `consistency/tier-wire-preload.spec` (3) — the hook starts the
1090+
import synchronously at the call, before any fetch; the arm awaits
1091+
residency (chunks sent, nothing applied, the fallback shown, no status) and
1092+
the release lands the content; `X-Frame-Tiers: wire` on a live response
1093+
joins the same load (the loader called once); a non-live call never loads
1094+
the tier and its refetch bumps nothing of the tier's; reconnect through the
1095+
tier with `Last-Event-ID` and the have-list, the morph in place, the
1096+
completion closing; the degraded first connect. `frames-live-resume`
1097+
re-pointed to the tier's `haveOf` / `encodeHaveList`; `frames-live` and
1098+
`frames-live-showing` warm the tier (`beforeAll(() => prepareTier("wire"))`
1099+
— resident cells). **The coverage closure** the savings plan tied to this
1100+
row: `server-functions-live-loop.spec` (19, client suite) drives `live()`'s
1101+
loop over hand-framed bodies — the codec's chunk stream and the same
1102+
payloads as server-sent events with `id:` lines — ending as the test says
1103+
(cleanly, dropping, hanging until the request's signal): the
1104+
non-server-function throw, a handler without `intercept`, a first-connect
1105+
failure as the call's rejection (no status, no retry), a death reconnecting
1106+
on the `online` wake with the reader's cursor as `Last-Event-ID`, the
1107+
fail-fast 4xx closing with the error, 408 / 425 / 429 retrying, `Retry-After`
1108+
naming the wait, `return()` mid-connect (the arriving stream closed, the
1109+
wire severed) / mid-backoff (the sleep cut) / mid-seed (a late local answer
1110+
not yielded), `invoke`'s signal mid-stream (a rejection, ended for good) /
1111+
mid-backoff (the sleep woken, the connect refused), a host without a global
1112+
`EventTarget`, `live(GET(fn))` at the live address over GET, the handler's
1113+
local answers (a hit at the call yielded first and adopted; a deferred hit
1114+
awaited, settling to a value or to nothing; a miss at the call but a hit at
1115+
connect — one value, no wire). `live`'s per-function branch coverage by the
1116+
audit's §2.4 method (v8, client + hydrate suites, merged): **26/59 sites
1117+
fully covered (91/129 paths) on the base → 57/60 (129/132)**; the three
1118+
left are `return()` landing between a value's arrival and its read, and
1119+
the `resume` / seed arms' stopped-while-pending elses. Web client 130 /
1120+
1,218; hydrate + consistency 89 / 452; server 159 / 1,511; solid 42 / 833;
1121+
`types` + `test-types` clean; harness 500 × {3289, 91501}: SC arm 0,
1122+
generic arm (`CONSISTENCY_IGNORE=C1,C9,C19,E`) 0.
1123+
1124+
**Public surface.** **Removed:** `Frame.have?(): Record<string, string> |
1125+
undefined` from the public `Frame` interface (the ledger is the tier's
1126+
`haveOf(frame)`; approved class). **Moved:** `encodeHaveList` from
1127+
`frame-transport` to the tier (`@internal`); `decodeHaveList` and the
1128+
`FRAME_HAVE_*` constants stay in `frame-transport` (off the client entry
1129+
since step 1). **Added:** the `@solidjs/web/frames/wire` export path (the
1130+
chunk; its exports `@internal`); `responseHandler.onLive?()` on the sf
1131+
client's `ServerFunctionsClientConfig.responseHandler` (optional; fired at
1132+
a `live()` call before its first fetch); `ServerComponentHandler.onLive()`.
1133+
`ServerFunctionsClientConfig` itself gains no key.
1134+
1135+
**Running number: frames eager 10,888 br — 888 B above ≤ 10.0 KB.** §2's
1136+
C2 row said −292; −305 landed. The live page's total transfer is honest:
1137+
39,412 eager + 934 for the chunk it loads at its first `live()` call =
1138+
40,345 br against the base's 39,747 (+598 — the chunk carries the whole
1139+
connection, where the row's `est.` ≈ 470 br priced the dispatch alone).
1140+
What remains is C1 (≈ −440) and the claims chunk (≈ −270).
1141+
1142+
---
1143+
10101144
## Appendix A — every unit on the head (273 units, 40,000 B; by whole unit)
10111145

10121146
Class and group per `classes-head.mjs`; units Phase A / B / C added are

0 commit comments

Comments
 (0)