Catch-all commit for pending work on the task-galaxy-e2e branch that
wasn't part of the FOCAS migration. Grouping by topic so future per-topic
commits can be cherry-picked if needed.
TwinCAT
- src/.../Driver.TwinCAT/AdsTwinCATClient.cs + TwinCATDriverFactoryExtensions.cs:
factory-registration extensions + ADS client refinements.
- src/.../Driver.TwinCAT.Cli/Commands/BrowseCommand.cs: new browse command
for the TwinCAT test-client CLI.
- tests/.../Driver.TwinCAT.IntegrationTests/TwinCAT3SmokeTests.cs + TwinCatProject/:
fixture scaffold with a minimal POU + README pointing at the TCBSD/ESXi
VM for e2e.
- docs/Driver.TwinCAT.Cli.md + docs/drivers/TwinCAT-Test-Fixture.md:
documentation for the above.
- docs/v3/twincat-backlog.md: forward-looking backlog seed.
Admin UI + fleet status
- src/.../Admin/Components/Pages/Clusters/DriversTab.razor + Hosts.razor:
UI refresh for fleet-status rendering.
- src/.../Admin/Hubs/FleetStatusHub.cs + FleetStatusPoller.cs +
Admin/Program.cs: SignalR hub + poller plumbing for live fleet data.
- tests/.../Admin.Tests/FleetStatusPollerTests.cs: poller coverage.
Server + redundancy runtime (Phase 6.3 follow-ups)
- src/.../Server/Hosting/RedundancyPublisherHostedService.cs: HostedService
that owns the RedundancyStatePublisher lifecycle + wires peer reachability.
- src/.../Server/Redundancy/ServerRedundancyNodeWriter.cs: OPC UA
variable-node writer binding ServiceLevel + ServerUriArray to the
publisher's events.
- src/.../Server/Program.cs + Server.csproj: hosted-service registration.
- tests/.../Server.Tests/ServerRedundancyNodeWriterTests.cs +
Server.Tests.csproj: coverage for the above.
Configuration
- src/.../Configuration/Validation/DraftValidator.cs +
tests/.../Configuration.Tests/DraftValidatorTests.cs: draft-validation
refinements.
E2E scripts (shared infrastructure)
- scripts/e2e/README.md + _common.ps1 + test-all.ps1: shared helpers + the
all-drivers test-all runner.
- scripts/e2e/test-opcuaclient.ps1: OPC UA Client e2e runner.
Docs
- docs/v2/implementation/phase-6-{1,2,3,4}*.md + exit-gate-phase-{3,7}.md:
phase-gate + implementation doc updates.
- docs/v2/plan.md: top-level plan refresh.
- docs/v2/redundancy-interop-playbook.md: client interop playbook for the
Phase 6.3 redundancy-runtime work.
Two orphan FOCAS docs remain on disk but deliberately unstaged —
docs/v2/focas-deployment.md and docs/v2/implementation/focas-simulator-plan.md
describe the now-retired Tier-C topology and should either be rewritten
or deleted in a follow-up.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6.4 KiB
6.4 KiB
Phase 7 Exit Gate — Scripting, Virtual Tags, Scripted Alarms, Historian Sink
Status: FULLY CLOSED 2026-04-23 audit — the three original follow-ups (#239 / #240 / #241) were all shipped under later branches but this exit-gate doc wasn't updated at the time. All three verified against the repo + tests green.
Compliance script:
scripts/compliance/phase-7-compliance.ps1Plan doc:docs/v2/implementation/phase-7-scripting-and-alarming.md
What shipped
| Stream | PR | Summary |
|---|---|---|
| A | #177–#179 | Core.Scripting — Roslyn sandbox + DependencyExtractor + ForbiddenTypeAnalyzer + per-script Serilog sink + 63 tests |
| B | #180 | Core.VirtualTags — dep graph (iterative Tarjan) + engine + timer scheduler + VirtualTagSource + 36 tests |
| C | #181 | Core.ScriptedAlarms — Part 9 state machine + predicate engine + message template + ScriptedAlarmSource + 47 tests |
| D | #182 | Core.AlarmHistorian — SQLite store-and-forward + backoff ladder + dead-letter retention + Galaxy.Host IPC contracts + 14 tests |
| E | #183 | Config DB schema — Script / VirtualTag / ScriptedAlarm / ScriptedAlarmState entities + migration + 12 tests |
| F | #185 | Admin UI — ScriptService / VirtualTagService / ScriptedAlarmService / ScriptTestHarnessService / HistorianDiagnosticsService + Monaco editor + /alarms/historian page + 13 tests |
| G | #184 | Walker emits Virtual + ScriptedAlarm variables with NodeSourceKind discriminator + 5 tests |
| G follow-up | #186 | DriverNodeManager dispatch routes by NodeSourceKind + writes rejected for non-Driver sources + 7 tests |
Phase 7 totals: ~197 new tests across 7 projects. Plan decisions #1–#22 all realised in code.
Compliance Checks (run at exit gate)
Covered by scripts/compliance/phase-7-compliance.ps1:
- Roslyn sandbox anchored on
ScriptContextassembly withForbiddenTypeAnalyzerdefense-in-depth (plan #6) DependencyExtractorrejects non-literal tag paths with source spans (plan #7)- Per-script rolling Serilog sink + companion-forwarding Error+ to main log (plan #12)
- VirtualTag dep graph uses iterative SCC — no stack overflow on 10 000-deep chains
VirtualTagSourceimplementsIReadable+ISubscribableper ADR-002- Part 9 state machine covers every transition (Apply/Ack/Confirm/Shelve/Unshelve/Enable/Disable/Comment/ShelvingCheck)
AlarmPredicateContextrejectsSetVirtualTagat runtime (predicates must be pure)MessageTemplatesubstitutes{TagPath}tokens at event emission (plan #13); missing/bad →{?}- SQLite sink backoff ladder 1s → 2s → 5s → 15s → 60s cap (plan #16)
- Default 1M-row capacity + 30-day dead-letter retention (plan #21)
- Per-event outcomes Ack/RetryPlease/PermanentFail on the wire
- Galaxy.Host IPC contracts (
HistorianAlarmEventRequest/Response/ConnectivityStatusNotification) - Config DB check constraints: trigger-required, timer-min, severity-range, alarm-type-enum, JSON comments
ScriptedAlarmStatekeyed onScriptedAlarmId(not generation-scoped) per plan #14- Admin services: SourceHash preserves compile-cache hit on rename; Update recomputes on source change
ScriptTestHarnessServiceenforces declared-inputs-only contract (plan #22)- Monaco editor via CDN + textarea fallback (plan #18)
/alarms/historianpage with Retry-dead-lettered operator action- Walker emits
NodeSourceKind.Virtual+NodeSourceKind.ScriptedAlarmvariables DriverNodeManagerdispatch routes Reads by source; Writes to non-Driver rejected withBadUserAccessDenied(plan #6)
Deferred to Post-Gate Follow-ups (all closed as of 2026-04-23 audit)
Originally kept out of the capstone so the gate could close cleanly. Each landed as a targeted follow-up PR; audit this session verified them against the repo:
- SealedBootstrap composition root (task #239) — CLOSED.
src/ZB.MOM.WW.OtOpcUa.Server/Phase7/Phase7Composer.csinstantiatesVirtualTagEngine+ScriptedAlarmEngineviaPhase7EngineComposer.Compose, andSqliteStoreAndForwardSinkinResolveHistorianSinkwhen a registered driver providesIAlarmHistorianWriter(today:GalaxyProxyDriver).OpcUaServerService.ExecuteAsynccallsPhase7Composer.PrepareAsyncthenOpcUaApplicationHost.SetPhase7SourcesbeforeapplicationHost.StartAsyncsoOtOpcUaServer+DriverNodeManagercapture theVirtualReadable/ScriptedAlarmReadableat construction. 38 tests green undertests/ZB.MOM.WW.OtOpcUa.Server.Tests/Phase7/+SealedBootstrapIntegrationTests. The work landed under the label "Phase 7 follow-up #246" and was never re-labelled against #239. - Live OPC UA end-to-end smoke (task #240) — CLOSED.
scripts/e2e/test-phase7-virtualtags.ps1drives a full Client.CLI read of a driver-sourced input, reads the VirtualTag computed off it, triggers a scripted alarm by writing the trigger value, and subscribes to the alarm condition — all through a running OtOpcUa server. Covered inscripts/e2e/test-all.ps1+scripts/e2e/README.mdmatrix. - sp_ComputeGenerationDiff extension (task #241) — CLOSED. Migration
20260420232000_ExtendComputeGenerationDiffWithPhase7.csextends the stored proc to emit Script / VirtualTag / ScriptedAlarm sections alongside the existing NodeAcl / Tag / Equipment / DriverInstance / Namespace output. Admin DiffViewer picks them up through its existing section-plugin architecture (Phase 6.4 Stream C).
Completion Checklist
- Stream A shipped + merged
- Stream B shipped + merged
- Stream C shipped + merged
- Stream D shipped + merged
- Stream E shipped + merged
- Stream F shipped + merged
- Stream G shipped + merged
- Stream G follow-up (dispatch) shipped + merged
phase-7-compliance.ps1present and passes- Full solution
dotnet testpasses (no new failures beyond pre-existing tolerated CLI flake) - Exit-gate doc checked in
SealedBootstrapcomposition follow-up shipped (#239 / Phase 7 follow-up #246)- Live end-to-end smoke follow-up shipped (#240 —
scripts/e2e/test-phase7-virtualtags.ps1) sp_ComputeGenerationDiffextension follow-up shipped (#241 — migrationExtendComputeGenerationDiffWithPhase7)
How to run
pwsh ./scripts/compliance/phase-7-compliance.ps1
Exit code 0 = all pass; non-zero = failures listed in the preceding [FAIL] lines.