fix(siteruntime): M2.12 review nits — observe logger fault + meaningful source fallback (#25)

Replace bare task-discard with ContinueWith(OnlyOnFaulted|ExecuteSynchronously) so a
faulted ISiteEventLogger is logged and swallowed rather than going to the unobserved-task
firehose. Replace the "ScriptRuntimeContext" class-name fallback with the meaningful
"InstanceScript:{instanceName}" identifier (matching the site-event-log source convention).
Update the method doc-comment to state the best-effort contract explicitly. Pin the new
fallback value in the shape-precision test.
This commit is contained in:
Joseph Doherty
2026-06-16 06:26:00 -04:00
parent f08038db23
commit e2b31a9fd2
2 changed files with 37 additions and 9 deletions
@@ -143,6 +143,7 @@ public class RecursionLimitSiteEventTests
string? capturedCategory = null;
string? capturedSeverity = null;
string? capturedInstance = null;
string? capturedSource = null;
string? capturedMessage = null;
var loggerMock = new Mock<ISiteEventLogger>();
@@ -157,6 +158,7 @@ public class RecursionLimitSiteEventTests
capturedCategory = cat;
capturedSeverity = sev;
capturedInstance = inst;
capturedSource = src;
capturedMessage = msg;
})
.Returns(Task.CompletedTask);
@@ -169,6 +171,8 @@ public class RecursionLimitSiteEventTests
Assert.Equal("script", capturedCategory);
Assert.Equal("Error", capturedSeverity);
Assert.Equal(InstanceName, capturedInstance);
// Source fallback: no sourceScript wired, so the helper uses "InstanceScript:{instanceName}".
Assert.Equal($"InstanceScript:{InstanceName}", capturedSource);
Assert.NotNull(capturedMessage);
Assert.Contains("CallScript", capturedMessage);
Assert.Contains("2", capturedMessage); // maxCallDepth in the message