w4c-workflows-api/Services/Audit/ActionAuditEntry.cs

45 lines
1.8 KiB
C#
Raw Permalink Normal View History

2026-09-11 22:02:46 +00:00
namespace w4c_workflows.Services.Audit;
/// <summary>
/// One auditable action, written to the <c>w4c-actions-*</c> index. Entries
/// carry metadata only — never node input/output items, parameter values or
/// credentials — so the trail is safe to retain and query independently of the
/// run history. Free-text <see cref="Detail"/> is passed through
/// <see cref="SecretRedactor"/> before it is stored.
/// </summary>
public sealed record ActionAuditEntry
{
/// <summary>When the action completed (UTC).</summary>
public required DateTime Timestamp { get; init; }
/// <summary>Tenant the action belongs to; also drives the index name.</summary>
public required string TenantId { get; init; }
/// <summary>Stable action name, e.g. <c>node.executed</c>.</summary>
public required string Action { get; init; }
/// <summary>Terminal outcome, e.g. <c>succeeded</c> or <c>failed</c>.</summary>
public required string Outcome { get; init; }
public string? RunId { get; init; }
public Guid? WorkflowId { get; init; }
/// <summary>Node/task key within the workflow.</summary>
public string? NodeId { get; init; }
/// <summary>Blueprint type, e.g. <c>core.httpRequest</c>.</summary>
public string? NodeType { get; init; }
/// <summary>Wall-clock duration of the action in milliseconds, when known.</summary>
public long? DurationMs { get; init; }
/// <summary>Failure code when <see cref="Outcome"/> is <c>failed</c>.</summary>
public string? FailureCode { get; init; }
/// <summary>Redacted human-readable detail (error message, etc.).</summary>
public string? Detail { get; init; }
/// <summary>Run correlation id, when the run carries one.</summary>
public string? CorrelationId { get; init; }
}