feat(audit): stamp SourceNode at site SqliteAuditWriter from INodeIdentityProvider

Caller-provided SourceNode wins (preserves reconciled rows from other nodes);
otherwise the writer fills it from the local INodeIdentityProvider.NodeName.
Reads from the provider on every write — singleton lifetime means zero overhead.
This commit is contained in:
Joseph Doherty
2026-05-23 17:08:21 -04:00
parent 277882d230
commit 479870e40c
14 changed files with 125 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using ScadaLink.AuditLog.Site;
using ScadaLink.AuditLog.Tests.TestSupport;
using ScadaLink.Commons.Entities.Audit;
using ScadaLink.Commons.Types.Enums;
@@ -39,7 +40,8 @@ public class SqliteAuditWriterBacklogStatsTests : IDisposable
var options = new SqliteAuditWriterOptions { DatabasePath = _dbPath };
return new SqliteAuditWriter(
Options.Create(options),
NullLogger<SqliteAuditWriter>.Instance);
NullLogger<SqliteAuditWriter>.Instance,
new FakeNodeIdentityProvider());
}
private static AuditEvent NewEvent(DateTime? occurredAtUtc = null) => new()