fix(flow-debugger): final-review remediation — 2000-row trace pull, shared ExceptionHeader parser, surrogate-safe clip, wording, alarm source, register renumber (I1/I2/M1-M8)

This commit is contained in:
Joseph Doherty
2026-09-09 13:30:48 -04:00
parent 0bacc3630e
commit 97f01ae98e
21 changed files with 462 additions and 71 deletions
+15 -4
View File
@@ -317,10 +317,21 @@ backed by `InboundScriptLogger`:
`InboundScriptResult` carries an internal `ErrorDetail` (`ex.ToString()` of the fault the method
script threw). It is written to the request's audit row — by `FlowDebugRunner` for a Live run, and
on the ordinary HTTP path via `HttpContext.Items[AuditWriteMiddleware.ErrorDetailItemKey]` so a
`TraceAllCalls` Replay has it too — and is projected onto `FlowStep.ErrorDetail` for the Flow
Debugger's exception block. **It is never returned to the HTTP caller:** the response body stays the
generic `SCRIPT_ERROR` envelope, unchanged.
on the ordinary HTTP path via `HttpContext.Items[AuditWriteMiddleware.ErrorDetailItemKey]` — and is
projected onto `FlowStep.ErrorDetail` for the Flow Debugger's exception block. **It is never
returned to the HTTP caller:** the response body stays the generic `SCRIPT_ERROR` envelope,
unchanged.
**Note the asymmetry with the site half, which is easy to get wrong:** the inbound row's
`errorDetail` is written on **every failing method request**, traced or not — the middleware stamps
it whenever the script faulted, so it is not gated on `TraceAllCalls` or on a Live run (those only
decide whether the row is later *readable as a Flow Debugger step*). Its size is bounded by the
redactor's truncation stage, which for an `ApiInbound` row selects `AuditLog:InboundMaxBytes`
(1 MiB default — `SelectCap` gives this channel its own ceiling instead of the 64 KB
`ErrorCapBytes` other channels' error rows get), so a deep stack is truncated there rather than
dropped. The **site** `ScriptRun` row's `errorDetail`, by contrast, is **traced-only** — an
untraced site script run emits no `ScriptTrace` row at all, so there is nothing to carry it; that
row, being a `ScriptTrace` error row, is the one bounded at the 64 KB `ErrorCapBytes`.
### Routing Behavior
- The `Route.To()` helper resolves the instance's site assignment from the configuration database and routes the request to the correct site cluster via the Communication Layer.