Commit Graph

1161 Commits

Author SHA1 Message Date
Joseph Doherty 97e4d96afa fix(grpc): check AddBufferedItem read constraints; fail closed on unclassified command kinds (SES-003, #242)
AddBufferedItem carries an item_definition but fell into the default branch of
ApplyConstraintsAsync, so a read-constrained key could add and advise an
out-of-scope tag. It now runs EnforceReadTagAsync. The switch also fails
closed: kinds are explicitly classified as constraint-checked or tag-free, any
other kind is refused with PermissionDenied and an audited denial, and a test
enumerates MxCommandKind so a new kind must be classified.
2026-12-03 09:41:50 -05:00
Joseph Doherty cf00f6fc86 fix(grpc): owner-scope Invoke and CloseSession like StreamEvents (SES-002, #241)
A foreign API key holding the matching scope could Invoke(DrainEvents) another
key's session (dequeuing its events), write through it, or close it. Invoke and
CloseSession now apply the same ordinal owner compare as the StreamEvents
attach and return PermissionDenied. No admin override (D2): operators use the
dashboard, which calls ISessionManager directly.
2026-12-03 09:40:41 -05:00
Joseph Doherty d12fd4f5a0 docs(plans): point the rollout plan at docs/WorkerEventPathPerformance.md 2026-12-03 09:36:39 -05:00
Joseph Doherty 8d1dd7f41d docs: add worker event-path performance analysis as docs/WorkerEventPathPerformance.md (D6, #236) 2026-12-03 09:36:36 -05:00
Joseph Doherty e934854a89 fix(worker): ReadBulk never tears down the caller's own item or advice (#238)
ReadBulk served a tag from the cache only when it was advised and cached;
every other tag took the AddItem + Advise + wait + UnAdvise + RemoveItem
snapshot lifecycle. If AddItem ever returned the caller's existing handle,
the teardown would unadvise and remove the caller's subscription.

ReadBulk now resolves a tag the session already holds to the session's
own item handle in phase 1:
- advised but uncached: wait on the caller's subscription for its first
  OnDataChange (baseline taken in phase 1, before any phase-2 pump can
  dispatch it); no COM call, no teardown.
- added but not advised: advise temporarily, then unadvise only; the item
  stays registered, and the value the temporary advice cached is dropped
  so it cannot later be served as was_cached = true.
- not held: unchanged snapshot lifecycle. An AddItem that returns a handle
  the registry already tracks is treated as the caller's (not
  re-registered, not removed).
Duplicate sharing, pump cadence, the shared deadline, timeout reporting
and was_cached semantics are unchanged.

Live repro on the windev rig (330 advised + 40 added-only tags, immediate
250-tag ReadBulk chunks x4 parallel, 60 s observation): unfixed and fixed
workers both keep 290/330 handles delivering. The 40 silent handles are
TestHistoryValue, which does not change within the window on either
build. The installed MXAccess hands out a distinct handle per AddItem
even for an address already added, and UnAdvise/RemoveItem of the second
handle leaves the first delivering. So the #238 teardown path does not
silence subscriptions on this MXAccess, and this change does not explain
the vd03 rate drop. The fix stays as a guard, and it saves an extra item
and four COM calls per uncached held tag.

Docs: gateway.md, Contracts.md, DesignDecisions.md,
MxAccessWorkerInstanceDesign.md and the five client ReadBulk doc comments.
2026-12-03 09:36:30 -05:00
Joseph Doherty 90d2d4a9b1 docs(deploy): DEV vd03 on 3be20983 (R1) then 9a4bc1df (R2); worker CPU 45% -> 0.3% of a core (#236) 2026-12-03 09:36:30 -05:00
Joseph Doherty 027d2b5d1a perf(gateway): read worker frames through a 64 KiB read-ahead buffer (#235)
The gateway read each frame with two exact reads, one for the 4-byte prefix and
one for the body, so every frame cost two pipe I/O completions and two
thread-pool wake-ups. WorkerFrameReader now reads as much as its buffer has
room for, so one read normally serves a whole frame or a batch of frames.

Length checks still run on the prefix before any payload allocation; frames
larger than the buffer are assembled in a pooled array; EOF anywhere reports
EndOfStream with an EndOfStreamException inner exception as before. New tests
cover multiple frames per read, frames split across reads, frames straddling
the buffer end, frames larger than the buffer, oversize frames with their body
buffered, and EOF in the prefix, body, large body and at a frame boundary.
2026-12-03 09:36:30 -05:00
Joseph Doherty 9b9fdecc9b perf(gateway): attach the dashboard mirror only while a viewer watches (#235)
Every session ran a dashboard-mirror distributor subscriber that woke for every
event only for Publish to discard it, since normally nobody has a
session-details page open. The viewer registry now raises
ViewerPresenceChanged on a session's first viewer and last viewer; the
production broadcaster exposes it as IDashboardViewerPresence, and a session
attaches its mirror while watched and disposes the lease when not.

MarkReady still starts the pump, so draining, replay retention, the alarm lease
and dead-worker detection are unchanged. ACL and value redaction are untouched.
Broadcasters without presence (test doubles) keep the always-on mirror.

Internal distributor subscribers can now pass a filter applied before the
pump's TryWrite; the alarm monitor admits only alarm transitions and provider
mode changes, so data changes no longer wake it.
2026-12-03 09:36:30 -05:00
Joseph Doherty 5516561084 perf(gateway): run the worker event hand-off inline instead of two pool hops (#235)
The staging channel and the worker event channel now allow synchronous
continuations, so an event moves from the pipe read loop through the event
writer into the distributor pump on one thread. At ~240 ev/s each removed pool
work item ended in a PortableThreadPool spin-wait.

Subscriber channels keep asynchronous continuations, so no gRPC, dashboard or
alarm consumer code runs on the read loop. A full event channel still parks the
writer on an await and returns to the read loop; both overflow faults, ordering
and replay behavior are unchanged. The queue-depth gauge now increments before
the staging write, since the consumer can decrement inside it.

Documented under 'Event path threading' in docs/GatewayProcessDesign.md.
2026-12-03 09:36:30 -05:00
Joseph Doherty d68d1c0a06 docs(plans): rollout plan for the worker/gateway event-path CPU fixes (#236, #235) 2026-12-03 09:36:30 -05:00
Joseph Doherty e811b93eb8 feat(worker,gateway): report record-info pin outcome in WorkerReady; drain-thread completion tests
The worker logged its MXSTATUS_PROXY record-info pin outcome only to its own
stderr, which the gateway's launcher does not capture, so operators never saw
whether the pin took.

- Contract (additive, internal IPC): WorkerReady.record_info_pin_status = 5.
  No protocol version bump; an older peer ignores it or sends it empty.
  Regenerated Contracts/Generated, the client protoset, the Rust vendored
  proto, and the Go/Python/Java worker bindings (real delta only).
- Worker: the handshake copies MxStatusProxyRecordInfoPin.Status into
  WorkerReady unless the runtime already set it.
- Gateway: WorkerClient records it (IWorkerClient.RecordInfoPinStatus, default
  null) and logs it at Information when pinned, Warning otherwise; empty is
  not logged. Shown as "Record-info pin" in the dashboard session details
  Worker table via DashboardSessionSummary.WorkerRecordInfoPinStatus.
- Tests: drain-thread cancellation (task ends Canceled; RunAsync cancels,
  runtime disposed, thread exits, no EventDrain stop-failure log) and fault
  (exception on the thread faults RunAsync with the same instance) paths;
  WorkerReady carries the pin status; gateway logging/recording and the
  dashboard projection.
- Docs: gateway.md STA thread model (drain thread, pin step in COM lifetime),
  MxAccessWorkerInstanceDesign, GatewayProcessDesign, GatewayDashboardDesign,
  WorkerFrameProtocol.
2026-12-03 09:36:30 -05:00
Joseph Doherty f6a3e13bd3 perf(worker,gateway): pin MXSTATUS_PROXY record info, dedicated event-drain thread, cap thread-pool spin
At ~240 events/s the worker burned 8-12% system CPU on wonder-app-vd03. A WPR
trace put 72% of it in lmxproxy's per-event GetRecordInfoFromGuids (type
library reload through the registry, amplified by WOW64 and the EDR registry
filter) and 26% in the .NET Framework thread pool spinning after each
per-event work item.

- Worker: MxStatusProxyRecordInfoPin holds the LMXProxy ITypeLib and the
  MXSTATUS_PROXY IRecordInfo for the process lifetime, so oleaut32 serves the
  per-event lookup from cache (~1 ms -> <1 us per call). Best-effort, never
  fatal; status logged at handshake.
- Worker: the event drain loop runs on a dedicated background thread with a
  synchronous wait and a synchronous pipe flush, removing the per-event
  thread-pool hops.
- Gateway: runtimeconfig sets ThreadPool.UnfairSemaphoreSpinLimit=10 to cut
  PortableThreadPool spin-wait CPU.

windev bench at ~242 ev/s: worker 67% -> 6.2% of one core; gateway 8.1% -> 6.9%.
Worker suite 785 passed / 14 skipped (x86, windev).
2026-12-03 09:36:30 -05:00
Joseph Doherty 75ddfa07a7 docs(review): record accepted decisions D1-D10 in the 2026-12-02 fix plan 2026-12-03 09:34:52 -05:00
Joseph Doherty fd26c22ec3 docs(review): link 2026-12-02 review findings and plan phases to #241-#257 2026-12-02 16:07:53 -05:00
Joseph Doherty f200bda605 docs(review): 2026-12-02 bug + performance review (99 findings) and fix plan 2026-12-02 16:06:56 -05:00
Joseph Doherty 54367e7408 docs(deploy): PROD mxgw — PAR alarms on Galaxy!NewJersey; all four on SQL login wwpdgdbro (ready 200, #60 not needed)
ci / windows-x86 (push) Successful in 1m55s
ci / java (push) Failing after 5m15s
ci / portable (push) Failing after 11m20s
Claude-Session: https://claude.ai/code/session_01GT67AD5mc2BnaaAfY3hqqQ
2026-11-22 12:06:22 -05:00
Joseph Doherty 256b5c1bfc deploy(prod): mxgw e74918cc on par-vp03/par-vp04 (site-par Connected; galaxy-sql waits on scadaproj#60)
Claude-Session: https://claude.ai/code/session_01GT67AD5mc2BnaaAfY3hqqQ
2026-11-22 12:06:22 -05:00
Joseph Doherty 08a9cfd68a docs(deploy): PROD vp03/vp04 first install e74918cc (vp04 Galaxy SQL access pending; alarms off; PAR held for WinPlatform)
ci / java (push) Failing after 4m21s
ci / portable (push) Failing after 8m55s
ci / windows-x86 (push) Failing after 21m56s
Claude-Session: https://claude.ai/code/session_01GT67AD5mc2BnaaAfY3hqqQ
2026-11-20 15:39:36 -05:00
Joseph Doherty 57d5b7c364 docs(deploy): DEV vd03 + QA vq03/vq04 on e74918cc, dashboard login on NAM AD
ci / java (push) Failing after 21m8s
ci / windows-x86 (push) Failing after 21m18s
ci / portable (push) Failing after 25m33s
Claude-Session: https://claude.ai/code/session_01GT67AD5mc2BnaaAfY3hqqQ
2026-11-19 16:21:31 -05:00
Joseph Doherty e74918ccfb ci: drop the nightly-windev schedule; run the deep windev tier on demand
ci / portable (push) Failing after 10m10s
ci / java (push) Failing after 20m12s
ci / windows-x86 (push) Failing after 22m40s
The scheduled nightly-windev job failed most nights for host reasons and
filed a Gitea issue each time. Remove the cron trigger and the job, and add
a workflow_dispatch trigger whose windev_mode input (test/build/live) drives
the windows-x86 job, so the live tier runs on demand - from the Actions page
or via scripts/ci/run-windev-ci.sh live - the same way clients are packed and
published on demand. Docs updated to match.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-15 09:42:13 -05:00
Joseph Doherty 26a90883fa Unify gateway styling and preserve identity through recovery
ci / java (push) Failing after 15m11s
ci / nightly-windev (push) Failing after 10m18s
ci / portable (push) Failing after 27m42s
ci / windows-x86 (push) Failing after 22m19s
2026-11-13 20:12:00 -05:00
Joseph Doherty b06921ce85 Lead gateway overview with readable fault context 2026-11-13 19:30:52 -05:00
Joseph Doherty c9a6c31cb8 feat(dashboard): make Galaxy browse and watch accessible 2026-11-13 18:19:08 -05:00
Joseph Doherty 5a1daab9ce test(dashboard): retain native pilot raw verification logs 2026-11-13 17:51:32 -05:00
Joseph Doherty 260d58afa1 fix(dashboard): pilot native dialog focus and safe dismissal 2026-11-13 17:51:02 -05:00
Joseph Doherty 3e004708d4 docs(ldap): windev runs Production on the shared GLAuth's LDAPS :3894 (#180)
ci / java (push) Failing after 15m34s
ci / nightly-windev (push) Has been skipped
ci / portable (push) Failing after 21m32s
ci / windows-x86 (push) Failing after 21m47s
windev's MxAccessGw now runs DOTNET_/ASPNETCORE_ENVIRONMENT=Production, with
DisableLogin removed and MxGateway:Ldap on Transport=Ldaps, Port=3894,
AllowInsecure=false and the GLAuth cert pinned by SHA-256. Record the env
change and the rollback, and update the stale "GLAuth has no LDAPS" text.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
2026-11-13 02:42:05 -05:00
Joseph Doherty 2cc0d57541 docs(deploy): QA vq03 + vq04 on 76a71bc8, #228 verified live on both (#229, #170)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 2m29s
ci / java (push) Failing after 9m20s
ci / portable (push) Failing after 16m20s
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
2026-11-12 23:48:17 -05:00
Joseph Doherty 9e4be25807 test(live): capture OperationComplete trigger, subtag Clear and status rows on windev (#210, #211)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 2m23s
ci / java (push) Failing after 7m49s
ci / portable (push) Failing after 16m36s
Live MXAccess captures against the windev DEV Galaxy, recorded in
docs/LiveCaptures-2026-11-13.md:

- OperationComplete follows a Suspend/Activate whose synchronous MxStatus is
  Pending (advised, resolved item); one Ok row from RespondingLmx. Pinned by
  the new OperationCompleteLiveProbeTests live fact, with an
  unresolved-reference negative control. (#211 §3.1)
- No public COM event carries completion-only status bytes. All 71
  completions were typed MXSTATUS_PROXY[], so they stay raw permanently.
  (#211 §3.3)
- Subtag-mode Clear is drivable: the TestAlarm UDAs are MxSecurityOperate,
  so AuthenticateUser + WriteSecured toggles them. The new self-driven
  LiveSubtag_SelfDrivenRaiseThenClear_SynthesizesClear fact asserts the
  UnackAlm -> UnackRtn Clear (mutation-checked). (#210 §3.7)
- The B8 buffered "NoData bootstrap" is a ConfigurationError resolution
  failure (detail 6 / 1002). The DEV Galaxy has no buffered attribute, so a
  multi-sample capture needs IDE work. provider_switches was not driven. (#210)
- Status-row catalogue for lmxopcua#872: no Warning row seen, and Pending
  only on the synchronous Suspend/Activate return.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
2026-11-12 23:34:46 -05:00
Joseph Doherty 4890a3d16e fix(deploy): Upgrade-MxGatewayService.ps1 safe on the wonder layout, guards fail closed (#230)
ci / windows-x86 (push) Successful in 2m41s
ci / nightly-windev (push) Has been skipped
ci / portable (push) Failing after 12m34s
ci / java (push) Failing after 14m50s
The process guards matched only ZB.MOM.WW.MxGateway.*; the wonder boxes run
MxGateway.Server.exe / MxGateway.Worker.exe, so the one-gateway guard, the
pre-start OrphanWorkerTerminator guard and the STOP_PENDING kill passed vacuously.

- Image names come from the installed exes (NSSM Application, Worker env path) plus
  both known schemes; processes are also matched by exact path (Win32_Process).
- One-gateway guard fails closed: a RUNNING service whose gateway is not visible, at
  the Application path, as the service host's child, is an abort.
- STOP_PENDING kill is scoped to this install's processes.
- Staged checks use the installed exe names; staged Worker must be x86; a staged
  self-contained runtime older than the live one is refused (-AllowRuntimeDowngrade).
- Carry-over: appsettings*.json and certificates/keys (dashboard.pfx) always keep the
  live copy; other live-only non-binary top-level files are carried; hash-verified.
- Env block read from the registry and fingerprinted (names + SHA-256 prefixes, never
  values) after stop, swap, start and the stability window; any change aborts.
  Sensitive values are redacted from all output and notes.
- File-based master key (vd03) accepted and backed up; a missing env master key
  (windev) is a warning. Backup dir is ACL-restricted before anything is written.
- Rollback accepts .bak-<stamp> and .bak.<yyyyMMddTHHmmss> sets and refuses a
  mixed Server/Worker stamp; auto-rollback no longer fails on the old SHA.
- -WhatIf now works on Windows PowerShell 5.1 (Get-FileHash returned nothing under
  WhatIfPreference); an empty Win32_Service result no longer reads as "unavailable".
- Install-MxGatewayService.ps1 process guard matches both schemes.
- Dry-run harness scripts/deploy/tests (fake box in both layouts, 140 assertions,
  passes on pwsh/macOS and Windows PowerShell 5.1) plus a mutation runner (12/12 killed).
- Runbook updated.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
2026-11-12 22:23:19 -05:00
Joseph Doherty 453fe01525 chore(deps): ZB.MOM.WW.Telemetry(.Serilog) 0.3.0 -> 0.3.1 (scadaproj#56)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 2m25s
ci / java (push) Failing after 22m3s
ci / portable (push) Failing after 22m28s
0.3.1 stops the gRPC/HttpClient instrumentation tracing telemetry's own
OTLP export calls (the Serilog log sink's LogsService/Export spans).
The app's own outgoing gRPC/HTTP spans are unchanged.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
2026-11-12 22:16:31 -05:00
Joseph Doherty d9d9ff489b feat(telemetry): Telemetry 0.3.0 - service.version, site.id/node.role, logs over OTLP (scadaproj#55)
ci / java (push) Failing after 11m45s
ci / windows-x86 (push) Successful in 3m47s
ci / portable (push) Failing after 26m59s
ci / nightly-windev (push) Failing after 14m4s
Pins ZB.MOM.WW.Telemetry(.Serilog) 0.1.0 -> 0.3.0. AddZbTelemetry now reads the whole
MxGateway:Telemetry section through the shared ApplyConfiguration: node.role defaults
to "standalone" (one gateway per box), MxGateway:Telemetry:SiteId / :NodeRole /
:ServiceVersion / :ResourceAttributes:* are operator keys, and service.version
defaults to the entry assembly's informational version (the git SHA). With
MxGateway:Telemetry:Exporter=Otlp the Serilog logs go to the same collector too.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
2026-11-12 21:24:39 -05:00
Joseph Doherty 31f7f9fc6e docs(deploy): DEV vd03 on 76a71bc8, Worker time fixes #226 + #228 verified live (#229)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 2m19s
ci / portable (push) Failing after 24m22s
ci / java (push) Failing after 24m39s
Server and x86 Worker from 76a71bc8 on wonder-app-vd03, about 9 s downtime, env block and
pepper prefix unchanged. Write2 KeepsSentTimestamp passes; RuntimeAlert reads
2026-07-28T20:02:46.830Z. QA still pending (#170). Upgrade-script gaps filed as #230.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
2026-11-12 21:23:40 -05:00
Joseph Doherty 76a71bc82d docs(deploy): pending DEV-then-QA deploy note for the Worker time fixes #226 + #228
ci / windows-x86 (push) Successful in 2m28s
ci / nightly-windev (push) Has been skipped
ci / java (push) Failing after 9m56s
ci / portable (push) Failing after 17m29s
Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
2026-11-12 20:59:45 -05:00
Joseph Doherty 9ef6fc8489 fix(worker): send the Write2/WriteSecured2 time argument as box-local time (#228)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 2m28s
ci / portable (push) Failing after 16m55s
ci / java (push) Failing after 17m47s
MXAccess reads the VT_DATE time argument of Write2, WriteSecured2 and their
bulk forms as box-local time and converts it to UTC itself. The worker passed
the proto Timestamp's UTC clock fields (the COM marshaler ignores
DateTime.Kind), so on vd03 (UTC-5) a Write2 sent at 01:33:00Z was stored at
06:33:00Z.

VariantConverter.ConvertToComTimestamp converts a timestamp_value instant with
TimeZoneInfo.ConvertTimeFromUtc into the worker's zone (TimeZoneInfo.Local by
default, DST included; an injectable zone for tests). The executor uses it for
the time argument only: value conversion is unchanged, and the read direction
(MXAccess reports UTC; ToTimestamp treats it as UTC) is unchanged. The one
residual loss is MXAccess-side: the repeated fall-back hour cannot be told
apart in an offset-less VT_DATE.

Tests: VariantConverterTimestampTests (UTC-5, US-Eastern DST both edges,
UTC+05:30, UTC, fall-back ambiguity, value path unchanged); the four executor
forwarding tests inject a fixed UTC-5 zone; the windev live Write2 smoke now
sends a past whole-second timestamp and asserts the stored one when applied.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
2026-11-12 20:49:41 -05:00
Joseph Doherty 7481b95905 test(live): prove Write2 applies a value via supervisory advise on DEV (#212)
ci / nightly-windev (push) Has been skipped
ci / portable (push) Failing after 7m54s
ci / windows-x86 (push) Failing after 10m16s
ci / java (push) Failing after 10m17s
On the DEV gateway (wonder-app-vd03, 2b13564e), Write2 after
AdviseSupervisory applied the value to MESReceiver_025.MoveInBatchID
(0 -> 212212, OnWriteComplete Ok), and the value was restored to 0. After a
plain Advise, the same Write2 got SecurityError/1008, which is exactly what
the windev run saw. So that refusal came from the plain advise. It does not
show that windev has no writable attribute.

- Client.Tests: add the opt-in LiveGatewayWrite2Tests (gated by
  LiveGatewayWriteFact: endpoint, key file and write item env vars). It runs
  supervisory advise -> Write2 -> readback -> restore. The value test passed
  live on vd03. The timestamp-parity test needs a second opt-in; it fails on
  a non-UTC host until #228 is fixed.
- IntegrationTests: the windev Write2 smoke now uses AdviseSupervisory and
  restores the original value. It has not been re-run on windev.
- GatewayTesting.md: document the env vars. code-reviews IntegrationTests-033:
  correct the "no writable attribute" limit.

The run also found that the Write2 timestamp is read as host-local time
(stored +5 h on the UTC-5 box); filed as #228.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
2026-11-12 20:40:46 -05:00
Joseph Doherty ebbfaa4c03 docs(tests): IntegrationTests-033 resolved: Write2 live smoke passed on windev (#212)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 2m2s
ci / java (push) Failing after 4m44s
ci / portable (push) Failing after 9m25s
Ran the Write2 live smoke on windev against origin/main 04a40f2c (x86 Release
worker, item TestChildObject.TestInt). It passed: Ok, hresult 0, and a matching
OnWriteComplete. MXAccess reported SecurityError/1008 on the completion, which
is the Galaxy refusing an unauthenticated write; plain Write got the same
status and the value did not change. Corrected the test comment that said the
reply meant the write succeeded.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
2026-11-12 20:26:33 -05:00
Joseph Doherty 04a40f2c1a docs(deploy): vd03 API-key pepper moved into the service environment (#171)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 1m50s
ci / java (push) Failing after 4m55s
ci / portable (push) Failing after 11m17s
Record of the 2026-11-12 config-only change on wonder-app-vd03: MxGateway__ApiKeyPepper
added to the MxAccessGw AppEnvironmentExtra block (same value, sha256 prefix match),
removed from Server\appsettings.json; authenticated round-trip with a pre-change key,
ScadaBridge MxGateway link unchanged. Runbook and configuration doc now say where the
pepper lives on each wonder box.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
2026-11-12 19:49:42 -05:00
Joseph Doherty 447070a532 chore(clients/dotnet): bump Contracts + Client 0.3.0 -> 0.4.0 for publish (#227)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Failing after 1m34s
ci / java (push) Failing after 2m33s
ci / portable (push) Failing after 3m39s
Ships the opt-in stream-attached acknowledgement (afd504d5) so OtOpcUa
can adopt it (lmxopcua#877). Published to the Gitea feed 2026-11-12.
2026-11-12 07:32:01 -05:00
Joseph Doherty afd504d5ae feat(events): opt-in stream-attached acknowledgement on StreamEvents (#227)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 1m28s
ci / java (push) Failing after 2m21s
ci / portable (push) Failing after 3m33s
A fresh StreamEvents is never replayed, so an initial value published before
the gateway registers the stream's subscriber is lost (lmxopcua#865 —
slow-changing ScanState). Clients had nothing deterministic to wait on.

Contract (additive, proto3):
- StreamEventsRequest.emit_stream_attached = 3 (bool, default false)
- MxEvent.stream_attached = 15 (optional StreamAttached)
- message StreamAttached { uint64 live_after_sequence = 1; }
- OpenSessionReply capability "stream-events-attached-ack"
  (GatewayCapabilities.StreamEventsAttachedAck)

When requested, EventStreamService yields the sentinel as the FIRST message,
after AttachEventSubscriber/AttachEventSubscriberWithReplay has returned, so
receipt implies registration; refused attaches never see it. It precedes the
ReplayGap sentinel and replay on a resume. Shape mirrors ReplayGap: family
UNSPECIFIED, no body, worker_sequence 0.

Opt-in rather than always-on: ScadaBridge's MxGateway adapter stores every
streamed event's worker_sequence as its resume cursor, so an unrequested
sentinel would reset it to 0. Default wire behaviour is unchanged.

.NET client: StreamEventsAsync/StreamEventItemsAsync(after, emitStreamAttached),
MxEventStreamItem.IsStreamAttached, MxGatewaySession.SupportsStreamAttachedAck,
and OpenEventStreamAsync -> MxGatewayEventStream (awaits the sentinel, with
attach timeout; refuses older gateways).

Regenerated Contracts/Generated, the client protoset, Go and Python bindings
(also picks up comment-only drift already on main), synced the Rust vendored
proto and set emit_stream_attached in the Rust StreamEventsRequest literals.
No package versions bumped.

Tests: ordering (sentinel first, then events), race proof (event fanned right
after the sentinel is delivered — mutation-checked: fails when the sentinel is
yielded before registration), resume-with-gap order, refused attach emits no
sentinel, default emits none, contract field numbers, capability, and .NET
client wire tests (await, no-capability, older gateway, timeout).
2026-11-12 07:27:17 -05:00
Joseph Doherty 892bdc1a19 fix(worker): wnwrap alarm DATE+TIME are UTC; stop re-applying GMTOFFSET (#226)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 1m26s
ci / java (push) Successful in 2m28s
ci / portable (push) Failing after 3m38s
QueryActiveAlarms / alarm transitions reported every wnwrap alarm late by
the record's GMTOFFSET-DSTADJUST: ParseTransitionTimestampUtc treated the
XML DATE+TIME as producer-local and added the offset, but the fields are
already UTC. DEV evidence: RuntimeAlert raise EventTimeUtc 2026-07-28
20:02:46.830 (EventTimeUTCOffsetMins -300) surfaced as 2026-07-29
01:02:46.830Z. The 2026-05-01 probe capture (TIME 13:26:14.709,
GMTOFFSET 240) was committed at 09:44 EDT, so its TIME is UTC too.

GMTOFFSET/DSTADJUST are no longer read. Tests updated + #226 regressions.
2026-11-12 07:20:44 -05:00
Joseph Doherty 2b13564e04 feat(ldap): pin the LDAP server certificate by SHA-256 thumbprint (#180)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 1m26s
ci / java (push) Successful in 2m15s
ci / portable (push) Failing after 4m19s
New optional MxGateway:Ldap:ServerCertificateThumbprintSha256 (hex SHA-256
of the DER cert; case/colon/dash/space-insensitive; comma/semicolon-separated
string or array, so a rotation can carry old + new). When set, the dashboard's
shared LDAP provider gets a RemoteCertificateValidationCallback via
LdapOptions.ServerCertificateValidationCallback (Auth 0.4.1) that accepts the
server certificate iff its thumbprint matches a pin, ignoring chain/name
errors only then. Unset keeps default OS trust-store validation untouched.

The callback is an init-only, code-only property, so the ILdapAuthService
registration from AddZbLdapAuth is replaced with one built from the bound
options plus the callback. Pins are read straight from configuration because
the binder silently binds the scalar form onto a list as empty.

GatewayOptionsValidator rejects a pin that is not 64 hex chars after
normalization and any pin with Transport=None; the Production hard stops are
unchanged. Pins are shown on the Settings page. Docs: GatewayConfiguration.md,
glauth.md.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
2026-11-10 11:52:14 -05:00
Joseph Doherty 9c6ac0cdbc test(integration): live Write2 round-trip with timestamp (#212, IntegrationTests-033)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 1m28s
ci / java (push) Successful in 2m15s
ci / portable (push) Failing after 4m20s
Opt-in [LiveMxAccessFact] mirroring the Write round-trip: Register/AddItem/
Advise, then Write2 with a VT_DATE timestamp value; asserts Ok + Write2 kind
and a matching OnWriteComplete. Skips without the live MXAccess env.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
2026-11-10 11:02:22 -05:00
Joseph Doherty 53562ddc17 fix(worker): unregister-first shutdown cleanup order, guarded + logged (#175, R21-K10)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 1m32s
ci / java (push) Successful in 2m21s
ci / portable (push) Failing after 4m30s
ShutdownGracefully now Unregisters every server handle first (MXAccess drops its
items and advise subscriptions with it). Only for a server whose Unregister fails
does the UnAdvise -> RemoveItem fallback run. Each step is guarded, logged at Debug,
and the method is idempotent. #176 (AuthenticateUser cache) is unaffected.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
2026-11-10 04:26:55 -05:00
Joseph Doherty ace12f81ad build(deps): bump ZB.MOM.WW.Auth 0.3.0 -> 0.4.1 (scadaproj#5)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 1m27s
ci / java (push) Successful in 2m44s
ci / portable (push) Failing after 4m59s
Auth 0.4.1 (BindMode stays ServiceAccount; empty password now refused in the library too; Username canonicalised from UserNameAttribute). No API breaks, no test changes needed.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
2026-11-09 18:16:27 -05:00
Joseph Doherty e1656f214b build(deps): bump ZB.MOM.WW.Theme 0.4.1 -> 0.5.0 (scadaproj#9)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 1m27s
ci / java (push) Successful in 2m30s
ci / portable (push) Failing after 5m10s
Mobile shell fix: closed navigation no longer hides page content.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
2026-11-09 15:48:16 -05:00
Joseph Doherty 7a7ef3b89f fix(config): align GatewayConfigPathRules with Secrets-005 (symlinks, drive-relative, device/loopback/local-share spellings) (scadaproj#52)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 1m30s
ci / java (push) Successful in 2m17s
ci / portable (push) Failing after 4m20s
Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
2026-11-09 15:40:32 -05:00
Joseph Doherty 477fa55998 feat(deploy): on-box NSSM upgrade/rollback and new-box install scripts, runbook updated (mxaccessgw#220)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 1m26s
ci / java (push) Successful in 2m12s
ci / portable (push) Failing after 4m11s
Add scripts/deploy/Upgrade-MxGatewayService.ps1 (preflight, stop with STOP_PENDING handling,
backup, Server+Worker swap, start, /health/ready + SHA verify, auto/manual rollback,
one-gateway guard, never touches the NSSM env block) and Install-MxGatewayService.ps1
(service install, restart/recovery settings, env block). Both support -DryRun/-WhatIf.
Dry-run validated on macOS pwsh against a fake layout; untested on a real box.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
2026-11-09 15:10:26 -05:00
Joseph Doherty 259d375022 feat(audit): stamp CorrelationId on dashboard API-key admin audit events (mxaccessgw#213)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 1m29s
ci / java (push) Successful in 2m13s
ci / portable (push) Failing after 4m12s
CanonicalForwardingApiKeyAuditStore now derives CorrelationId from the ambient
request: Activity.Current trace id, else the HTTP request TraceIdentifier
(GUID used verbatim, otherwise hashed to a stable GUID) via an optional
IHttpContextAccessor. The CLI path has neither and stays null. Auth library
unchanged (option b).

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
2026-11-09 15:04:03 -05:00
Joseph Doherty fccc21ba8e feat(events): distinguish ResourceExhausted causes with an mxgw-reason trailer (mxaccessgw#216)
Event-queue overflow, alarm-feed overflow, subscriber cap, session limit and
oversized commands all surfaced as ResourceExhausted. The status code is
unchanged; the gateway now attaches a machine-readable `mxgw-reason` trailer
(constants in Contracts ResourceExhaustedReasons). The .NET client maps
ResourceExhausted to MxGatewayResourceExhaustedException (an
MxGatewayException subclass; additive) exposing Reason/IsOverflow/
IsSubscriberLimit. Documented in docs/ClientBehaviorFixtures.md; the other
clients get a doc note only.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
2026-11-09 15:02:24 -05:00
Joseph Doherty 716c845fc7 build(server): bump Microsoft.Data.Sqlite to 10.0.13 with SQLitePCLRaw.lib.e_sqlite3 2.1.13 (mxaccessgw#225)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 1m28s
ci / java (push) Successful in 2m8s
ci / portable (push) Failing after 4m9s
Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
2026-11-09 14:21:21 -05:00