First real run of the #230-fixed Upgrade-MxGatewayService.ps1: rolling, ~8-9 s each, env block untouched. #228 KeepsSentTimestamp passes on both (old build +5 h as the negative control); #226 not observable on QA (empty alarm snapshot, no transitions). Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
5.4 KiB
Pending: Worker time-conversion fixes #226 + #228 (DEV first, then QA)
Status: DEV deployed 2026-11-12 (76a71bc8, both checks passed, record 2026-11-12-vd03-76a71bc8-worker-time-fixes.md); QA vq03 + vq04 deployed the same night (76a71bc8, #228 passed on both, record 2026-11-12-qa-vq03-vq04-76a71bc8.md). This is the deploy note for the next gateway deploy. Ship both fixes in one
deploy: they are both in the x86 Worker, both change timestamps consumers see, and both are on main.
| Fix | Commit | Behaviour change on the box |
|---|---|---|
| #226 wnwrap alarm DATE+TIME are already UTC; stop adding GMTOFFSET-DSTADJUST | 892bdc1a |
Every wnwrap alarm time (QueryActiveAlarms, alarm events) moves 4-5 h earlier, to correct UTC. OtOpcUa/ScadaBridge dedup keyed on raise time sees each existing alarm once with the new time. |
#228 Write2/WriteSecured2 (+ bulk) time argument sent as box-local time |
9ef6fc84 |
The stored source timestamp of a timestamped write equals the instant sent, instead of being shifted by the box's UTC offset (+5 h on a UTC-5 box in winter, +4 h in summer). No consumer calls Write2 today (ScadaBridge and OtOpcUa have no call site). |
Build Server and Worker together from one main SHA at or after 9ef6fc84 (the upgrade script refuses
staged builds from different SHAs; they share WorkerProtocolVersion). Procedure, traps and rollback:
docs/runbooks/DeployUpgradeNssmService.md and scripts/deploy/Upgrade-MxGatewayService.ps1.
What else rides along
- DEV vd03 runs
2b13564e.2b13564e..9ef6fc84adds only #226, #227 (opt-inemit_stream_attached, additive proto, Contracts/Client 0.4.0) and #228, plus docs/tests. Nothing else changes for current consumers. - QA vq03/vq04 run
4f931e4. Amainbuild also carries the 2026-10-21 review remediation and the operator-authenticated alarm ack (488649c). The QA deploy is therefore gated by #170: every QA OtOpcUa node with a Galaxy driver must first run lmxopcuadc0a24f2+ and have anAlarmAckfallback account (or per-key ack identities) configured, or every Galaxy ack is refused. Close that gate first or in the same window.
DEV (wonder-app-vd03) first
- Build on windev in a scratch folder from the chosen SHA: Worker
dotnet build src\ZB.MOM.WW.MxGateway.Worker\ZB.MOM.WW.MxGateway.Worker.csproj -c Release -p:Platform=x86and runWorker.Testsx86 (expect 0 failures; 783 passed / 12 skipped at9ef6fc84); publish the Server self-contained as in runbook section 4. Do not touch windev's ownMxAccessGwservice. - Stage both to vd03 over SMB, run the upgrade script on the box (deploy activity, WinRM in scope):
Upgrade-MxGatewayService.ps1 -ServerSource <stage>\Server -WorkerSource <stage>\Worker -ExpectedSha <sha> -Label issue226-228. Single box: stop, swap, start once (trap 1,OrphanWorkerTerminator). - Runbook section 7 checks (health 200, pre-upgrade
mxgw_key authenticates, wrong key rejected, Worker path proven by a read). - #228 check, from the Mac, no remote exec: with a scoped key for
MESReceiver_025.*(Z28062, never Z28061), runMXGATEWAY_LIVE_GATEWAY_ASSERT_WRITE2_TIMESTAMP=1 dotnet test clients/dotnet/ZB.MOM.WW.MxGateway.Client.Tests --filter FullyQualifiedName~LiveGatewayWrite2TestswithMXGATEWAY_LIVE_GATEWAY_ENDPOINT,MXGATEWAY_LIVE_GATEWAY_API_KEY_FILEandMXGATEWAY_LIVE_GATEWAY_WRITE_ITEM=MESReceiver_025.MoveInBatchID(docs/GatewayTesting.md, "Live gateway write"). Both tests must pass:Write2_SupervisoryAdvise_KeepsSentTimestampfailed on2b13564ewith sent01:36:51Z/ stored06:36:51Z. Revoke and delete the key afterwards. - #226 check:
QueryActiveAlarmsforGalaxy!CVDAisle_1.TableAlarms_008.RuntimeAlertreads2026-07-28T20:02:46.830Z(was01:02:46.830Zon 07-29), and a fresh alarm's time equalsRuntime.dbo.Events.EventTimeUtcon wonder-sql-vd03 (read over SQL, not WinRM). - Write the deploy record in
docs/deploy/and update the scadaproj index row.
QA (wonder-app-vq03 / vq04) after DEV passes
- Confirm the #170 prerequisites above on both QA OtOpcUa nodes.
- Same SHA and staged builds as DEV. The gateways are singletons per box: deploy vq03, run the section 7 checks, then vq04 (rolling). The vq04 gateway depends on vq03 for Galaxy SQL and alarms.
- #228 check as DEV step 4 against each QA gateway, with a Z28062 test attribute that exists on QA (pick
and record it;
MESReceiver_025.MoveInBatchIDis the DEV item). #226 check as DEV step 5 against the QA Historian. - Deploy record, index row.
Rollback
Runbook section 8: stop, confirm no Server/Worker process, rename the Server.bak-*/Worker.bak-* pair back,
start once. Both fixes are Worker-only behaviour; no store or schema changes, so rollback restores the old
(wrong) times and nothing else.
Evidence the fix works (windev, 2026-11-12, Eastern Standard Time, UTC-5)
The live smoke WorkerLiveMxAccessSmokeTests.GatewaySession_WithLiveWorker_Write2ValueWithTimestampToAdvisedItem
(in-process gateway, its own worker; the MxAccessGw service was untouched) on TestChildObject.TestInt:
| Worker | Sent | Stored | Result |
|---|---|---|---|
9ef6fc84 (fix) |
2026-11-13T01:46:31Z |
2026-11-13T01:46:31Z |
Passed |
9ef6fc84 with the conversion removed (negative control) |
2026-11-13T01:47:32Z |
2026-11-13T06:47:32Z |
Failed by exactly +5 h |
Both runs got OnWriteComplete Ok and restored the original value.