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

@@ -2,6 +2,7 @@ using Microsoft.Data.Sqlite;
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;
@@ -31,6 +32,7 @@ public class SqliteAuditWriterSchemaTests
var writer = new SqliteAuditWriter(
Options.Create(options),
NullLogger<SqliteAuditWriter>.Instance,
new FakeNodeIdentityProvider(),
connectionStringOverride: $"Data Source={dataSource};Cache=Shared");
return (writer, dataSource);
}
@@ -200,6 +202,7 @@ public class SqliteAuditWriterSchemaTests
return new SqliteAuditWriter(
Options.Create(options),
NullLogger<SqliteAuditWriter>.Instance,
new FakeNodeIdentityProvider(),
connectionStringOverride: $"Data Source={dataSource};Cache=Shared");
}