From 0c087d150de06b2324c34d55376a8a712511ec85 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Mon, 1 Jun 2026 07:09:14 -0400 Subject: [PATCH] feat(health): pack ZB.MOM.WW.Health 0.1.0 + README + register health component in indexes - Added PackageTags to all 3 library csproj files (health-checks;aspnetcore/akka/efcore;scada;wonderware;zb-mom-ww) - Full solution dotnet test: 58 tests green (32 Akka + 20 core + 6 EFCore) - dotnet pack -c Release produces 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; artifacts/ not committed - ZB.MOM.WW.Health/README.md: overview, packages table, consumer matrix, versioning, build/test/pack instructions, status note - components/README.md: Health row added to component registry - CLAUDE.md: Health row in Component-normalization table + Health paragraph; intro updated from "two pieces" to "three pieces" - upcoming.md: Health checks item checked off with pointer to components/health/ and ZB.MOM.WW.Health/ - components/health/README.md: status updated from "Draft / scaffolded / follow-on" to "Built @ 0.1.0" --- CLAUDE.md | 23 ++++- ZB.MOM.WW.Health/README.md | 84 +++++++++++++++++++ .../ZB.MOM.WW.Health.Akka.csproj | 1 + ...B.MOM.WW.Health.EntityFrameworkCore.csproj | 1 + .../ZB.MOM.WW.Health/ZB.MOM.WW.Health.csproj | 1 + components/README.md | 1 + components/health/README.md | 9 +- upcoming.md | 9 +- 8 files changed, 119 insertions(+), 10 deletions(-) create mode 100644 ZB.MOM.WW.Health/README.md diff --git a/CLAUDE.md b/CLAUDE.md index d729eae..8643df7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,9 +6,10 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co `scadaproj` is primarily an umbrella/index workspace that aggregates a family of related SCADA / OT / Wonderware / OPC UA "sister projects" that live as **sibling -directories under `~/Desktop/`**. It now also **hosts two pieces of source itself** — -the shared [`ZB.MOM.WW.Auth/`](ZB.MOM.WW.Auth/) library and the shared -[`ZB.MOM.WW.Theme/`](ZB.MOM.WW.Theme/) UI kit — both the realized output of their +directories under `~/Desktop/`**. It now also **hosts three pieces of source itself** — +the shared [`ZB.MOM.WW.Auth/`](ZB.MOM.WW.Auth/) library, the shared +[`ZB.MOM.WW.Theme/`](ZB.MOM.WW.Theme/) UI kit, and the shared +[`ZB.MOM.WW.Health/`](ZB.MOM.WW.Health/) health-check library — all the realized output of their respective component normalizations (see [Component normalization](#component-normalization)). The point of this file is to give a high-level scan of each sister project — its purpose, location, stack, and primary commands — so a fresh Claude Code session can orient across @@ -119,6 +120,7 @@ each project's **code-verified current state**, and the **gaps** between. See |---|---|---|---|---| | Auth (login / identity / authz) | Built (lib `0.1.0`) | Shared `ZB.MOM.WW.Auth` lib | [`components/auth/`](components/auth/) | [`ZB.MOM.WW.Auth/`](ZB.MOM.WW.Auth/) | | UI Theme (layout / tokens / components) | Built (lib `0.1.0`) | Shared `ZB.MOM.WW.Theme` RCL | [`components/ui-theme/`](components/ui-theme/) | [`ZB.MOM.WW.Theme/`](ZB.MOM.WW.Theme/) | +| Health (readiness / liveness / active-node) | Built (lib `0.1.0`) | Shared `ZB.MOM.WW.Health` lib | [`components/health/`](components/health/) | [`ZB.MOM.WW.Health/`](ZB.MOM.WW.Health/) | The auth component is fully populated: a normalized [`spec`](components/auth/spec/SPEC.md), a proposed [`shared-contract`](components/auth/shared-contract/ZB.MOM.WW.Auth.md), three @@ -149,6 +151,21 @@ The implementation plan is at Build/test from `ZB.MOM.WW.Theme/`: `dotnet test`. Consumer matrix: all three apps consume the single `ZB.MOM.WW.Theme` package (OtOpcUa AdminUI, MxGateway Server, ScadaBridge Host + CentralUI). +The health component is fully populated: a normalized [`spec`](components/health/spec/SPEC.md), a +[`shared-contract`](components/health/shared-contract/ZB.MOM.WW.Health.md), three +[`current-state`](components/health/current-state/) docs, and an adoption [`GAPS`](components/health/GAPS.md) +backlog. Shared = three-tier endpoint convention (ready/active/healthz) + canonical JSON writer + +`IActiveNodeGate` seam + `GrpcDependencyHealthCheck` + `AkkaClusterHealthCheck` + `ActiveNodeHealthCheck` ++ `DatabaseHealthCheck`; left per-project = which probes each app registers, +orchestrator wiring, and ScadaBridge's distributed health-monitoring pipeline. + +The shared library is **built and lives in this repo** at [`ZB.MOM.WW.Health/`](ZB.MOM.WW.Health/) +(.NET 10; 3 packages — `ZB.MOM.WW.Health`, `ZB.MOM.WW.Health.Akka`, `ZB.MOM.WW.Health.EntityFrameworkCore`; +58 tests; `dotnet pack` → 3 nupkgs @ 0.1.0). +**Not yet adopted** by the three apps — that's the follow-on tracked in [`components/health/GAPS.md`](components/health/GAPS.md). +Build/test from `ZB.MOM.WW.Health/`: `dotnet test`. Consumer matrix: MxAccessGateway → core only; +OtOpcUa & ScadaBridge → all three packages. + ## Per-project primary commands Run these from inside each project directory (not from `scadaproj`). diff --git a/ZB.MOM.WW.Health/README.md b/ZB.MOM.WW.Health/README.md new file mode 100644 index 0000000..1ff8dc9 --- /dev/null +++ b/ZB.MOM.WW.Health/README.md @@ -0,0 +1,84 @@ +# 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` 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 + +```bash +# 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 + +```bash +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) diff --git a/ZB.MOM.WW.Health/src/ZB.MOM.WW.Health.Akka/ZB.MOM.WW.Health.Akka.csproj b/ZB.MOM.WW.Health/src/ZB.MOM.WW.Health.Akka/ZB.MOM.WW.Health.Akka.csproj index 371e321..3eadea2 100644 --- a/ZB.MOM.WW.Health/src/ZB.MOM.WW.Health.Akka/ZB.MOM.WW.Health.Akka.csproj +++ b/ZB.MOM.WW.Health/src/ZB.MOM.WW.Health.Akka/ZB.MOM.WW.Health.Akka.csproj @@ -5,6 +5,7 @@ ZB.MOM.WW.Health.Akka ZB.MOM.WW Akka.Cluster health-check extensions for the ZB.MOM.WW SCADA family. + health-checks;akka;akka-cluster;scada;wonderware;zb-mom-ww https://gitea.dohertylan.com/dohertj2/zb-mom-ww-health https://gitea.dohertylan.com/dohertj2/zb-mom-ww-health diff --git a/ZB.MOM.WW.Health/src/ZB.MOM.WW.Health.EntityFrameworkCore/ZB.MOM.WW.Health.EntityFrameworkCore.csproj b/ZB.MOM.WW.Health/src/ZB.MOM.WW.Health.EntityFrameworkCore/ZB.MOM.WW.Health.EntityFrameworkCore.csproj index c64ec4e..f2f61b2 100644 --- a/ZB.MOM.WW.Health/src/ZB.MOM.WW.Health.EntityFrameworkCore/ZB.MOM.WW.Health.EntityFrameworkCore.csproj +++ b/ZB.MOM.WW.Health/src/ZB.MOM.WW.Health.EntityFrameworkCore/ZB.MOM.WW.Health.EntityFrameworkCore.csproj @@ -5,6 +5,7 @@ ZB.MOM.WW.Health.EntityFrameworkCore ZB.MOM.WW Entity Framework Core health-check extensions for the ZB.MOM.WW SCADA family. + health-checks;entity-framework-core;efcore;scada;wonderware;zb-mom-ww https://gitea.dohertylan.com/dohertj2/zb-mom-ww-health https://gitea.dohertylan.com/dohertj2/zb-mom-ww-health diff --git a/ZB.MOM.WW.Health/src/ZB.MOM.WW.Health/ZB.MOM.WW.Health.csproj b/ZB.MOM.WW.Health/src/ZB.MOM.WW.Health/ZB.MOM.WW.Health.csproj index 348e88f..883fbfe 100644 --- a/ZB.MOM.WW.Health/src/ZB.MOM.WW.Health/ZB.MOM.WW.Health.csproj +++ b/ZB.MOM.WW.Health/src/ZB.MOM.WW.Health/ZB.MOM.WW.Health.csproj @@ -5,6 +5,7 @@ ZB.MOM.WW.Health ZB.MOM.WW Core ASP.NET Core health-check extensions for the ZB.MOM.WW SCADA family. + health-checks;aspnetcore;scada;wonderware;zb-mom-ww https://gitea.dohertylan.com/dohertj2/zb-mom-ww-health https://gitea.dohertylan.com/dohertj2/zb-mom-ww-health diff --git a/components/README.md b/components/README.md index 5dfd0ef..7adb712 100644 --- a/components/README.md +++ b/components/README.md @@ -19,6 +19,7 @@ specs and analyses that *drive* changes made in the individual repos. |---|---|---|---|---| | Auth (login / identity / authz) | Draft | OtOpcUa, MxAccessGateway, ScadaBridge | Path to shared code (`ZB.MOM.WW.Auth`) | [`auth/`](auth/) | | UI Theme (layout / tokens / components) | Draft | OtOpcUa, MxAccessGateway, ScadaBridge | Path to shared code (`ZB.MOM.WW.Theme`) | [`ui-theme/`](ui-theme/) | +| Health (readiness / liveness / active-node) | Draft | OtOpcUa, MxAccessGateway, ScadaBridge | Shared `ZB.MOM.WW.Health` lib (3 packages) | [`health/`](health/) | > Add a row when you start normalizing a new component. Status: `Draft` → `Reviewed` → `Adopting` → `Converged`. diff --git a/components/health/README.md b/components/health/README.md index 47a9b29..f076a61 100644 --- a/components/health/README.md +++ b/components/health/README.md @@ -81,7 +81,8 @@ all three. ## Component status -**Status: Draft.** Spec and shared-contract written; current-state docs verified; GAPS backlog -populated. Library scaffolded at [`../../ZB.MOM.WW.Health/`](../../ZB.MOM.WW.Health/); source -implementation is a follow-on (task #7 in the adoption backlog). Adoption by the three apps is -a further follow-on tracked in [`GAPS.md`](GAPS.md). +**Status: Draft — library built at 0.1.0.** Spec and shared-contract written; current-state docs +verified; GAPS backlog populated. Library implemented and packed at +[`../../ZB.MOM.WW.Health/`](../../ZB.MOM.WW.Health/) (3 packages, 58 tests; +`ZB.MOM.WW.Health`, `ZB.MOM.WW.Health.Akka`, `ZB.MOM.WW.Health.EntityFrameworkCore`). +Adoption by the three apps is the next follow-on tracked in [`GAPS.md`](GAPS.md). diff --git a/upcoming.md b/upcoming.md index b7aac1e..f658c36 100644 --- a/upcoming.md +++ b/upcoming.md @@ -82,6 +82,9 @@ cross-repo interop checks, distinct from the others. `AddZbDefaults()`-style call. ## Suggested order -1. **Health checks** (cleanest duplication, bounded). 2. **Observability/telemetry** (completes the -operability cluster with Health). 3. **Audit model** (ties back to Auth). Then revisit the gRPC -contract surface and the `Hosting` aggregator. +1. ~~**Health checks** (cleanest duplication, bounded).~~ **Done** — `ZB.MOM.WW.Health` built @ + 0.1.0 (3 packages, 58 tests). Design: [`components/health/`](components/health/); + implementation: [`../ZB.MOM.WW.Health/`](../ZB.MOM.WW.Health/). Adoption tracked in + [`components/health/GAPS.md`](components/health/GAPS.md). +2. **Observability/telemetry** (completes the operability cluster with Health). 3. **Audit model** + (ties back to Auth). Then revisit the gRPC contract surface and the `Hosting` aggregator.