The poll loop skipped the STA hop while unsubscribed but its timer still woke
every interval (a Task.Delay timer plus a thread-pool continuation per tick on
every idle worker). It now parks on a semaphore while IsSubscribed is false and
is released by the handler's new SubscriptionActivated event; a subscribe that
races the park is kept by the semaphore count. While subscribed it never parks,
so failover polling and probes (MXA-001) are unchanged, and shutdown cancels a
parked loop like a sleeping one, so the MXA-003 join and grace bound hold. The
failure run resets when the loop parks.
UpdateAlarmWatchList rebuilt the standby: a second MXAccess registration, an
AddItem/Advise for every watched subtag, then an Unregister of the old source —
work proportional to the whole list for a one-alarm change (reproduced by the
previous commit's test). The subtag standby now takes the list as a diff:
added alarms' subtags are advised on the existing source, removed alarms'
subtags are unadvised, and unchanged alarms keep their advice and state.
The update stays all-or-nothing: the list is validated and the additions
advised before the swap, and an advise failure unadvises what it added and
keeps the previous list. A changed target starts fresh and is initialised from
the last delivered subtag values (acked/priority before active, MXA-007; bad
quality still ignored, MXA-005). LmxSubtagAlarmSource tracks an item from
AddItem so an Advise failure is retryable and removable.
The worker was started with CreateNoWindow and no redirection, so its log lines
went to a hidden console of its own and were lost under both a console run and
the NSSM service (verified on windev). The launcher now redirects both streams
and WorkerOutputCapture drains them: each line is forwarded under the
ZB.MOM.WW.MxGateway.Worker category at the worker's own level, the session
nonce is scrubbed, and the last 50 lines / 4 KB of stderr are kept. The drain
never waits on the logger (bounded drop-oldest queue) and ends at EOF when the
worker exits. A worker that exits before connecting (session factory race) or
that the probe finds already exited now fails StartupFailed with the stderr tail.
IWorkerClient gains MaxCommandBytes (the negotiated frame maximum less the
sequence-stamp allowance, the bound its CommandTooLarge pre-check uses).
GatewaySession passes it as a byte budget into SparseArrayExpander, which
charges a lower bound of each expanded array's encoding (default-valued slots)
before allocating, so an oversized sparse write - or a bulk command whose
sparse values together overrun the frame - is rejected with InvalidArgument
without the million-slot allocation.
The cached-success path already bypasses the limiter (SEC-002); this trims the
cache-miss success path and the per-call Task<T>. Check no longer builds the
(peer, key id) string when no peer partition exists, Reset skips the partition
clear in that case and reuses the check's composite for the verified mark, and a
disabled limiter's Reset does nothing. SEC-001/002/003 tests unchanged and green.
JS now reports when a submit raises its in-flight pending flag, and a cancel
request marks the same, so the next render clears pending through update()
without update() running on every snapshot tick. Escape still works after a
rejected submit.
Conflicts resolved:
- WorkerClient: keep the WRK-003 deadline-bound enqueue and carry the WRK-010 pre-computed
envelope size through both the TryWrite fast path and the slow path.
- AlarmsHub: prime each connection (DSH-005) and then count it for the idle-gated publisher
(DSH-009); a connection that fails priming is never counted, so never decremented.
- GatewayDashboardDesign.md: describe both.
- SEC-005: a lifecycle that ends keeps its cache as the previous
generation; the next lifecycle's first reconcile diffs against it and
broadcasts Clear for alarms gone during the gap (derived from the new
worker snapshot, documented in gateway.md as a reconcile repair, not a
synthesized event). The retired set is hidden from CurrentAlarms; gap
joiners get the whole set. Each lifecycle start broadcasts its
re-baselined provider status.
- SEC-006: live transitions stamp a sequence; a reconcile leaves alarms
changed live after it was issued alone (no stale Clear / re-raise).
- SEC-007: an Acknowledge of an uncached alarm is broadcast but no longer
inserts an ActiveAcked row; other non-Raise kinds do not touch the cache.
- SEC-009: a changed original raise time is a Raise repair; a non-OK
reconcile is logged/surfaced and fails the initial reconcile.
- SEC-008: watch-list resolution cached per Galaxy deploy time and
fingerprinted by SHA-256 once per resolution; refresh runs on its own
loop; the failover-edge refresh is bounded to 10 s.
- SEC-010: restart backoff doubles from 5 s to a 5 min cap and resets on
Monitoring; repeated identical faults log one summary line.
The publisher's single monitor subscription is primed once, normally
before any browser connects, so a later client saw only subsequent
transitions and never the standing alarms or provider status.
AlarmsHub.OnConnectedAsync now joins the group, sends the caller a
generation-0 AlarmFeedReset, then the status frames, active alarms and
snapshot_complete from a fresh subscription, redacted by ShowTagValues.
Hub tokens and cookies bounded only the handshake: an open hub socket kept its
connect-time roles and tag grants indefinitely, and a Blazor circuit never
revisited its sign-in. The hub-token ticket now carries the token expiry and the
hubs are mapped with CloseOnAuthenticationExpiration. Circuits use
DashboardRevalidatingAuthenticationStateProvider, which signs a circuit out past
the cookie's 8-hour idle lifetime or when a role it holds is no longer granted
by GroupToRole. LDAP membership changes and sign-out in another tab are still
only picked up at the age limit or on reconnect (documented).
A streaming call was authenticated only at open, and revoke/rotate/delete only
evicted the verification cache, so a leaked key's open StreamEvents/StreamAlarms
kept delivering after the revoke. The interceptor now registers every streaming
call by key id in ApiKeyStreamRegistry and gives the handler a call context
whose token also fires on revoke; the dashboard key actions call Revoke, and the
call ends with Unauthenticated.
System.Text.Json leaves a positional-record list parameter that is absent
from (or null in) the stored blob as null, so a sparse constraints row
threw NullReferenceException in HasReadConstraints/HasWriteConstraints and
handed the browse-scope provider a null scope. Deserialize now normalizes
every list to empty. Reproduced with a sparse-blob test first.
ReconcileIntervalSeconds must be 1..86400 when alarms are enabled (a huge
value faulted PeriodicTimer inside an unobserved task, silently ending
reconciliation); ReplayRetentionSeconds must be finite and at most a day
(Infinity passed startup and then threw in TimeSpan.FromSeconds on every
StreamEvents). A faulted reconcile loop is now logged and surfaced.
LmxSubtagAlarmSource now passes the OnDataChange quality through. The
subtag state machine ignores InAlarm/Acked updates that are not good
quality or carry no value instead of coercing them to false (which read
as a Clear). An Acked=true buffered before the first InAlarm value is
the initial state of an already-acked alarm and survives the raise.
A wnwrap primary whose Subscribe failed polls as a silent no-op, so the
failover counter reset and probes read as clean: failover never engaged
(threshold 3) or falsely recovered onto a dead primary (threshold 1).
FailoverAlarmConsumer now tracks whether the current primary subscribed;
an unsubscribed primary is replaced by a fresh instance from the consumer
factory and subscribed before it is polled or probed, and a failure there
counts. Without a factory it reports the original subscribe HRESULT.
- Dial/DialGalaxy set HTTP/2 keepalive (30 s / 10 s / PermitWithoutStream), configurable via
Options.KeepAliveTime/KeepAliveTimeout (CGO-001, D7)
- auth installed with chain interceptors and attached per call by Client/GalaxyClient (CGO-002)
- a server-sent Canceled status or a context deadline ends a stream with a terminal error;
only the caller's own cancellation is silent (CGO-003)
- stream context cancelled when the stream ends (CGO-004)
- dialConnected keeps the last connection error in the returned error (CGO-005)
- WatchDeployEvents closes events before errs; CLI drains buffered events (CGO-006)
- Register/AddItem/AddItem2 return MalformedReplyError on a payload-less reply (CGO-007)
- CLI batch reuses dialed connections; bench-read-bulk backs off on failures (CGO-008)
SEC-002: once a key id's cross-peer aggregate tripped, every request for it -
including the holder's cached ones - competed for one probe slot per interval,
so a spray of bad secrets against the public key id denied the key to its
holder. The interceptor and /metrics handler now serve a cached success before
consulting the limiter, and an address that verified the key in the window is
exempt from the aggregate on a cache miss.
SEC-003: Reset removed the aggregate on every success, so a key in steady use
never accumulated one. Success now clears only the caller's own partition; the
aggregate decays by window.
Also corrects the MetricsAuthenticationHandler remark left stale by SEC-001.
ServerCallContext.Peer carries the client's ephemeral source port, so every new
connection was a fresh limiter partition and a sprayer could reconnect before
reaching the limit. Both auth surfaces (gRPC interceptor, /metrics handler) now
derive the partition address through ApiKeyThrottlePeer, which strips the port
and reduces IPv4-mapped IPv6 to IPv4.
Routes.razor used RouteView, which ignores [Authorize]. With the interactive
router, an in-circuit navigation never meets endpoint authorization, so anonymous
localhost could open /alarms and a Viewer could open /admin/secrets (secret
metadata list). Both were confirmed reachable by the new route test before the
change; AuthorizeRouteView now renders a Not Authorized panel instead.