server: Phase7Composer accepts DI-registered IAlarmHistorianWriter (PR B.4) #412
Reference in New Issue
Block a user
Delete Branch "track-b4-sidecar-alarm-historian-writer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Sixth PR of the alarms-over-gateway epic (docs/plans/alarms-over-gateway.md). Depends on PR C.2 (#411, merged).
Today
Phase7Composer.ResolveHistorianSinkonly scans drivers for anIAlarmHistorianWriter— no Galaxy driver provides one since PR 7.2, so the resolution falls through toNullAlarmHistorianSinkand scripted-alarm transitions are silently discarded.WonderwareHistorianClientalready implementsIAlarmHistorianWriterand Program.cs:178 already registers it as a singleton whenHistorian:Wonderware:Enabled=true. The gap was that Phase7Composer ignored DI: this PR adds an optionalinjectedWriterconstructor parameter, and ASP.NET Core DI resolves it from the same registration when present.IAlarmHistorianWriter? injectedWriterparameter (default null). Backward-compatible — existing callers don't need to change; DI populates it automatically when the singleton is registered.SelectAlarmHistorianWriterhelper — resolution order is driver → DI → null. Drivers win when both are present so a future GalaxyDriver-as-IAlarmHistorianWriter takes the write path directly, preserving the v1 invariant where a driver that natively owns the historian client doesn't bounce through the sidecar IPC.ResolveHistorianSinkuses the helper + emits a structured log line identifying which source provided the writer.Test plan
SelectAlarmHistorianWriterprecedence tests — no source / DI only / driver wins over DI / first-driver-with-writer wins.HostStatusPublisherTestsSQL failures unrelated to this change (require the docker-host SQL Server at10.100.0.35,14330per CLAUDE.md).Follow-up
SdkAlarmHistorianWriteBackendagainst the dev rig and refreshesC:\publishservices.IAlarmSource(depends on Track A.3 which depends on A.2's worker subscription).