AUD-2: drop Cache=Shared from the file-backed site audit connection string
(kept only by the in-memory test override). Two private WAL connections no
longer share table-level locks.
Test OpenReadTransaction_DoesNotStallTheWriter (deferred read txn open on a
connection with the writer's connection string): with Cache=Shared the
write timed out (>5 s; would retry to the 30 s command timeout and fault);
without it the write completes in well under 1 s.
AUD-3: new partial index IX_fwd_owed (OccurredAtUtc, EventId) WHERE
ForwardState IN (owed states); ReadPendingSinceAsync names it (INDEXED BY),
repeats the literal state list (bound parameters never satisfy a partial
index's WHERE), and orders/keysets on fs.EventId (same value, no join for
the sort).
sqlite3 3.54, 1,000,000 audit rows (90% Pending), no ANALYZE stats, 256-row page:
before: SEARCH fs USING INDEX IX_fwd (ForwardState=?) + TEMP B-TREE FOR ORDER BY; 2.6-3.5 s
after: SEARCH fs USING INDEX IX_fwd_owed (OccurredAtUtc>?), no sort; 0.6-0.7 ms
(keyset page with afterId: 3.6 s -> 0.6 ms)
AUD-4: purge page adds IsCachedKind IN (0, 1) so IX_fwd seeks
(state, kind, age).
same DB, 100k Forwarded rows, nothing expiring (the final short page):
before: SEARCH IX_fwd (ForwardState=?) 16.9 ms (linear in retained rows)
after: SEARCH IX_fwd (ForwardState=? AND IsCachedKind=? AND OccurredAtUtc<?) 0.06 ms
AUD-7: new optional Commons IOperationTrackingBatchReader (separate interface
so test doubles/implementations are untouched); OperationTrackingStore
implements GetStatusManyAsync (one writer-queue barrier, chunked IN reads on
one connection). SiteAuditTelemetryActor resolves a drain's distinct ids with
one batched read when available, else memoises per-id reads per drain.
A BatchSize-256 drain: 256 sequential barriers + 256 connections -> 1 barrier,
1 connection, 1 query (ids sharing an operation are read once).
The fair-paging sweep computed ROW_NUMBER() over every column of every due
row, so each sweep sorted the whole due backlog with payloads into temp
storage. The ranking now projects only id + lane keys over the new covering
idx_sf_messages_lane (status, category, target, created_at,
last_attempt_at_ms, retry_interval_ms, id), takes the page of ids, and joins
back by primary key. The index is created in place by StoreAndForwardSchema
(idempotent, local only — not part of CDC capture). idx_sf_messages_category
is kept (still used by parked-count filters).
EXPLAIN QUERY PLAN + timing, sqlite3 3.54, 200,000 due rows x ~1 KB payload,
20 targets x 3 categories, LIMIT 500:
before: SEARCH idx_sf_messages_status_created (status=?) + USE TEMP B-TREE
FOR ORDER BY (window over full rows) + outer temp b-tree; 1.29 s
after: SEARCH USING COVERING INDEX idx_sf_messages_lane (no window sort),
outer temp b-tree over (id, rank, created_at) only, PK join of 500
rows; 0.15 s
SRT-7: TriggerExpressionKeys extracts the literal Attributes["k"] /
Children["c"].Attributes["k"] reads of an Expression trigger; the Instance
Actor routes the child only those attributes (new MonitoredAttributes routing
kind). Anything not pinnable (non-literal key, alias/member access of the
globals, Parent, parse error, zero reads) falls back to all-changes. Child
actors are unchanged (narrow: WP3 edits ScriptActor/AlarmActor).
Evidence: instance with 250 attributes at 1 Hz and 10 expression children
each reading 2 attributes — child mailbox deliveries (and per-eval snapshot
copies + CTS allocations) go from 2,500/s to 20/s (routing-map test pins
that a non-read attribute has no route).
SRT-14: EnforceCap selects the oldest conditions with a bounded max-heap and
rate-limits the eviction Warning (1/min with an eviction count).
Stopwatch, n=1001 k=1 per transition at the cap: OrderBy 13.0-18.2 us -> heap 1.2 us.
CMN-11: FlowShapePredictor looks up a node by the index encoded in its
append-only id (O(1)) instead of a linear scan per AddNode/Annotate.
Stopwatch PredictSiteScript, Release: 5,000 nodes 125.5 -> 54.9 ms,
20,000 nodes 434.2 -> 83.3 ms.
Mirror of mxaccessgw#237 (659bb831). DEV vd03 showed 229k context switches
in ZB.MOM.WW.ScadaBridge.Host at ~240 MxGateway events/s. Akka's default
dispatcher, gRPC/Kestrel and async continuations all run on the .NET thread
pool, so a trickle of small work items makes idle pool workers spin with
Sleep(0) (default limit 70) before parking.
- Host csproj: RuntimeHostConfigurationOption
System.Threading.ThreadPool.UnfairSemaphoreSpinLimit=10, written into
ZB.MOM.WW.ScadaBridge.Host.runtimeconfig.json (verified in the publish
output, which docker/Dockerfile copies into the image).
- RuntimeConfigTests pins the value in the built runtimeconfig.
- Component-Host.md: new "Runtime thread-pool settings" section (what, why,
override/revert via DOTNET_ThreadPool_UnfairSemaphoreSpinLimit).
Local synthetic trickle bench (macOS, ~185 chains/s): involuntary context
switches 17-28k -> 6-13k, CPU 430-560 -> 200-295 ms per 20 s. The vd03
before/after WPR measurement is pending the next vd03 deploy.
OtOpcUa now exposes conditions imported over gRPC data connections in the
namespace https://zb.com/otopcua/mapped/conditions. Their ConditionId is
an opaque c1. NodeId stable for the life of the connection, but their
SourceName (<anchor>/<placement path>) moves when the primary placement
mapping changes. ScadaBridge keyed every condition on
SourceName.ConditionName, so a mapping change read as one alarm clearing
and a new one raising.
- Event filter selects ConditionId (select clause 19: ConditionType,
empty browse path, AttributeId = NodeId).
- When the ConditionId (or SourceNode, which OtOpcUa sets to it) is in the
mapped/conditions namespace, the per-condition key is its durable
nsu=... string (index-proof across an OtOpcUa pair / upgrade). Every
other OPC UA condition keeps the SourceName.ConditionName key, so no
existing persisted row, MES script or operator view is re-keyed.
- The old SourceName.ConditionName text becomes an additive, display-only
DisplayName: NativeAlarmTransition -> AlarmStateChanged ->
AlarmStateUpdate.display_name (26) / DebugAlarmStateDto.display_name
(22) -> ScriptAlarm.DisplayName. Persisted in native_alarm_state
metadata_json (no column, no CDC trigger change); updates in place on
every transition under the fixed key. Protos regenerated.
- Alarm Summary and Debug View show DisplayName (key as tooltip) and
filter on it; site event log writes "label [key]".
- Upgrade: a pre-#147 row for an imported condition is retired by the
first completed refresh snapshot (one return-to-normal + drop), then the
condition continues under its ConditionId.
Tests: RealOpcUaImportedConditionKeyTests, OpcUaAlarmMapperTests,
NativeAlarmActorTests (DisplayName, rehydration, legacy-row retirement),
StreamRelayActorTests, SiteCommand golden sample, AlarmsAccessorTests,
DebugTreeBuilderTests; filter select-clause count 19 -> 20.
Docs: Component-DataConnectionLayer/Commons/Communication/SiteRuntime.
OtOpcUa now emits RefreshRequiredEventType (SourceNode = Server, no
condition fields) on an incomplete condition snapshot, a removed imported
condition, or a resync that leaves pre-failover EventIds answering
BadEventIdUnknown. RealOpcUaClient had no branch for it: the event fell
through HandleAlarmEvent as a phantom condition keyed "Server" and no
refresh was issued, so the mirror could hold stale / un-ackable state.
- HandleAlarmEvent recognises RefreshRequiredEventType, emits nothing, and
hands the item's handle to the new ConditionRefreshCoalescer.
- The coalescer runs off the SDK publish thread, debounces 500 ms so a
burst (one event per affected item) costs one refresh, never overlaps
refreshes (a request during an in-flight refresh is served by the next),
logs and swallows failures, and is cleared on disconnect.
- Execution: targeted ConditionRefresh2(eventSubscription, item) per asking
item; one subscription-wide ConditionRefresh when every live alarm item
asked, an item has no server id, or ConditionRefresh2 fails. The replay is
the usual RefreshStart/End frame, so NativeAlarmActor's snapshot swap
clears conditions the refreshed snapshot no longer lists.
- The server-side OfType WhereClause built from a condition filter now ORs
in OfType(RefreshRequiredEventType): the server queues RefreshRequired
through the item's filter, so a bare condition-type clause dropped it.
Tests: RealOpcUaRefreshRequiredTests (branch, no-session tolerance, burst
coalescing, no overlap, failure tolerance, Clear, framing intact);
RealOpcUaClientAlarmFilterTests updated for the added operand.
Component-DataConnectionLayer.md documents the behaviour.
The Test Run banner in TemplateScriptDialog and SharedScriptForm claimed
External, Database and Notify all fire for real ("real emails"). Notify
is SandboxNotifyTarget, which returns a random GUID and sends nothing.
The banner now says External/Database are real and Notify is simulated,
pointing at Flow Debugger on a deployed instance for a real send. The
sandbox Send also writes a [sandbox] ... not delivered line to the
console pane. Notify.Status is unchanged (reports Unknown). Tests pin
the banner wording and the console line; Component-CentralUI.md notes
the simulated Notify.
The semantic validator treated each comma-separated argument after the
script name as a positional parameter and required the count to equal the
declared ParameterDefinitions. The runtime has no positional form: both
calls take ONE parameters object that ScriptArgs.Normalize turns into a
name -> value dictionary, so every Scripts.CallShared("X", new { ... })
was rejected unless exactly one parameter was declared, blocking deploy.
Call sites are now found with a Roslyn script-mode syntax parse (named
arguments and a trailing CancellationToken handled; calls in comments or
strings ignored). The parameters argument is classified as:
- anonymous object: validated by name (ordinal) - missing required
parameter = error, undeclared member = warning, clear literal type
mismatch per member = error (same conservative inference as before);
- any other expression (variable, dictionary, call, null): not checked;
- absent: error only if the target declares required parameters.
Required-ness comes from the shared InboundApiSchema parser (JSON Schema
'required' list; legacy array entries required unless required:false).
Positional-argument tests replaced by by-name CallShared/CallScript tests;
Component-TemplateEngine.md updated.
SmtpConfiguration.MaxRetries/RetryDelay (and ConnectionTimeoutSeconds/
MaxConcurrentConnections) drive the outbox Email policy but had no write
path, so every row sat at 0/0 and was clamped with a Warning; DEV vd03 had
to be fixed by direct SQL.
- Update/CreateSmtpConfigCommand: four trailing additive nullable fields
(null = preserve on update / entity default on create; 0 = fallback).
- ManagementActor: preserve-if-null, negatives refused.
- CLI notification smtp create|update: --max-retries, --retry-delay-seconds,
--connection-timeout-seconds, --max-concurrent-connections (>= 0).
- Central UI /notifications/smtp: fields on the form + read-only panel;
new rows pre-fill 10 retries / 60 s.
- README + Component-NotificationService; tests for apply/preserve/reject.
Component-Security "No role, no login": replace the "HTTP Basic is not covered
yet" note with the Basic and Bearer behaviour, the throttle and log details;
bearer section notes a role-less token is refused. Component-CLI: a zero-role
user sees the bad-password 401. Component-ManagementService: 401 covers it.
CLAUDE.md Security & Auth bullet updated.
Claude-Session: https://claude.ai/code/session_01GT67AFKC45MBz1wPZnVbX8
The mid-session refresh ended a session only when the directory returned no
groups (or the user was gone/disabled/ambiguous). A user still in some groups
but in no mapped one, or whose DB mappings were all revoked, kept a signed-in,
role-less session that could read the bare-[Authorize] pages. CookieSessionValidator
now rejects when the re-map yields zero roles, on ordinary and fail-closed paths.
A mapper fault keeps its existing policy (keep grants; fail closed when asked).
Docs: Component-Security "No role, no login" (incl. the HTTP Basic gap left as a
follow-up), Component-CentralUI, CLAUDE.md.
Claude-Session: https://claude.ai/code/session_01GT67AFKC45MBz1wPZnVbX8
SplitBrainResolverStrategy now defaults to leader-auto-down (the in-repo
LeaderAutoDowningProvider, #106, with the #132 shut-out restart on). auto-down and
keep-oldest stay supported. Drilled on the docker rig, docker-env2 and the QA pair
(central + site, kill and stop-and-hold) before the flip.
- ClusterOptions default + validator/HOCON comments updated.
- Shipped Host appsettings.Central/Site.json and every docker/ and docker-env2/
node appsettings now say leader-auto-down. The leader-auto-down overlays are
kept as no-ops (drill records reference them); new docker-compose.auto-down.yml
overlays keep Akka AutoDowning available for comparison drills.
- Tests: default asserts leader-auto-down; new HOCON test for an unset strategy;
TwoNodeClusterFixture defaults to the production posture.
- Docs: CLAUDE.md, Component-ClusterInfrastructure, components/Host + Cluster,
README, failover procedures, Traefik, docker + env2 READMEs; register row 70 closed.
No deploy needed: DEV, QA and both rigs set the key explicitly.
Claude-Session: https://claude.ai/code/session_01GT67AFKC45MBz1wPZnVbX8
One key per file: ScadaBridge:Cluster:SplitBrainResolverStrategy auto-down ->
leader-auto-down in appsettings.Central.json and appsettings.Site.json, build
061432c8 unchanged. G6 boot lines on both services, health 200, MxGateway and
Z28062 at baseline, bogus key 401, Overview 6/6 Up. Downtime ~23 s central,
~30 s site. No drill: single-node clusters.
Claude-Session: https://claude.ai/code/session_01GT67AFKC45MBz1wPZnVbX8
vq04 (active central) killed with SCM auto-restart disabled and held down 94 s:
UNREACHABLE +11.4 s, [leader-auto-down] DOWNING +26.4 s, survivor vq03 active
+26.7 s. Recovery config restored byte-identical before Start-Service; vq04 rejoined
as standby in ~4.7 s with no exit-75. Also corrects the earlier Drill A 'sampler gap'
(an awk keying error; vq04 was ready at +20.8 s).
Claude-Session: https://claude.ai/code/session_01GT67AFKC45MBz1wPZnVbX8
Both centrals killed in turn (Stop-Process on the service PID). SCM restart in ~5 s;
the survivor downed the old incarnation at ~+9-10 s and took the active role; the
victim rejoined as standby at ~+21 s. leader-auto-down stood aside (already Down),
so its 15 s timer path was not exercised on QA. Site-pair drill still pending
(Z28061 slot, #142).
Claude-Session: https://claude.ai/code/session_01GT67AFKC45MBz1wPZnVbX8
Component-AuditLog (Security & Tamper-Evidence now a removal note, archive format v2, config),
Component-CLI, Component-ManagementService, HighLevelReqs AL-11/AL-12, docs/components/CLI, the CLI
README, alog.md §11.4/§15 and CLAUDE.md. New production script docs/plans/sql/RemoveAuditLogHashChain.sql
(idempotent, from migration 64); AddAuditLogHashChain.sql marked superseded. Historical plans,
deployment records and deploy-prep packs are left as written.
Claude-Session: https://claude.ai/code/session_01GT67AFKC45MBz1wPZnVbX8
CvdReactor.ProcessRecipeDownload now addresses Children["DelmiaReceiver"] on DEV vd03
and QA vq03/vq04. Redeployed DEV Z28062 + Z28061Sim, QA Z28062-Z28069; Z28061 left
stale on both tiers (shared with another team, no slot agreed). Traced read-only call
on Z28062 (ReadyFlag False): the pre-fix 'DelmiaRecv.ReadyFlag not found' warning is
gone after the fix.
apply.sh: every CLI call passes --url/--username/--password explicitly (an env-only
SCADABRIDGE_URL silently reached DEV), plus SB_EXPECT (refuse unless the expected
instances exist = tier proof) and SB_SKIP (never deploy the listed instances).
Record: docs/deployment/deployment-records/2026-11-15-gate-52-delmiareceiver-fix.md
Claude-Session: https://claude.ai/code/session_01GT67AFKC45MBz1wPZnVbX8
QA Warm gate (lmxopcua#907, 2026-11-13): a graceful stop of the Warm Primary
reported ServiceLevel 0 for ~6 s - shorter than the 10 s degraded window - the
next unreadable sample cleared the streak, and the connection retried the stopped
node FailoverRetryCount times: Good on the peer after 66 s, peer Active in 0.2 s.
Two going-away triggers on top of #138, both still requiring a Healthy (>= 200),
higher level on the other endpoint and honouring the minimum dwell:
- ServiceLevel 0 (Part 4 Maintenance) probes the other endpoint at once instead
of waiting out the window - once per degraded streak, so a non-Healthy peer is
re-probed once per window, not every poll. Other Degraded levels (standby 90/50,
booting 1) still wait the window.
- A lost link whose session's last KNOWN ServiceLevel was < 200 (unreadable
samples don't overwrite it) probes the other endpoint before the first
reconnect attempt, holding the reconnect timer. Healthy -> switch and reconnect
at zero delay, the stopped node is never retried; otherwise the ordinary retry
cycle runs (less the probe's time). After only Healthy levels (250/240, Unset),
inside the dwell, or with the feature off: unchanged retry-then-failover.
Tests: DataConnectionGoingAwayFailoverTests (10 cases, each trigger and
non-trigger with positive controls, connect-order artifact assertions) and a real
in-process OPC UA server pair graceful-stop e2e on production defaults: 1.1 s
(lost-link trigger alone 12.1 s, neither 33.1 s -> fails the 10 s bound).
13 mutants, all killed. DCL tests 608/608 (3 full runs); solution 0 warnings.
Docs: Component-DataConnectionLayer, components/DataConnectionLayer.
Not deployed; QA live re-check pending.
Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
SourceNode backfill 843 rows (0 NULL), AuditLog__HashChain__Enabled=true on both
centrals (ChainBacklog unset, head export off, single login), pair stopped together and
started vq03 first: central API ~29 s, sites not restarted. One anchor at
2026-11-13T14:07:43.3208169Z, 0 pre-cutoff rows chained, 20 new rows ChainSeq 1-20,
verify-chain 2026-11 Intact on both centrals, 2026-10 NotChained. MxGateway 2196 Good,
WarmCanary 2 Good, LocalDb sync connected. Backup ScadaBridge_pre-hashchain_20261113T090524.bak.
Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
Connection 2 / template 27 / instance 16 on site-a, bound to the OtOpcUa script-runner
canaries; serviceLevelFailover at its defaults. Under Warm the connection moved off the
Standby by ServiceLevel (connect-time preference, 0.1 s) and on the booting Standby (50);
a graceful Primary stop still took the connectivity path (66 s, #141). Kept as monitor.
Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
Removes the #96 compatibility path that the unified central-cache-invalidation
topic (#100 item 3, 153609ef; compat 3a31dd2d) carried for one release:
- CentralCacheInvalidationBus no longer publishes a bare SitePskInvalidated
on site-psk-invalidation; LegacySitePskTopic constant deleted.
- CentralCacheInvalidationSubscriber no longer subscribes to that topic or
handles a bare SitePskInvalidated; it applies envelopes only.
central-cache-invalidation behaviour is unchanged (one envelope per
invalidation, origin filtering, per-handler fault isolation).
Gate met: 8e32f353 (carries 153609ef and 3a31dd2d) runs on every central
node - DEV vd03 (record 581e25ca) and QA vq03/vq04 (record 8ba5d5d7).
Mixed-version / rolling-upgrade constraint: a central node built before
153609ef listens only on site-psk-invalidation and no longer receives PSK
invalidations from a newer peer (only its TTL and the site-rejection refresh
bound the staleness). Mixed pairs across that boundary are no longer
supported; central pairs are stopped and started together anyway.
Documented in Component-Host.md and Component-Communication.md.
Tests: the legacy publish/subscribe tests are replaced by
PskRotation_OnOneNode_ReachesThePeersCaches_ThroughTheUnifiedTopic (node A
publishes, node B's PSK cache and secret-resolver cache are invalidated, and
nothing else is published) and a bare-message-ignored test with an envelope
positive control. The two-node cluster test now asserts the PSK invalidation
arrives exactly once and the publisher applies nothing.
Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
Pair window per pack 8ffa6394: COPY_ONLY backup + VERIFYONLY, stop both pairs,
idempotent EF script 58->64 from the Mac (flip in ~2 s), swap, centrals then
sites started together. Site data path ~2 min 6 s, central API ~58 s.
leader-auto-down started on all 4 nodes; no #116 drills; hash chain off;
recovery flag TRUE on all 4 (actions kept). Env digest-identical; only the
strategy key changed in appsettings; per-node JWT/idle values preserved.
Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
No migration (64). ~45 s site outage. SCM non-crash recovery flag set for exit 75 (#132).
#131: SBTEST01/02 AlarmStatus on ScriptAlarm.Priority, verify 13/13 before and after.
Hash chain: SourceNode backfill 843 rows, Enabled=true (ChainBacklog unset, head export off),
one anchor at 2026-11-13T12:16:53Z, 0 pre-cutoff rows chained, verify-chain 2026-11 Intact.
Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
- Target 3a59c3f6 -> 8e32f353 (adds #138 ServiceLevel failover, #139 chain
cutoff, #140 graceful stop, LocalDb 0.3.8). No migration in the range;
the idempotent 58->64 script regenerated at 8e32f353 is byte-identical
(SHA-256 488da93d...c34ecc0).
- Owner's go 2026-11-13 ("just deploy"): #116 leader-auto-down flip and the
exit-75 service recovery setting in; no #116 drills; hash chain and head
export off; #52 stays excluded.
- #131 re-confirmed DEV-only against the QA config DB.
- Preflight re-run 07:05 EST: 58 migrations, 3,441 AuditLog rows, EventId
key, log 63 MB used of 200.
Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
A graceful stop of a site node whose peer holds an open LocalDb sync stream
left the Akka cluster ~30 s late (the ScadaBridge half of lmxopcua#906,
scadaproj#57). WebApplication stops the web server before AkkaHostedService,
whose StopAsync ran CoordinatedShutdown, and Kestrel's graceful drain waited
the whole ShutdownTimeout for /localdb_sync.v1.LocalDbSync/Sync: LocalDb 0.3.7
observes only the call token, which Kestrel cancels at the END of the drain.
CancelAllStreams only covered SiteStreamGrpcServer's own streams.
- AkkaHostedService is now an IHostedLifecycleService. StoppingAsync runs
before any hosted service's StopAsync (Kestrel's included): marks the stop
intentional, raises ApplicationStopping (so CancelAllStreams still precedes
actor teardown), then runs and awaits CoordinatedShutdown(ClrExitReason),
bounded by the host shutdown token. StopAsync returns the same completed
shutdown. Exit codes unchanged: planned stop exits 0; only a termination
outside host shutdown (self-down / #132 shut-out) exits 75. No Akka.Hosting
here, so no ClusterLeavingReason/-1 exit-code path is involved.
- ShutdownStreamCancellationInterceptor, innermost on both the central and the
site AddGrpc pipelines: every streaming call's token is linked with
ApplicationStopping; new streams are refused Unavailable while stopping.
Covers the LocalDb sync stream until LocalDb 0.3.8 is pinned.
Evidence (IntegrationTests/GracefulStopWithOpenSyncStreamTests: real
WebApplication + Kestrel h2c + MapZbLocalDbSync behind LocalDbSyncAuthInterceptor
+ a real LocalDb SyncBackgroundService peer + the production AkkaHostedService
forming a single-member cluster, 8 s drain budget, IServer wrapped to timestamp
the drain): before 8859 ms stop, member removed at 8834 ms, drain began at 0 ms;
after 960 ms stop, member removed at 950 ms, drain began at 959 ms.
Mutations (all killed): StoppingAsync skips CoordinatedShutdown; interceptor
passes the original context (stop 8003 ms); no Unavailable refusal; StoppingAsync
does not raise ApplicationStopping; lifecycle interface dropped; site pipeline
loses the interceptor.
Release build of the solution: 0 warnings. Host.Tests 733/733,
IntegrationTests 133/133, Communication.Tests 843/843.
Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
Owner decision on #107 (2026-11-13): enabling AuditLog:HashChain must not
chain the historical backlog. main chained every unchained row oldest-first.
- The first chaining pass on a pristine database (no head, no chained row)
writes a chain-start anchor: AuditLogChainTombstone (cutoff month,
ChainSeq 0), PurgedAtUtc = DB SYSUTCDATETIME(), RowHash =
SHA-256("ScadaBridge.AuditLog.ChainCutoff.v1" || YYYY-MM || ticks).
Written once under the exclusive chain lock, so both centrals agree
whatever their clocks/config. No migration: existing table + grants.
- Only rows with OccurredAtUtc >= cutoff are chained. The anchor hash is
the cutoff month's genesis, binding the cutoff into the chain.
- AuditLog:HashChain:ChainBacklog (default false) restores chain-everything,
read only on the very first enablement. Legacy chains (heads, no anchor)
keep chaining everything.
- verify-chain splits unchained rows into UnchainedRows vs PreCutoffRows
(+ ChainFromUtc); new breaks ChainedBeforeCutoff (row re-dated before the
cutoff, or cutoff moved forward) and CutoffAnchorInvalid (anchor hash /
month / multiplicity). Archive verify uses the anchor from its own
tombstone file or the DB.
- Partition switch-out keeps the anchor (deletes ChainSeq > 0 only); the
head store / export / verify-heads tombstone count excludes it.
- CLI verify-chain table prints Chain from + Pre-cutoff rows.
Tests: AuditLogHashChainCutoffTests (7, MSSQL), 6 verifier unit tests,
service/CLI/management wire tests; 9 mutations all killed.
Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
Prerequisite for OtOpcUa Warm redundancy (lmxopcua#717): a Warm standby keeps a
healthy session but serves BadOutOfService at a standby ServiceLevel (90/50, boot 1),
so a connection that lands there sat on Bad quality forever.
- OPC UA connections with a backup poll Server_ServiceLevel (i=2267) on the connected
endpoint (IServiceLevelReadable, implemented by OpcUaDataConnection; never raises
Disconnected). A level < 200 sustained for the degraded window (default 10 s), or
the first sample after any (re)connect, triggers a probe of the other endpoint
(short-lived session: connect, read, dispose). Switch only when it reports a
Healthy (>= 200) higher level, and not within the minimum dwell (default 60 s) of
the previous ServiceLevel switch. Both degraded, other unreachable or level
unknown: stay put. 250/240 (today's OtOpcUa) never starts a streak.
- The switch reuses the failover path: SwitchToOtherEndpoint() now shared by all
three triggers, then BecomeReconnecting(ReconnectCause.ServiceLevelFailover) -
zero delay, no unstable accounting, ReSubscribeAll on the new endpoint.
- Config: OpcUaEndpointConfig.ServiceLevelFailover {enabled, degradedWindowSeconds,
minDwellSeconds}, read from the PRIMARY endpoint's JSON only; null = defaults
(enabled, 10, 60). Inside the encrypted protocol JSON, so no schema change or
migration. Central UI: fields in the Backup card next to Failover Retry Count.
Global: ScadaBridge:DataConnection:ServiceLevelPollInterval (2 s) and
ServiceLevelProbeTimeout (15 s).
- Tests: actor tests per trigger/non-trigger with positive controls, an unsolicited
promotion RefreshStart/RefreshEnd test at client and actor level, adapter tests,
and a real in-process OPC UA server pair end to end. All 15 mutants killed.
- Docs: Component-DataConnectionLayer, components/DataConnectionLayer, Component-CLI.
Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
Every CLI option that can carry a secret gets a `--<name>-file <path|->`
sibling ('-' reads stdin), so the value stays out of the process list and
shell history: --password-file (global), --primary-config-file /
--backup-config-file (data-connection create|update), --auth-config-file
(external-system create|update), --connection-string-file (db-connection
create|update), --credentials-file (notification smtp create|update) and
--auth-token-file (notification sms create|update). Follows the existing
--config-file convention; `@path` is avoided because System.CommandLine
expands @-tokens as response files.
The value is read at parse time; a missing/unreadable/empty source, or '-'
on a terminal stdin, is a parse error naming option + path only, never the
content. Inline and file forms are mutually exclusive, at most one option
may read stdin, and one trailing line break is stripped. Inline forms keep
working.
docker/seed-sites.sh and docker-env2/seed-sites.sh now write the MxGateway
config (windev gateway key) to a mode-600 temp file removed by an EXIT trap
and pass --primary-config-file; seed-flow-outbound-demo.sh pipes its rig
connection string via --connection-string-file -. CLI README (new "Secrets
from a file or stdin" section + per-command tables), Component-CLI.md and
both docker READMEs updated.
Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi