Skip to content

Commit adb1efc

Browse files
committed
Merge origin/next into fix/4140
Resolves the conflict with #4154 (e4edd34), which replaced the FrameChunk union with record-batch FrameMessages. The observe-tier `startedAt` moves onto FrameMessage's `start` variant (the one non-record message that opens a flight), and FrameHost.apply reads it from `msg` when the `start` opens the store. The landing stamp and the transport's header-time `start` carry over unchanged; all of it stays behind `_SOLID_OBSERVE_`, so prod bytes are unchanged. The #4140 spec's fetch stub now writes the wire as record batches (`{ id, version, r }`) instead of the removed `html` / `complete` chunks. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2
2 parents 933de2f + 3cffd86 commit adb1efc

91 files changed

Lines changed: 2267 additions & 1330 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/web": patch
3+
---
4+
5+
Async-mode renders (`await renderToStream(...)`) now produce the same bytes for the same data, whatever order the async sources settle in (#4028). Once the thenable is taken, hydration writes and the pending-promise stub batch are held until the serializer flush and handed to seroval sorted by hydration key, so reference ids and resolution chunks no longer follow settle order. A body-digest ETag now matches across renders whose only difference was API latency. Streaming consumers (`pipe` / `pipeTo` / `readable`) and custom serializers/sinks are unchanged.

‎.changeset/frames-records-wire.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/web": patch
3+
---
4+
5+
Frames: the frame stream now carries versioned batches of keyed records (`{ id, version, r }`), the same writes the client's resident store applies, instead of eleven typed chunks the client translated into records. The server writes records natively: `renderServerComponent`, `renderToFrameStream` and the response helpers pipe these wire messages, so there is one format from the producer to the store. Records written in the same synchronous flush leave as one message per frame (a segment's assets, content and reveal travel together; a sweep stays one batch), with nothing held across a flush. Only `start`, `data` and the single-flight `outcome` keep a `type`, and the document face's live channel carries the same batches. The eager frames client loses its translation step (about 0.2 KB brotli off every server-components page). Experimental wire format: a client and server must come from the same release.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/html": patch
3+
---
4+
5+
Fix the tokenizer treating the first attribute of a dynamic tag as its tag name. `<${Comp} title="...">` or `<${Comp} style=${...}>` entered raw text mode, so the children were read as text and parsing failed with "Unclosed tag".
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/signals": patch
3+
---
4+
5+
EFFECT_RELAY_TEAR no longer flags effects that measure layout. When the effect's apply half takes no argument (`createEffect(open, () => setFlipped(measure()))`), a write that equals the compute output is not a copy, and its tears stay advisory however often they repeat. Effects whose apply half takes the value are judged as before, so boolean mirrors still warn.

‎documentation/server-components/frame-streams-rfc.md‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,39 @@ _Old consumer:_ reads `complete` as before (the extra field is ignored by
536536
its `chunkToRecords`); it sees a completed frame and never learns it was a
537537
cut-off. Degrades to today's behaviour minus the (new) distinction.
538538

539+
### Addendum (2026-10-19 — the wire is the store)
540+
541+
The translation point is gone. A frame stream on the wire is a sequence of
542+
versioned batches of keyed records, `{ id, version, r }`: the `FrameWrite`
543+
the host applies as it arrives, with no client-side mapping (`chunkToRecords`
544+
left the client), and the producer writes it natively — the frame sink's
545+
methods put records, and `renderServerComponent` / `renderToFrameStream`
546+
pipe the same messages the response serializes, so there is one format from
547+
the producer to the store. The record keys are the ones above: `""`,
548+
`seg:<k>`, `seg:<k>:reveal` / `:fallback` / `:assets` / `:error`,
549+
`slot:<k>`, `hole:<k>` (and `hole:<k>:error`), `attr:<k>`, `:complete`
550+
(with `:bound`), `:error`.
551+
552+
A batch is a flush. The records the producer writes in one synchronous run
553+
leave as ONE message per frame, at the run's end (a microtask, never a
554+
timer): a segment's assets, content, error and reveal travel together, a
555+
reveal group is one batch per frame, a sweep is one batch (C13). A batch is
556+
merged into only while writes address its frame back to back with keys it
557+
does not hold yet; another frame's records, a repeated key (two writes that
558+
must both land, such as row ops against successive bases) or a `data` node
559+
start the next one, so write order is apply order. A late root assets record
560+
rides a batch of its own (the client accumulates it into the record it
561+
holds). The end of the response, the end of the synchronous render pass
562+
(what the response head's `X-Frame-Tiers` describes) and each sweep (the
563+
yield the plain-response bound counts) flush at once.
564+
565+
Three messages are not records and keep a `type`: `start` (a version opens
566+
on the address — it writes nothing), `data` (a node of the response's data
567+
table, never frame state) and `outcome` (a single-flight envelope node,
568+
addressed to no frame). `tiers` rides beside `r` on any message. The
569+
document face's `sc:live` channel carries the same batches, unaddressed,
570+
with `fid` on the ones only the producing frame's boundary applies.
571+
539572
### Two identity schemes
540573

541574
The format uses two deliberately distinct identity schemes:

‎packages/html/src/tokenize.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ export const tokenize = (
207207
const start = cursor;
208208
while (cursor < len && isIdentifierChar(str.charCodeAt(cursor))) cursor++;
209209
const value = str.slice(start, cursor);
210-
if (lastTagName === "") {
210+
// Only a tag name directly after "<" can open a raw text element, not an
211+
// attribute name on a dynamic tag such as <${Comp} title="...">.
212+
if (tokens[tokens.length - 1]?.type === OPEN_TAG_TOKEN) {
211213
lastTagName = value;
212214
}
213215
tokens.push({ type: IDENTIFIER_TOKEN, value });

‎packages/html/test/parse.test.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,29 @@ describe("Dynamic Component Tags", () => {
631631
]
632632
});
633633
});
634+
635+
it("parses children of a dynamic component whose first attribute is named like a raw text element", () => {
636+
const Comp = "Comp";
637+
const ast = jsx`<${Comp} style=${{}}><span>content</span></${Comp}>`;
638+
expect(ast).toEqual({
639+
type: ROOT_NODE,
640+
children: [
641+
{
642+
type: COMPONENT_NODE,
643+
name: 0,
644+
props: [{ name: "style", type: EXPRESSION_PROP, value: 1 }],
645+
children: [
646+
{
647+
type: ELEMENT_NODE,
648+
name: "span",
649+
props: [],
650+
children: [{ type: TEXT_NODE, value: "content" }]
651+
}
652+
]
653+
}
654+
]
655+
});
656+
});
634657
});
635658

636659
describe("Edge Cases", () => {

‎packages/html/test/tokenize.test.ts‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,32 @@ describe("dynamic component tags", () => {
940940
{ type: CLOSE_TAG_TOKEN }
941941
]);
942942
});
943+
944+
it("should not treat an attribute named like a raw text element as the tag name", () => {
945+
const Comp = "Comp";
946+
const tokens = tokenizeTemplate`<${Comp} title="Home"><b>Hi</b></${Comp}>`;
947+
948+
expect(tokens).toEqual([
949+
{ type: OPEN_TAG_TOKEN },
950+
{ type: EXPRESSION_TOKEN, value: 0 },
951+
{ type: IDENTIFIER_TOKEN, value: "title" },
952+
{ type: EQUALS_TOKEN },
953+
{ type: STRING_TOKEN, value: "Home", quote: '"' },
954+
{ type: CLOSE_TAG_TOKEN },
955+
{ type: OPEN_TAG_TOKEN },
956+
{ type: IDENTIFIER_TOKEN, value: "b" },
957+
{ type: CLOSE_TAG_TOKEN },
958+
{ type: TEXT_TOKEN, value: "Hi" },
959+
{ type: OPEN_TAG_TOKEN },
960+
{ type: SLASH_TOKEN },
961+
{ type: IDENTIFIER_TOKEN, value: "b" },
962+
{ type: CLOSE_TAG_TOKEN },
963+
{ type: OPEN_TAG_TOKEN },
964+
{ type: SLASH_TOKEN },
965+
{ type: EXPRESSION_TOKEN, value: 1 },
966+
{ type: CLOSE_TAG_TOKEN }
967+
]);
968+
});
943969
});
944970

945971
describe("comments handling", () => {

‎packages/signals/src/core/attribution.ts‎

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,9 +1995,11 @@ function checkEffectCycle(el: Computed<any>, causes: ChangeRecord[]): void {
19951995
// - sole writer: every write to `S` in the session came from this effect.
19961996
// Medium — real state grows other writers eventually — so it sharpens the
19971997
// text, not the severity.
1998-
// A tear whose write is neither is `info` (a DOM-measurement effect tears
1999-
// legitimately: the cost of measuring) until the same relay has torn
2000-
// repeatedly, then `warn`.
1998+
// A tear whose write is neither is `info` until the same relay has torn
1999+
// repeatedly, then `warn`. An apply half that takes no argument is reading
2000+
// something other than its compute output (layout, time, a ref — a signal
2001+
// read there is STRICT_READ's): its matching write is no copy, and its tears
2002+
// stay `info` however often they repeat — the cost of measuring.
20012003

20022004
interface RelayState {
20032005
count: number;
@@ -2023,7 +2025,15 @@ function trackEffectWrite(node: Signal<any> | Computed<any>, record: ChangeRecor
20232025
const writer = info === undefined ? 0 : devId(info.node);
20242026
recordNodes.set(record, node);
20252027
n._devSoleWriter = n._devSoleWriter === undefined || n._devSoleWriter === writer ? writer : null;
2026-
if (info !== undefined && value !== undefined && value === info.node._value) {
2028+
// An apply half that takes no argument cannot be copying its compute
2029+
// output: a match is coincidence (`createEffect(open, () =>
2030+
// setFlipped(measure()))`).
2031+
if (
2032+
info !== undefined &&
2033+
value !== undefined &&
2034+
value === info.node._value &&
2035+
((info.node as any)._effectFn?.length ?? 1)
2036+
) {
20272037
copyWrites.add(record);
20282038
n._devCopyRuns = n._devCopyFrom === writer ? (n._devCopyRuns ?? 0) + 1 : 1;
20292039
n._devCopyFrom = writer;
@@ -2129,7 +2139,13 @@ function checkRelayTear(
21292139
// "reset editable state from a source" shape — the tear is real, but a memo
21302140
// is not the answer, so it stays advisory like any other non-derivable tear.
21312141
const derivable = copy && soleWriter;
2132-
const severity = derivable || state.count >= RELAY_WARN_AT ? "warn" : "info";
2142+
// An apply half that ignores its argument writes from outside the graph
2143+
// (layout, time, a ref; a signal read there is STRICT_READ's): measuring,
2144+
// so it stays advisory however often it repeats.
2145+
const severity =
2146+
derivable || (state.count >= RELAY_WARN_AT && ((relay.node as any)._effectFn?.length ?? 1))
2147+
? "warn"
2148+
: "info";
21332149
// First sighting always reports (advisory); afterwards only the escalation.
21342150
if (state.count > 1 && (severity !== "warn" || state.warned)) return;
21352151
// One verdict per derivable signal: the copy report (checkCopyEffect) and
@@ -2148,12 +2164,10 @@ function checkRelayTear(
21482164
`writers — editable state reset from a source. If the reset is the intent, the tear ` +
21492165
`is its cost; if "${write.name}" only ever mirrors the source, drop the local copy ` +
21502166
`and read the source.`
2151-
: soleWriter
2152-
? `Nothing else writes "${write.name}" — it is derived state: make it a memo over what ` +
2153-
`the effect reads and every reader gets it in the same flush.`
2154-
: `If "${write.name}" is computed from what the effect reads, make it a memo so readers ` +
2155-
`get it in the same flush; if the write reads something outside the graph (layout, ` +
2156-
`time), the tear is the cost of measuring.`;
2167+
: (soleWriter ? `Nothing else writes "${write.name}". ` : "") +
2168+
`If "${write.name}" is computed from what the effect reads, make it a memo so readers ` +
2169+
`get it in the same flush; if the write reads something outside the graph (layout, ` +
2170+
`time), the tear is the cost of measuring.`;
21572171
const message =
21582172
`[EFFECT_RELAY_TEAR] ${victimKind} "${nodeName(victim)}" ran twice for one write of ` +
21592173
`"${shared.name}": once in the flush where "${shared.name}" changed, and again after ` +

‎packages/signals/tests/attribution-relay-tear.test.ts‎

Lines changed: 107 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import {
1414
createRoot,
1515
createSignal,
1616
flush,
17-
OBSERVE
17+
OBSERVE,
18+
untrack
1819
} from "../src/index.js";
1920
import type { DiagnosticEvent } from "../src/core/dev.js";
2021

@@ -123,7 +124,9 @@ describe("EFFECT_RELAY_TEAR", () => {
123124
expect(tears).toHaveLength(1);
124125
expect(tears[0].severity).toBe("info");
125126
expect(tears[0].data!.copy).toBe(false);
126-
expect(tears[0].message).toContain('Nothing else writes "filtered" — it is derived state');
127+
expect(tears[0].message).toContain(
128+
'Nothing else writes "filtered". If "filtered" is computed from what the effect reads'
129+
);
127130
expect(console.warn).not.toHaveBeenCalled();
128131
for (const q of ["b", "c", "d", "e"]) {
129132
setQuery(q);
@@ -270,4 +273,106 @@ describe("EFFECT_RELAY_TEAR", () => {
270273
flush();
271274
expect(tears).toEqual([]);
272275
});
276+
it("stays advisory for a layout measurement keyed on a boolean (no copy, no escalation)", () => {
277+
const tears = arm();
278+
const [open, setOpen] = createSignal(false, { name: "open" });
279+
const [fallback, setFallback] = createSignal(false, { name: "alignFallback" });
280+
// Near the screen edge: the measurement agrees with `open` every time.
281+
const measure = () => untrack(open);
282+
createRoot(() => {
283+
createEffect(
284+
open,
285+
() => {
286+
setFallback(measure());
287+
},
288+
{ name: "measureFallback" }
289+
);
290+
createEffect(
291+
() => (open() ? (fallback() ? "fallback" : "aligned") : "closed"),
292+
() => {},
293+
{ name: "position" }
294+
);
295+
});
296+
flush();
297+
for (let i = 0; i < 5; i++) {
298+
setOpen(true);
299+
flush();
300+
setOpen(false);
301+
flush();
302+
}
303+
expect(tears.map(t => t.severity)).toEqual(["info"]);
304+
expect(tears[0].data).toMatchObject({ copy: false, soleWriter: true });
305+
expect(tears[0].message).toContain("the tear is the cost of measuring");
306+
expect(console.warn).not.toHaveBeenCalled();
307+
});
308+
309+
it("never escalates a relay whose same input wrote different values", () => {
310+
const tears = arm();
311+
const [query, setQuery] = createSignal("", { name: "query" });
312+
const [width, setWidth] = createSignal(0, { name: "width" });
313+
let layout = 0;
314+
createRoot(() => {
315+
createEffect(
316+
query,
317+
() => {
318+
setWidth(++layout);
319+
},
320+
{ name: "measureWidth" }
321+
);
322+
createEffect(
323+
() => `${query()}/${width()}`,
324+
() => {},
325+
{ name: "row" }
326+
);
327+
});
328+
flush();
329+
for (const q of ["a", "b", "a", "c", "d", "e"]) {
330+
setQuery(q);
331+
flush();
332+
}
333+
expect(tears.map(t => t.severity)).toEqual(["info"]);
334+
expect(console.warn).not.toHaveBeenCalled();
335+
});
336+
it("still flags a boolean mirror and a boolean-keyed derivation (the apply half takes its value)", () => {
337+
const tears = arm();
338+
const [open, setOpen] = createSignal(false, { name: "open" });
339+
const [mirror, setMirror] = createSignal(false, { name: "mirror" });
340+
const [label, setLabel] = createSignal("Open", { name: "label" });
341+
createRoot(() => {
342+
createEffect(
343+
open,
344+
v => {
345+
setMirror(v);
346+
},
347+
{ name: "syncMirror" }
348+
);
349+
createEffect(
350+
open,
351+
v => {
352+
setLabel(v ? "Close" : "Open");
353+
},
354+
{ name: "syncLabel" }
355+
);
356+
createEffect(
357+
() => `${open()}/${mirror()}`,
358+
() => {},
359+
{ name: "mirrorRow" }
360+
);
361+
createEffect(
362+
() => `${open()}/${label()}`,
363+
() => {},
364+
{ name: "labelRow" }
365+
);
366+
});
367+
flush();
368+
for (let i = 0; i < 3; i++) {
369+
setOpen(true);
370+
flush();
371+
setOpen(false);
372+
flush();
373+
}
374+
const warned = tears.filter(t => t.severity === "warn").map(t => t.data!.wrote);
375+
expect(warned).toContain("mirror");
376+
expect(warned).toContain("label");
377+
});
273378
});

0 commit comments

Comments
 (0)