<# .SYNOPSIS Phase 6.3 exit-gate compliance check — stub. Each `Assert-*` either passes (Write-Host green) or throws. Non-zero exit = fail. .DESCRIPTION Validates Phase 6.3 (Redundancy runtime) completion. Checks enumerated in `docs/v2/implementation/phase-6-3-redundancy-runtime.md` §"Compliance Checks (run at exit gate)". Current status: SCAFFOLD. Every check writes a TODO line and does NOT throw. Each implementation task in Phase 6.3 is responsible for replacing its TODO with a real check before closing that task. .NOTES Usage: pwsh ./scripts/compliance/phase-6-3-compliance.ps1 Exit: 0 = all checks passed (or are still TODO); non-zero = explicit fail #> [CmdletBinding()] param() $ErrorActionPreference = 'Stop' $script:failures = 0 function Assert-Todo { param([string]$Check, [string]$ImplementationTask) Write-Host " [TODO] $Check (implement during $ImplementationTask)" -ForegroundColor Yellow } function Assert-Pass { param([string]$Check) Write-Host " [PASS] $Check" -ForegroundColor Green } function Assert-Fail { param([string]$Check, [string]$Reason) Write-Host " [FAIL] $Check — $Reason" -ForegroundColor Red $script:failures++ } Write-Host "" Write-Host "=== Phase 6.3 compliance — Redundancy runtime ===" -ForegroundColor Cyan Write-Host "" Write-Host "Stream A — Topology loader" Assert-Todo "Transparent-mode rejection — sp_PublishGeneration blocks RedundancyMode=Transparent" "Stream A.3" Write-Host "" Write-Host "Stream B — Peer probe + ServiceLevel calculator" Assert-Todo "OPC UA band compliance — 0=Maintenance / 1=NoData reserved; operational 2..255" "Stream B.2" Assert-Todo "Authoritative-Primary ServiceLevel = 255" "Stream B.2" Assert-Todo "Isolated-Primary (peer unreachable, self serving) = 230" "Stream B.2" Assert-Todo "Primary-Mid-Apply = 200" "Stream B.2" Assert-Todo "Recovering-Primary = 180 with dwell + publish witness enforced" "Stream B.2" Assert-Todo "Authoritative-Backup = 100" "Stream B.2" Assert-Todo "Isolated-Backup (primary unreachable) = 80 — no auto-promote" "Stream B.2" Assert-Todo "InvalidTopology = 2 — >1 Primary self-demotes both nodes" "Stream B.2" Assert-Todo "UaHealthProbe authority — HTTP-200 + UA-down peer treated as UA-unhealthy" "Stream B.1" Write-Host "" Write-Host "Stream C — OPC UA node wiring" Assert-Todo "ServerUriArray — returns self + peer URIs, self first" "Stream C.2" Assert-Todo "Client.CLI cutover — primary halt triggers reconnect to backup via ServerUriArray" "Stream C.4" Write-Host "" Write-Host "Stream D — Apply-lease + publish fencing" Assert-Todo "Apply-lease disposal — leases close on exception, cancellation, watchdog timeout" "Stream D.2" Assert-Todo "Role transition via operator publish — no restart; both nodes flip ServiceLevel on publish confirm" "Stream D.3" Write-Host "" Write-Host "Stream F — Interop matrix" Assert-Todo "Client interoperability matrix — Ignition 8.1/8.3 / Kepware / Aveva OI Gateway findings documented" "Stream F.1-F.2" Assert-Todo "Galaxy MXAccess failover — primary kill; Galaxy consumer reconnects within session-timeout budget" "Stream F.3" Write-Host "" Write-Host "Cross-cutting" Assert-Todo "No regression in driver test suites; /healthz reachable under redundancy load" "Final exit-gate" Write-Host "" if ($script:failures -eq 0) { Write-Host "Phase 6.3 compliance: scaffold-mode PASS (all checks TODO)" -ForegroundColor Green exit 0 } Write-Host "Phase 6.3 compliance: $script:failures FAIL(s)" -ForegroundColor Red exit 1