# PR 1 — Phase 1 + Phase 2 A/B/C → v2

**Source**: `phase-1-configuration` (commits `980ea51..7403b92`, 11 commits)
**Target**: `v2`
**URL**: https://gitea.dohertylan.com/dohertj2/lmxopcua/pulls/new/phase-1-configuration

## Summary

- **Phase 1 complete** — Configuration project with 16 entities + 3 EF migrations
  (InitialSchema + 8 stored procs + AuthorizationGrants), Core + Server + full Admin UI
  (Blazor Server with cluster CRUD, draft → diff → publish → rollback, equipment with
  OPC 40010, UNS, namespaces, drivers, ACLs, reservations, audit), LDAP via GLAuth
  (`localhost:3893`), SignalR real-time fleet status + alerts.
- **Phase 2 Streams A + B + C feature-complete** — full IPC contract surface
  (Galaxy.Shared, netstandard2.0, MessagePack), Galaxy.Host with real Win32 STA pump,
  ACL + caller-SID + per-process-secret IPC, Galaxy-specific MemoryWatchdog +
  RecyclePolicy + PostMortemMmf + MxAccessHandle, three `IGalaxyBackend`
  implementations (Stub / DbBacked / **MxAccess** — real ArchestrA.MxAccess.dll
  reference, x86, smoke-tested live against `LMXProxyServer`), Galaxy.Proxy with all
  9 capability interfaces (`IDriver` / `ITagDiscovery` / `IReadable` / `IWritable` /
  `ISubscribable` / `IAlarmSource` / `IHistoryProvider` / `IRediscoverable` /
  `IHostConnectivityProbe`) + supervisor (Backoff + CircuitBreaker +
  HeartbeatMonitor).
- **Phase 2 Stream D non-destructive deliverables** — appsettings.json → DriverConfig
  migration script, two-service Windows installer scripts, process-spawn cross-FX
  parity test, Stream D removal procedure doc with both Option A (rewrite 494 v1
  tests) and Option B (archive + new v2 E2E suite) spelled out step-by-step.

## What's NOT in this PR

- Legacy `OtOpcUa.Host` deletion (Stream D.1) — reserved for a follow-up PR after
  Option B's E2E suite is green. The 494 v1 tests still pass against the unchanged
  legacy Host.
- Live-Galaxy parity validation (Stream E) — needs the iterative debug cycle the
  removal-procedure doc describes.

## Tests

**964 pass / 1 pre-existing Phase 0 baseline failure**, across 14 test projects:

| Project | Pass | Notes |
|---|---:|---|
| Core.Abstractions.Tests | 24 | |
| Configuration.Tests | 42 | incl. 7 schema compliance, 8 stored-proc, 3 SQL-role auth, 13 validator, 6 LiteDB cache, 5 generation-applier |
| Core.Tests | 4 | DriverHost lifecycle |
| Server.Tests | 2 | NodeBootstrap + LiteDB cache fallback |
| Admin.Tests | 21 | incl. 5 RoleMapper, 6 LdapAuth, 3 LiveLdap, 2 FleetStatusPoller, 2 services-integration |
| Driver.Galaxy.Shared.Tests | 6 | Round-trip + framing |
| Driver.Galaxy.Host.Tests | 30 | incl. 5 GalaxyRepository live ZB, 3 live MXAccess COM, 5 EndToEndIpc, 2 IpcHandshake, 4 MemoryWatchdog, 3 RecyclePolicy, 3 PostMortemMmf, 3 StaPump, 2 service-installer dry-run |
| Driver.Galaxy.Proxy.Tests | 10 | 9 unit + 1 process-spawn parity |
| Client.Shared.Tests | 131 | unchanged |
| Client.UI.Tests | 98 | unchanged |
| Client.CLI.Tests | 51 / 1 fail | pre-existing baseline failure |
| Historian.Aveva.Tests | 41 | unchanged |
| IntegrationTests (net48) | 6 | unchanged — v1 parity baseline |
| **OtOpcUa.Tests (net48)** | **494** | **unchanged — v1 parity baseline** |

## Test plan for reviewers

- [ ] `dotnet build ZB.MOM.WW.OtOpcUa.slnx` succeeds with no warnings beyond the
      known NuGetAuditSuppress + xUnit1051 warnings
- [ ] `dotnet test ZB.MOM.WW.OtOpcUa.slnx` shows the same 964/1 result
- [ ] `Get-Service aaGR, aaBootstrap` reports Running on the merger's box
- [ ] `docker ps --filter name=otopcua-mssql` shows the SQL container Up
- [ ] Admin UI boots (`dotnet run --project src/ZB.MOM.WW.OtOpcUa.Admin`); home page
      renders at http://localhost:5123/; LDAP sign-in with GLAuth `readonly` /
      `readonly123` succeeds
- [ ] Migration script dry-run: `powershell -File
      scripts/migration/Migrate-AppSettings-To-DriverConfig.ps1 -DryRun` produces
      a well-formed DriverConfig JSON
- [ ] Spot-read three commit messages to confirm the deferred-with-rationale items
      are explicitly documented (`549cd36`, `a7126ba`, `7403b92` are the most
      recent and most detailed)

## Follow-up tracking

PR 2 (next session) will execute Stream D Option B — archive `OtOpcUa.Tests` as
`OtOpcUa.Tests.v1Archive`, build the new `OtOpcUa.Driver.Galaxy.E2E` test project,
delete legacy `OtOpcUa.Host`, and run the parity-validation cycle. See
`docs/v2/implementation/stream-d-removal-procedure.md`.
