Files
scadaproj/ZB.MOM.WW.Configuration/CLAUDE.md
T
Joseph Doherty b4c38d0f0c docs(libs): refresh stale adoption-status text in hosted library docs (scadaproj#17)
Verified 2026-11-09 against each app's origin default branch pins
(OtOpcUa origin/master c904472a, mxaccessgw origin/main de86f8b8,
ScadaBridge origin/main 7153a197, HistorianGateway origin/main 4d6a9ad)
and the Gitea NuGet feed:
- Audit README: consumer matrix no longer says "adoption deferred" (all four
  apps pin 0.1.0, DEEP-adopted 2026-06-02; HistorianGateway row added);
  dead ~/Desktop/scadaproj-audit paths fixed.
- Configuration CLAUDE.md: drop "not yet pushed to remotes"; all four pin 0.1.0.
- Telemetry README/CLAUDE.md: all four apps call AddZbTelemetry and pin 0.1.0;
  HistorianGateway added to the consumer matrix.
- Secrets CLAUDE.md: lead now says family 0.6.3 on the feed, all four apps pin
  0.6.2, none pins 0.6.3 or Replicator.Grpc.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
2026-11-09 13:40:30 -05:00

6.3 KiB

ZB.MOM.WW.Configuration

Startup configuration-validation library for the ZB.MOM.WW SCADA family (OtOpcUa, MxAccessGateway, ScadaBridge). These are libraries, not a service — the package is linked directly into the consuming application at build time. There is no central validation process; all validation runs in-process at startup.

The library normalizes the three-project configuration-validation surface: a failure-accumulating IValidateOptions base, reusable rule primitives, a bind+validate+ValidateOnStart DI extension, and a pre-host ConfigPreflight aggregator for raw IConfiguration — so the plumbing is written once and domain rules stay per-project.

Built at 0.1.0. Adopted by OtOpcUa, MxAccessGateway, and ScadaBridge on 2026-06-01, and by HistorianGateway since; all four pin 0.1.0 (the only feed version) on their pushed origin default branches (verified 2026-11-09). Adoption tracked in ~/Desktop/scadaproj/components/configuration/GAPS.md.


Package

Package Responsibilities Key Dependencies
ZB.MOM.WW.Configuration OptionsValidatorBase<TOptions> (abstract IValidateOptions base, failure-accumulating), ValidationBuilder (rule primitives: Required, Port, HostPort, PositiveTimeSpan, OneOf, MinCount, RequireThat, Add), ServiceCollectionExtensions.AddValidatedOptions (bind + validator + ValidateOnStart in one call), ConfigPreflight (fluent pre-host raw-IConfiguration checker). Microsoft.Extensions.Options, Microsoft.Extensions.Options.ConfigurationExtensions, Microsoft.Extensions.Configuration.Abstractions, Microsoft.Extensions.DependencyInjection.Abstractions

Single package; no ASP.NET Core framework reference.


Build, test, and pack commands

# From ZB.MOM.WW.Configuration/

# Build
dotnet build ZB.MOM.WW.Configuration.slnx

# Test (no external dependencies required)
dotnet test ZB.MOM.WW.Configuration.slnx

# Pack (one .nupkg lands in artifacts/)
dotnet pack ZB.MOM.WW.Configuration.slnx -c Release -o ./artifacts

Test breakdown:

Assembly Tests
ZB.MOM.WW.Configuration.Tests 27
Total 27

GeneratePackageOnBuild is off — pack explicitly with the command above.


Source layout

ZB.MOM.WW.Configuration/
├── Directory.Build.props          # version (0.1.0), TFM (net10.0), central package mgmt
├── Directory.Packages.props       # pinned package versions
├── ZB.MOM.WW.Configuration.slnx   # solution file
├── src/
│   └── ZB.MOM.WW.Configuration/   # library project
│       ├── OptionsValidatorBase.cs
│       ├── ValidationBuilder.cs
│       ├── Checks.cs                 # internal shared rule wording
│       ├── ServiceCollectionExtensions.cs
│       └── ConfigPreflight.cs
└── tests/
    └── ZB.MOM.WW.Configuration.Tests/   # xUnit test project (27 tests)

Status

Part of the scadaproj component-normalization family — this is the configuration + validation component. Built at 0.1.0. Adopted by OtOpcUa, MxAccessGateway, and ScadaBridge on 2026-06-01 (since pushed; HistorianGateway also pins 0.1.0 — all four verified on their origin default branches 2026-11-09) — per-app result is tracked in:

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

Design documentation:

  • ~/Desktop/scadaproj/components/configuration/spec/SPEC.md — normalized validation target
  • ~/Desktop/scadaproj/components/configuration/shared-contract/ZB.MOM.WW.Configuration.md — proposed shared-library API
  • ~/Desktop/scadaproj/components/configuration/current-state/ — per-project current state (code-verified)

Index history (migrated from the scadaproj root CLAUDE.md)

Moved verbatim out of the scadaproj root CLAUDE.md on 2026-09-03 so it loads only when needed. This file is now the authoritative place for this history — append new entries here and keep the root index row short.

Narrative

The configuration component is fully populated: a normalized spec, a shared-contract, three current-state docs, and an adoption GAPS backlog. Shared = the IValidateOptions<T> failure-accumulation base (OptionsValidatorBase<T>) + reusable rule primitives (ValidationBuilder: port / host:port / required / positive-duration / one-of / min-count) + AddValidatedOptions<TOptions,TValidator>() (bind + validate + ValidateOnStart) + the pre-host ConfigPreflight aggregator (generalizes ScadaBridge's StartupValidator, byte-compatible message); left per-project = each app's options classes + domain rules, and OtOpcUa's draft/generation-content validation (DB-side sp_ValidateDraft; its C# DraftValidator is dormant).

The shared library is built and lives in this repo at ZB.MOM.WW.Configuration/ (.NET 10; single package ZB.MOM.WW.Configuration; 42 tests (verified 2026-07-18); dotnet pack → 1 nupkg @ 0.1.0). The implementation plan is at docs/plans/2026-06-01-zb-mom-ww-configuration-shared-library.md. Adopted across all three apps on 2026-06-01 (OtOpcUa, MxAccessGateway, ScadaBridge) on each repo's local default branch (main/master) — merged, and since pushed to origin (the "not yet pushed" caveat this record carried is stale; all four apps, HistorianGateway included, pin 0.1.0 on their origin default branches as of 2026-11-09); the package was first published to the Gitea feed. Behaviour-preserving onto OptionsValidatorBase/AddValidatedOptions for MxGateway + ScadaBridge (validator messages byte-identical), StartupValidator → ConfigPreflight for ScadaBridge, and net-new Ldap/OpcUa validators for OtOpcUa. Per-app result tracked in components/configuration/GAPS.md. Build/test from ZB.MOM.WW.Configuration/: dotnet test. Consumer matrix: all three apps consume the single package; ScadaBridge is the heaviest adopter (per-module validators + StartupValidator → ConfigPreflight); OtOpcUa adoption is additive (it has no IValidateOptions usage today).