Skip to content

Commit 3ae9e92

Browse files
ryansolidclaudecursoragent
authored
feat(signals,solid,web,diagnostics): OBSERVE.records — one records channel on both platforms; the call record and its origin (#3472)
* feat(signals,solid,web,diagnostics): OBSERVE.records — one records channel on both platforms; the call record and its origin The runtimes' records move onto one channel, `OBSERVE.records`, owned by the core: `subscribe(type, listener)`, `observed(type)`, `emit(type, event, live)`, created once per process and registered on `globalThis` under `Symbol.for("@solidjs/signals/observe/records")` so a second copy of the core (a bundled server build instrumented through `--import`) and wire layers bundled without a framework import reach the same listener sets. The catalogue is two empty interfaces the runtimes augment, one augmenter each: `RecordTypes` (solid-js: `"boundary"`) extends `HostRecordTypes` (@solidjs/web: `"invocation"`, `"frame"`, `"call"`). `OBSERVE.server` keeps only the `trace` slot. The `"frame"` record gains its client half: `FrameEvent` is `FrameProducedEvent | FrameAppliedEvent`, discriminated by `side`, the same census on both, the client adding `address` and `outcome: "truncated"`. The server census is corrected — `regions` counts `html` chunks addressed to a child frame id (the old count read a chunk type that does not exist) and `shellMs` is the stream's own shell only. New `"call"` record: one per server-function call made from the browser, at the caller's settle — `{ id, at, durationMs, method, outcome, status?, origin?, deferred? }` with `{ args, response?, result? | error? }` beside it. It replaces `observeServerFunctionCalls`, which is removed from both server-function entries. `origin` is what the call ran for, read at dispatch through the new `OBSERVE.attribution.currentOrigin()` (the `currentOrigin` hook; the installed hooks are also registered on `globalThis` under `Symbol.for("@solidjs/signals/observe/attribution")` for the import-free client): the engine's own `ChangeOrigin` — the interaction whose handler made it, the navigation whose recompute needed it — so an observer files the call under the interaction record by identity, not by a time window. The server-functions and frames client entries gain `observe` and `development` builds and export conditions; the server-functions client is now built with its flags replaced in every tier (`_SOLID_DEV_` there was an unreplaced truthy string). `@solidjs/diagnostics` format v6: `artifact.server` becomes `artifact.records: { boundary, invocation, frame, call }`, captured on both platforms including the browser bridge; JSONL carries one line per record with `type`, and `recordCounts` in the meta line. RFC 08/10/11/12 updated; the diagnostics README and the two skills follow the artifact. Co-authored-by: Claude <[email protected]> Co-authored-by: Cursor <[email protected]> * test(web): the published-types augmentation tests run in their own program The web test program holds the package twice — the runtime specs import `../src`, and everything importing `@solidjs/web` reaches the built `types/` through the self-link. Both copies now augment `solid-js`'s record catalogue (src/observe.ts), and TypeScript requires duplicate property declarations to be of identical type; the copies are, unless a test augments the published one alone. `request-event-locals.*` does exactly that (`RequestEventLocals`), so the two `InvocationLive.event` types differed and the conflict surfaced as TS2717 in whichever file the program loaded second — hidden before #3470 because the built copy came second and `skipLibCheck` swallowed it there; the seams change reordered the imports and put `src/observe.ts` second. The augmentation acceptance tests move to `tsconfig.test.augment.json`, a program with one copy of the package (the published one, which is their point); `test-types` runs both. Co-authored-by: Claude <[email protected]> Co-authored-by: Cursor <[email protected]> * fix(web): the client record emitters fold out of prod; observe-tier size caps The Size check caught the prod frames scenario at +286 B: `records()` folded to `return undefined`, but the emitters it guarded (`observeCall`, `observeFrameApply`, `frameCensus`, `isDeferredBody`) and the wrappers around the dispatch and the apply were retained — rollup cannot fold a call's undefined return through its call site. Now the emitters return early behind the observe literal, and the wrappers exist only where it holds: `fetchServerFunction` IS the dispatch and `applyFrameResponse` IS the apply loop in prod (`IS_OBSERVE ? observed : plain` aliases), so prod pays neither the extra frame nor the promise hop. The frames scenario is back under its cap (11430 B). The two observe-tier scenarios grew deliberately — the records channel and the `currentOrigin` query ship there — and their caps move with the measured artifacts: CSR observe 15.90 -> 16.05 KB (+216), attribution 27.45 -> 27.70 KB (+323). Co-authored-by: Claude <[email protected]> Co-authored-by: Cursor <[email protected]> --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Cursor <[email protected]>
1 parent d2a36f5 commit 3ae9e92

58 files changed

Lines changed: 3151 additions & 941 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
"@solidjs/signals": patch
3+
"solid-js": patch
4+
"@solidjs/web": patch
5+
"@solidjs/diagnostics": patch
6+
---
7+
8+
`OBSERVE.records` — one records channel on both platforms (observe/dev tiers); frame records from both ends; the client `"call"` record; `observeServerFunctionCalls` removed
9+
10+
- **`@solidjs/signals`**: `OBSERVE.records` — `subscribe(type, listener)`, `observed(type)`, `emit(type, event, live)` — the channel every runtime record rides, created once per process and registered on `globalThis` under `Symbol.for("@solidjs/signals/observe/records")` so a second copy of the core (a bundled server build instrumented through `--import`) and wire layers bundled without a framework import reach the same listener sets. Listeners are snapshotted per emit; a throwing listener is reported and the rest run. Types: `Records`, `RecordTypes` (extends `HostRecordTypes`; both declared empty, for the runtimes to augment — one augmenter per interface), `RecordType`, `RecordEvent`, `RecordLive`, `RecordListener`. Folds out of prod. New **`OBSERVE.attribution.currentOrigin()`** (and the `currentOrigin` hook on `AttributionHooks`): the provenance a root write performed now would be stamped with — the interaction whose handler is running, the navigation/effect/action frame open, or inside a recompute the origin of the change that caused it — as the engine's own `ChangeOrigin` object, `undefined` when external or with no engine; for a runtime stamping a record of its own. The installed hooks are also registered on `globalThis` under `Symbol.for("@solidjs/signals/observe/attribution")`, the same reach-without-an-import the channel has.
11+
- **`solid-js`**: the `"boundary"` record moves from `OBSERVE.server.records` to `OBSERVE.records` (augmenting the core's `RecordTypes`). `OBSERVE.server` keeps only the `trace` slot; `ServerRecords` is gone.
12+
- **`@solidjs/web`**: the `"invocation"` and `"frame"` records move to `OBSERVE.records` (augmenting `HostRecordTypes` through `solid-js`). New **`"call"` record** (`CallEvent`, `CallLive`, `CallListener`): one per server-function call made from the browser, at the caller's settle — `{ id, at, durationMs, method: "GET" | "POST", outcome, status?, origin?, deferred? }` with `{ args, response?, result? | error? }` beside it; joins the server's `"invocation"` by `id`, and — through `origin`, the engine's own interaction/navigation object read at dispatch via `currentOrigin()` — the attribution engine's `InteractionEvent` / `NavigationEvent` / `HoldEvent` by identity, so an observer files the call under the click that made it without a time join. The **`"frame"` record now has a client half**: `FrameEvent` is `FrameProducedEvent | FrameAppliedEvent`, discriminated by `side`, same census on both; the client half (`applyFrameResponse`, one per stream in a response) adds `address` (the `as` remap) and `outcome: "truncated"` for a body that ended before `complete`, with `live.response`. Server census fix: `regions` counts `html` chunks addressed to a child frame id (the former count read a chunk type that does not exist), and `shellMs` is set by the stream's own shell only. The emitters and their wrappers fold out of the prod client artifacts behind the observe literal (prod `applyFrameResponse` and the server-function dispatch are the pre-existing functions, no extra frame or promise hop). The server-functions and frames **client** entries gain `observe` and `development` builds and export conditions (`server-functions/dist/client.{observe,dev}.js`, `frames/dist/client.observe.js`); the server-functions client is now built with its flags replaced in every tier (before, `_SOLID_DEV_` there was an unreplaced truthy string).
13+
- **Removed**: `observeServerFunctionCalls` and the `ServerFunctionCall` / `ServerFunctionRequestCall` / `ServerFunctionResponseCall` types, from both server-function entries. Subscribe to `OBSERVE.records` `"call"` (client) or `"invocation"` (server) instead.
14+
- **`@solidjs/diagnostics`** (format v6): `artifact.server` is replaced by `artifact.records: { boundary, invocation, frame, call }` — always present, captured on both platforms including the browser bridge; types `BoundaryRecord`, `InvocationRecord`, `FrameRecord` (`FrameProducedRecord | FrameAppliedRecord`), `CallRecord` (with `origin?: ChangeOrigin`), `ArtifactRecords` replace the `Server*Record` / `ArtifactServer` names. JSONL: one line per record with `type` naming its table; the meta line's `boundaryCount`/`invocationCount`/`frameCount` become `recordCounts: { boundary, invocation, frame, call }`.

‎documentation/plans/server-dev-build-plan.md‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ type/tooling reuse, with unused members no-op.
303303
> `"boundary"` record from solid-js's server entry joined the `"invocation"`
304304
> one — and the objects and the `records`/`trace` members are solid-js's,
305305
> with web augmenting solid-js's `ServerRecords`/`ServerTrace`; see
306-
> `sentry-integration-plan.md` C3.)_ Observe-tier only: web now
306+
> `sentry-integration-plan.md` C3. Since C4's client half, 2026-09-15: the
307+
> channel is the core's `OBSERVE.records`, on both platforms — see C4
308+
> there; `OBSERVE.server` keeps only `trace`.)_ Observe-tier only: web now
307309
> ships `dist/server.observe.js`, `server-functions/dist/server.observe.js`
308310
> and `frames/dist/server.observe.js` under the `observe` condition (the P0
309311
> plumbing, third flavour), and every emit site folds out of prod behind
@@ -346,19 +348,22 @@ becomes the contract test for server codes.
346348
> **(c) The artifact.** `@solidjs/diagnostics` format v5 adds
347349
> `artifact.server: { boundaries, invocations } | null`, folded from
348350
> `OBSERVE.server.records` when the server runtime installed its surface
349-
> (`null` otherwise — client captures, the browser bridge). The package still
351+
> (`null` otherwise — client captures, the browser bridge). _(v6, with C4's
352+
> client half: `artifact.records.{boundary, invocation, frame, call}`,
353+
> folded from the core's `OBSERVE.records` on both platforms and always
354+
> present.)_ The package still
350355
> depends on `@solidjs/signals` alone: it reads the channel by its contract
351-
> (`subscribe(type, listener)`, structurally) and mirrors the two record
352-
> types (`ServerBoundaryRecord`, `ServerInvocationRecord`); the web server
356+
> (`subscribe(type, listener)`, structurally) and mirrors the record
357+
> types (`BoundaryRecord`, `InvocationRecord`, `FrameRecord`, `CallRecord`); the web server
353358
> suite pins the mirrors to the runtime types at compile time, both ways and
354-
> by key set. JSONL egress adds `boundary`/`invocation` lines. The contract
359+
> by key set. JSONL egress adds one line per record. The contract
355360
> test is `packages/web/test/server/diagnostics-server-scenario.spec.tsx`
356361
> (harness aliased from source in `vite.config.server.mjs` and
357362
> `tsconfig.test.json`): the seeded `HEAD_TAG_INVALID` and `SERVER_WRITE`
358363
> with `ownerPath`, a boundary and the invocation under it joined by id, the
359364
> waterfall as a finding `expectNoDiagnostics` catches, and the tables
360-
> serializable line by line. The package's own suite covers the fold against
361-
> a stand-in channel (bare signals has no server surface).
365+
> serializable line by line. The package's own suite covers the fold with
366+
> records emitted onto the real channel by hand (bare signals has no emitter).
362367
363368
## Decisions (resolved 2026-09-06)
364369

0 commit comments

Comments
 (0)