feat(audit): GetTraceEventsAsync returns the ScriptTrace chain for Replay

Flow Debugger (design 2026-09-05 §7.1): IAuditLogRepository.GetTraceEventsAsync walks any
entry id to its root and down the Edges/Chain CTE exactly as GetExecutionTreeAsync, then
returns the chain's ScriptTrace rows plus the ApiInbound.InboundRequest row via the canonical
row mapper, ordered (OccurredAtUtc, EventId). Test doubles implement the new member with a
NotSupported stub.

Claude-Session: https://claude.ai/code/session_01GSLkkHKz9JrAtmJjmQK3cP
This commit is contained in:
Joseph Doherty
2026-09-05 23:59:08 -04:00
parent 981deed0fd
commit 9300bc1a4f
9 changed files with 246 additions and 0 deletions
@@ -296,6 +296,20 @@ public interface IAuditLogRepository
Guid executionId,
CancellationToken ct = default);
/// <summary>
/// Flow Debugger Replay (design 2026-09-05 §7.1): every row of the execution tree that
/// <paramref name="executionId"/> belongs to (walked to the root exactly as
/// <see cref="GetExecutionTreeAsync"/> does) whose channel is <c>ScriptTrace</c>, plus the
/// tree's <c>ApiInbound.InboundRequest</c> rows, ordered <c>(OccurredAtUtc, EventId)</c>.
/// Empty when nothing in the store carries the id.
/// </summary>
/// <param name="executionId">Any execution id in the chain.</param>
/// <param name="ct">Cancellation token.</param>
/// <returns>The canonical audit events that make up the flow, oldest first.</returns>
Task<IReadOnlyList<AuditEvent>> GetTraceEventsAsync(
Guid executionId,
CancellationToken ct = default);
/// <summary>
/// Returns the distinct, non-null <c>SourceNode</c> values present in the
/// <c>AuditLog</c> table, in ascending order. Backs the Audit Log page's