Task #253 follow-up — bidirectional + subscribe-sees-change e2e stages #208

Merged
dohertj2 merged 1 commits from task-253b-e2e-bidirectional into v2 2026-04-21 10:11:10 -04:00
Owner

Summary

The original three-stage design in PR #207 (probe / driver-loopback / forward-bridge) only verified driver-write → server-read. User called this out — nothing tested the reverse direction, nor asserted that OPC UA subscriptions actually deliver data-change notifications for driver-originated changes.

New stages

  • Test-OpcUaWriteBridgeotopcua-cli write the NodeId → wait → driver CLI reads the PLC side. Covers client → server → driver → PLC.
  • Test-SubscribeSeesChangeotopcua-cli subscribe --duration N in the background, settle 2s, driver-side write, wait for the window to close, assert captured stdout mentions the value. Covers server-side monitored-item + data-change delivery end-to-end.

Wired into all six per-driver scripts (modbus / abcip / ablegacy / s7 / focas / twincat). README updated to describe the five-stage design + note that the published tag must be writable for stages 4 and 5.

Ancillary

Prepended UTF-8 BOM to every script so the Windows PowerShell 5.1 parser accepts the em-dashes PowerShell 7 already handled fine. Scripts still #Requires -Version 7.0; the BOM is purely defensive for IDE / CI step parsers that don't respect the shebang.

Test plan

  • [System.Management.Automation.Language.Parser]::ParseFile clean on all scripts (test-all.ps1's ?? operators are expected PS7-only, not errors)
  • Live run against Modbus + AB CIP simulators (manual — dev-box-local)
## Summary The original three-stage design in PR #207 (probe / driver-loopback / forward-bridge) only verified `driver-write → server-read`. User called this out — nothing tested the reverse direction, nor asserted that OPC UA subscriptions actually deliver data-change notifications for driver-originated changes. ## New stages - **Test-OpcUaWriteBridge** — `otopcua-cli write` the NodeId → wait → driver CLI reads the PLC side. Covers `client → server → driver → PLC`. - **Test-SubscribeSeesChange** — `otopcua-cli subscribe --duration N` in the background, settle 2s, driver-side write, wait for the window to close, assert captured stdout mentions the value. Covers server-side monitored-item + data-change delivery end-to-end. Wired into all six per-driver scripts (modbus / abcip / ablegacy / s7 / focas / twincat). README updated to describe the five-stage design + note that the published tag must be writable for stages 4 and 5. ## Ancillary Prepended UTF-8 BOM to every script so the Windows PowerShell 5.1 parser accepts the em-dashes PowerShell 7 already handled fine. Scripts still `#Requires -Version 7.0`; the BOM is purely defensive for IDE / CI step parsers that don't respect the shebang. ## Test plan - [x] `[System.Management.Automation.Language.Parser]::ParseFile` clean on all scripts (test-all.ps1's `??` operators are expected PS7-only, not errors) - [ ] Live run against Modbus + AB CIP simulators (manual — dev-box-local)
dohertj2 added 1 commit 2026-04-21 10:10:54 -04:00
The original three-stage design (probe / driver-loopback / forward-
bridge) only proved driver-write → server-read. It missed:

 - OPC UA write → server → driver → PLC (the reverse direction)
 - server-side data-change notifications actually firing (a stale
   subscription can still let a read-after-the-fact return the new
   value and look fine)

Extend _common.ps1 with two helpers:

 - Test-OpcUaWriteBridge: otopcua-cli write the NodeId -> wait 3s ->
   driver CLI read the PLC side, assert equality.
 - Test-SubscribeSeesChange: Start-Process otopcua-cli subscribe in the
   background with --duration N, settle 2s, driver-side write, wait for
   the subscription window to close, assert captured stdout contains
   the new value.

Wire both into test-modbus / test-abcip / test-ablegacy / test-s7 /
test-focas / test-twincat after the existing forward-bridge stage.
Update README to describe the five-stage design + note that the
published NodeId must be writable for stages 4 + 5.

Also prepend UTF-8 BOM to every script in scripts/e2e so Windows
PowerShell 5.1 parsers agree on em-dash byte sequences the way
PowerShell 7 already does. The scripts still #Requires -Version 7.0 —
the BOM is purely defensive for IDE / CI step parsers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dohertj2 merged commit 7b1c910806 into v2 2026-04-21 10:11:10 -04:00
dohertj2 deleted branch task-253b-e2e-bidirectional 2026-04-21 10:11:10 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dohertj2/lmxopcua#208