fix(site-runtime): trace sink is guarded — a throwing observer can neither fail a call nor skip the audit write
Review of Task 3: the sink invoke sat before WriteAsync/ForwardAsync inside the best-effort try, so a throwing sink would have silently dropped the durable row. GuardTraceSink wraps the delegate in every helper ctor (and Collect guards EmitTrace); pinned by a throwing-sink test. ScriptRunLauncher no longer allocates a collector for a traced run with no reply target (Nobody) — the list would never be read. FlowTraceCollector.Complete pinned at unit level; Snapshot documented as a non-closing peek. Claude-Session: https://claude.ai/code/session_01NcMG6xXdsJbmD2wYAgkK29
This commit is contained in:
@@ -243,9 +243,11 @@ internal static class ScriptRunLauncher
|
||||
ScriptTraceExtra? triggerExtra = null)
|
||||
{
|
||||
IServiceScope? serviceScope = null;
|
||||
// Flow Debugger (design §5.4): the inline sink exists only for a traced run; the
|
||||
// Flow Debugger (design §5.4): the inline sink exists only for a traced run that has a
|
||||
// caller to reply to — a trace-armed trigger run (replyTo == Nobody) writes every row to the
|
||||
// audit writer for PullTraceEvents and would only keep a never-read list alive. The
|
||||
// ScriptRun row itself is emitted below on every exit path of a traced run.
|
||||
var collector = trace ? new FlowTraceCollector() : null;
|
||||
var collector = trace && !replyTo.IsNobody() ? new FlowTraceCollector() : null;
|
||||
var startedUtc = DateTime.UtcNow;
|
||||
ScriptRuntimeContext? context = null;
|
||||
IAuditWriter? auditWriter = null;
|
||||
|
||||
Reference in New Issue
Block a user