feat(mesh-phase4): DriverHostActor runs ConfigDb-free (LocalDb alarm store, guarded acks)

Nullable ConfigDb factory; UpsertNodeDeploymentState no-ops when absent
(central persists acks from the ApplyAck); scripted-alarm condition state
served from the LocalDb store instead of the ConfigDb-backed Ef store.
Combines Phase-4 Tasks 4 + 6. Removes the interim dbFactory! cast.

Claude-Session: https://claude.ai/code/session_01GASWkNEi68FSCtvr6rLoEW
This commit is contained in:
Joseph Doherty
2026-07-23 12:39:41 -04:00
parent 4f4cdd05ec
commit d907160747
7 changed files with 466 additions and 20 deletions
@@ -121,6 +121,45 @@ public sealed class LocalDbAlarmConditionStateStoreTests : IDisposable
loaded.LastConfirmUtc.ShouldBe(state.LastConfirmUtc);
loaded.LastConfirmUser.ShouldBe("bob");
loaded.LastConfirmComment.ShouldBe("confirm-comment");
// Shouldly's DateTime ShouldBe compares ticks and ignores DateTimeKind, so an explicit Kind
// assertion is the only guard on the Utc-kind contract the round-trip ("O") format encodes.
loaded.LastTransitionUtc.Kind.ShouldBe(DateTimeKind.Utc);
}
/// <summary>Unset audit fields (LastAckUtc/User, LastConfirmUtc/User) round-trip back as null.</summary>
[Fact]
public async Task Null_audit_fields_round_trip_as_null()
{
var store = NewStore();
var t = new DateTime(2026, 06, 10, 12, 00, 00, DateTimeKind.Utc);
var state = new AlarmConditionState(
AlarmId: "alarm-null-audit",
Enabled: AlarmEnabledState.Enabled,
Active: AlarmActiveState.Inactive,
Acked: AlarmAckedState.Unacknowledged,
Confirmed: AlarmConfirmedState.Unconfirmed,
Shelving: ShelvingState.Unshelved,
LastTransitionUtc: t,
LastActiveUtc: null,
LastClearedUtc: null,
LastAckUtc: null,
LastAckUser: null,
LastAckComment: null,
LastConfirmUtc: null,
LastConfirmUser: null,
LastConfirmComment: null,
Comments: ImmutableList<AlarmComment>.Empty);
await store.SaveAsync(state, CancellationToken.None);
var loaded = await store.LoadAsync("alarm-null-audit", CancellationToken.None);
loaded.ShouldNotBeNull();
loaded.LastAckUtc.ShouldBeNull();
loaded.LastAckUser.ShouldBeNull();
loaded.LastAckComment.ShouldBeNull();
loaded.LastConfirmUtc.ShouldBeNull();
loaded.LastConfirmUser.ShouldBeNull();
loaded.LastConfirmComment.ShouldBeNull();
}
/// <summary>Loading an id that was never saved returns null.</summary>