fix(central-ui): Log on the inbound editor diagnostics host; sandbox Log delegates to Instance (Task 7 review)

This commit is contained in:
Joseph Doherty
2026-09-09 12:34:03 -04:00
parent b2418b41e1
commit 0a78d0e3b8
4 changed files with 47 additions and 3 deletions
@@ -695,6 +695,40 @@ public class ScriptAnalysisServiceTests
Assert.DoesNotContain(resp.Markers, m => m.Code.StartsWith("SCADA"));
}
[Fact]
public void InboundScript_Log_DiagnosesClean()
{
// Flow Debugger step logs (design 2026-09-09 D4): `Log` is a shipped inbound-script
// global (InboundScriptContext.Log). The EDITOR host is a third mirror alongside the
// compile surface and the Test Run sandbox — without `Log` on InboundScriptHost a
// logging method script shows a spurious CS0103 while deploying and running fine.
var resp = _svc.Diagnose(new DiagnoseRequest(
Code: "Log.Info(\"x\");\n"
+ "Log.Debug(\"d\");\n"
+ "Log.Warn(\"w\", new System.Exception(\"boom\"));\n"
+ "Log.Error(\"e\");",
Kind: ScriptKind.InboundApi));
Assert.DoesNotContain(resp.Markers, m => m.Code.StartsWith("CS"));
Assert.DoesNotContain(resp.Markers, m => m.Code.StartsWith("SCADA"));
}
[Fact]
public void SiteScript_Log_DiagnosesClean()
{
// The other half of GlobalsTypeFor: every non-inbound kind analyses against
// SandboxScriptHost, so the same `Log` global must resolve there too — both at
// the top level and via `Instance.Log`.
var resp = _svc.Diagnose(new DiagnoseRequest(
Code: "Log.Info(\"x\");\n"
+ "Log.Warn(\"w\", new System.Exception(\"boom\"));\n"
+ "Instance.Log.Info(\"via instance\");",
Kind: ScriptKind.Template));
Assert.DoesNotContain(resp.Markers, m => m.Code.StartsWith("CS"));
Assert.DoesNotContain(resp.Markers, m => m.Code.StartsWith("SCADA"));
}
[Fact]
public void InboundScript_Database_DiagnosesClean()
{