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

@@ -146,8 +146,10 @@ public class SiteAuditPushFlowTests : TestKit
// + Pending queue). A temp file so it survives across DI scopes.
var dbPath = Path.Combine(Path.GetTempPath(), $"auditpush-{Guid.NewGuid():N}.db");
var writerOptions = Options.Create(new SqliteAuditWriterOptions { DatabasePath = dbPath });
var nodeIdentity = Substitute.For<ScadaLink.Commons.Interfaces.Services.INodeIdentityProvider>();
nodeIdentity.NodeName.Returns((string?)null);
await using var writer = new SqliteAuditWriter(
writerOptions, NullLogger<SqliteAuditWriter>.Instance);
writerOptions, NullLogger<SqliteAuditWriter>.Instance, nodeIdentity);
// Real SiteCommunicationActor. RegisterCentralClient is given the relay
// standing in for the central ClusterClient.