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
@@ -159,7 +159,8 @@ public class FlowDebugCommandsTests
/// and canonical <see cref="AuditEvent"/> types with the server's camelCase policy, so
/// a rename on either fails this test instead of silently blanking a column.
/// </summary>
private static string RealPayload(bool completed, string? errorCode, string? error, bool truncated)
private static string RealPayload(
bool completed, string? errorCode, string? error, bool truncated, bool logsTruncated = false)
{
var root = Guid.NewGuid();
var child = Guid.NewGuid();
@@ -180,7 +181,7 @@ public class FlowDebugCommandsTests
};
var result = new FlowDebugRunResult(root, completed, error, errorCode, events, truncated,
new DateTimeOffset(t0), new DateTimeOffset(t0.AddSeconds(1)));
new DateTimeOffset(t0), new DateTimeOffset(t0.AddSeconds(1)), logsTruncated);
return JsonSerializer.Serialize(result, CamelCase);
}
@@ -241,6 +242,33 @@ public class FlowDebugCommandsTests
Assert.Contains("audit tree", last.GetProperty("note").GetString());
}
[Fact]
public void Projection_LogsTruncatedRun_NotesThatReplayPullsTheRest()
{
// Final review M8: `logsTruncated` is a SEPARATE signal from `truncated` (the inline
// collector sheds low-priority ScriptLog rows before it sheds step rows). The page shows
// it; the CLI used to drop it silently.
var projected = FlowDebugTableProjection.ProjectEvents(
RealPayload(completed: true, null, null, truncated: false, logsTruncated: true));
using var doc = JsonDocument.Parse(projected);
var rows = doc.RootElement.EnumerateArray().ToList();
Assert.Equal(5, rows.Count); // the four steps plus the note
Assert.Equal("inline log lines capped — replay pulls the rest", rows[^1].GetProperty("note").GetString());
}
[Fact]
public void Projection_BothTruncationFlags_AreReportedTogether()
{
var projected = FlowDebugTableProjection.ProjectEvents(
RealPayload(completed: true, null, null, truncated: true, logsTruncated: true));
using var doc = JsonDocument.Parse(projected);
var note = doc.RootElement.EnumerateArray().Last().GetProperty("note").GetString();
Assert.Contains("event list truncated", note);
Assert.Contains("inline log lines capped — replay pulls the rest", note);
}
[Fact]
public void Projection_LeavesNonMatchingBodiesUntouched()
{