Files
scadaproj/ZB.MOM.WW.Health
Joseph Doherty 544a6ddb77 Fix all baseline code-review findings across the six shared libraries
Resolves the 35 findings from the 2026-06-01 baseline (commit 26ba1c7),
test-first for every behavioral change. +51 tests (331 -> 382 passing, 0 failed).

- Telemetry-001 (HIGH): RedactionEnricher now honours property removal, so a
  redactor that drops a key actually scrubs the secret from the event.
- Auth: LDAP validator ValidateOnStart; API-key verify no longer fails on a
  best-effort MarkUsed write or a corrupt scopes column (fail-closed); LDAP cert
  validation hook; KeyPrefix persistence aligned; README algorithm corrected.
- Health: Akka checks return Degraded (not throw) when the cluster isn't up yet;
  GrpcDependencyHealthCheck catch-all; null 'description' rendered; composite
  endpoint builder; XML docs shipped.
- Audit: CompositeAuditWriter no longer re-throws OperationCanceledException;
  TruncatingAuditRedactor over-redact scrubs Target + safe negative max; options
  record; XML docs shipped.
- Configuration: TryAddEnumerable idempotent registration; consistent port
  quoting; strict invariant port parsing; XML docs + README packaged.
- Theme: mobile toggle is now CSS-only (no Bootstrap JS); token/CSS hygiene;
  XML docs on the public parameter surface.

Shared-contract/spec docs updated where the code was the source of truth
(observability service.instance.id, MapZbMetrics, redactor reach). All changes
additive/back-compatible at v0.1.0. code-reviews bookkeeping follows separately.
2026-06-01 11:22:14 -04:00
..

ZB.MOM.WW.Health

Health-check libraries for the ZB.MOM.WW SCADA family (OtOpcUa, MxAccessGateway, ScadaBridge). These are libraries, not a service — each package is linked directly into the consuming application at build time. There is no central health process or network hop; probes run in-process alongside the application.

The library normalizes the three-tier health endpoint convention (/health/ready, /health/active, /healthz) and provides reusable probe implementations so the three sister projects share a common surface without duplicating probe logic.


Packages

Package Description Key Dependencies
ZB.MOM.WW.Health Core tiers, MapZbHealth extension, canonical JSON writer (ZbHealthWriter), IActiveNodeGate seam, GrpcDependencyHealthCheck reachability probe, and tier-tag constants (ZbHealthTags). No Akka or EF dependency. Microsoft.AspNetCore.App (framework ref), Grpc.Net.Client
ZB.MOM.WW.Health.Akka AkkaClusterHealthCheck with a configurable AkkaClusterStatusPolicy (presets: Default three-way / OtOpcUaCompat two-way), ActiveNodeHealthCheck with an optional role filter, and AkkaActiveNodeGate that backs IActiveNodeGate from the cluster member state. ZB.MOM.WW.Health, Akka.Cluster
ZB.MOM.WW.Health.EntityFrameworkCore DatabaseHealthCheck<TContext> with CanConnectAsync by default and an optional ProbeQuery delegate for custom connectivity validation. ZB.MOM.WW.Health, Microsoft.EntityFrameworkCore

Consumer Matrix

Consumer ZB.MOM.WW.Health (core) ZB.MOM.WW.Health.Akka ZB.MOM.WW.Health.EntityFrameworkCore
OtOpcUa yes (+ GrpcDependencyHealthCheck for the MxAccessGateway channel) yes yes
MxAccessGateway yes (+ GrpcDependencyHealthCheck for the x86 worker IPC)
ScadaBridge yes yes yes

MxAccessGateway consumes the core package only — it has no Akka cluster and no EF DbContext. OtOpcUa and ScadaBridge consume all three packages.


Versioning

All three packages are versioned lockstep from Directory.Build.props. The current release is 0.1.0. A single version bump in Directory.Build.props bumps all three packages simultaneously — consumers should reference the same version for all ZB.MOM.WW.Health packages.


Building and testing

# from ZB.MOM.WW.Health/
dotnet build ZB.MOM.WW.Health.slnx
dotnet test  ZB.MOM.WW.Health.slnx

All three test assemblies run with dotnet test and require no external dependencies (no running Akka cluster, no database):

Assembly Tests
ZB.MOM.WW.Health.Tests 20
ZB.MOM.WW.Health.Akka.Tests 32
ZB.MOM.WW.Health.EntityFrameworkCore.Tests 6
Total 58

Packing

dotnet pack ZB.MOM.WW.Health.slnx -c Release -o ./artifacts

Produces three .nupkg files in artifacts/:

ZB.MOM.WW.Health.0.1.0.nupkg
ZB.MOM.WW.Health.Akka.0.1.0.nupkg
ZB.MOM.WW.Health.EntityFrameworkCore.0.1.0.nupkg

GeneratePackageOnBuild is off — pack explicitly as above.


Status

Built at 0.1.0. NOT yet adopted by the three apps. Adoption is tracked in the component backlog:

  • ~/Desktop/scadaproj/components/health/GAPS.md

Design documentation lives alongside that backlog:

  • ~/Desktop/scadaproj/components/health/spec/SPEC.md — normalized three-tier target
  • ~/Desktop/scadaproj/components/health/shared-contract/ZB.MOM.WW.Health.md — proposed API
  • ~/Desktop/scadaproj/components/health/current-state/ — per-project current state (code-verified)