feat(scripts): Log global on the compile surface and both Test Run sandboxes; trust-gate pin (D4)

This commit is contained in:
Joseph Doherty
2026-09-09 12:21:23 -04:00
parent 964bb9b2d7
commit b2418b41e1
6 changed files with 169 additions and 0 deletions
@@ -574,6 +574,40 @@ public class ScriptAnalysisServiceTests
Assert.Contains("hello-sandbox", result.ConsoleOutput);
}
[Fact]
public async Task RunInSandbox_LogGlobal_WritesToConsoleOutput()
{
// Flow Debugger step logs (design 2026-09-09 D4): the sandbox `Log` mirror exists so
// a script that logs BINDS in the Test Run editor, and its lines land in the console
// pane (the sandbox has no audit trail — nothing here is written to AuditLog).
var result = await _svc.RunInSandboxAsync(
new SandboxRunRequest(
"Log.Info(\"hello\"); return 1;",
Parameters: null,
TimeoutSeconds: null),
CancellationToken.None);
Assert.True(result.Success, result.Error);
Assert.Contains("[info] hello", result.ConsoleOutput);
}
[Fact]
public async Task RunInSandbox_InboundScript_LogGlobal_WritesToConsoleOutput()
{
// Same mirror on the inbound Test Run host (SandboxInboundScriptHost) — an API
// method script's Log.* calls must bind and surface in the console pane too.
var result = await _svc.RunInSandboxAsync(
new SandboxRunRequest(
"Log.Info(\"hello\"); return 1;",
Parameters: null,
TimeoutSeconds: null,
Kind: ScriptKind.InboundApi),
CancellationToken.None);
Assert.True(result.Success, result.Error);
Assert.Contains("[info] hello", result.ConsoleOutput);
}
[Fact]
public async Task RunInSandbox_ConcurrentRuns_DoNotCrossContaminateConsoleOutput()
{