diff options
| author | Adam Malczewski <[email protected]> | 2026-06-05 14:29:06 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-05 14:29:06 +0900 |
| commit | 4d94c530406567791dbe4ab06c838a83c2e26023 (patch) | |
| tree | 4e15e5ffee8bf4de68ddac55462aa7dc04e67ee7 /notes | |
| parent | 9ae09aad5d8d6232c55932af0d496b888166065f (diff) | |
| download | dispatch-4d94c530406567791dbe4ab06c838a83c2e26023.tar.gz dispatch-4d94c530406567791dbe4ab06c838a83c2e26023.zip | |
refactor(observability): pure-types contracts/logging + Span body channel; verbatim before/after -> LogRecord.body (273 tests)
contracts/logging.ts reduced to pure types; createLogger (+ helpers) moved to kernel/src/logging/ — @dispatch/kernel still exports it (host-bin/tool-read-file unaffected).
Span body channel (Option A): Logger.span / Span.child / Span.end accept an optional body string -> SpanOpenRecord.body / SpanCloseRecord.body. Large verbatim payloads now use body, not stringified attributes (store-fat-serve-thin; attributes stay thin/queryable for D9).
before: run-turn emits a 'prompt' span with the verbatim messages+tools in body (small scalars in attrs). after: provider.request span carries the verbatim request in body; attrs thin, auth self-redacted.
Verified: tsc -b clean, 273 tests, biome 0 warnings/0 infos. Live boot: prompt + provider.request bodies present and correlated (shared turnId); request.body no longer in attributes; auth-key leak count = 0.
Diffstat (limited to 'notes')
| -rw-r--r-- | notes/observability-design.md | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/notes/observability-design.md b/notes/observability-design.md index 5e9c3a7..4a3515a 100644 --- a/notes/observability-design.md +++ b/notes/observability-design.md @@ -601,13 +601,11 @@ Completes full round-trip rebuild + the **before↔after diff**. HTTP test (`stream.test.ts`, mock `fetch` + real-capture fixtures). - **Order:** contract frozen (done) → Unit K ∥ Unit P (disjoint: kernel vs provider). -**DEFERRED — body-channel ABI (design decision, surface to user):** `LogRecord` has a -`body` field but the Logger/Span API exposes no way to set it — that's why -`prompt:before` (and now the request/response) use stringified `attributes`. Storing -large verbatim payloads in `body` (store-fat-serve-thin; both before & after) needs a -small ABI addition (e.g. `Span.setBody(body)`), worth doing before Phase B's query -layer. Until then captures use attributes — functional + reconstructable, just not -ideal for D9 `GROUP BY`. +**body-channel ABI — RESOLVED (Phase A.3):** added optional `body?` to +`Logger.span` / `Span.child` / `Span.end` → `LogRecord.body`; and moved `createLogger` +out of `contracts/` so `contracts/logging.ts` is pure types again. The before +(`prompt` span) and after (`provider.request` span) now carry their verbatim payloads +in `body`, not stringified attributes — attributes stay thin/queryable (D9). *(Full per-extension prompt-segment provenance — D8 — comes later, with the context-filter chain.)* |
