Commit Graph

205 Commits

Author SHA1 Message Date
Joseph Doherty 8c28506d96 fix(dataconn): #1026 name every origin reset cause; stop binding checks invalidating live sources; renew cohort leases in batches
Gate #1026 (2048 projected items, rig seed --scale 2048) still failed after #1115. Three defects, found by
first making the origin and the consumer say why:

Diagnostics (origin + consumer)
- SourceInvalidationReason (bounded enum, classified from the publisher's reason constants): counted per
  reason (`otopcua.dataconn.source.invalidations{reason}`, `Invalidate.<Reason>` in SourceIngressDiagnostics),
  recorded on the source and logged at Debug (PartitionedSampleHub.Logger).
- An interest lease records why it stopped; the origin Subscribe stream's Reset text names it ("Source
  invalidated (<reason>).", "Source retired.", "Source interest released.", "Source routing changed.",
  "Source partition reset.", "Source binding replaced.") instead of always "Source change history expired.";
  logged at Information (Released at Debug). The texts are for people/counters only: the consumer classifies
  them into ResetSourceInvalidated / ResetInterestLost (no peer branches on them; the rig probe whitelist is
  updated).
- Consumer: renewal started/succeeded/failed/budget/slot counters, RenewalFail.<point> and
  AttemptEnd.<reason> (bounded, constant keys).

1. Origin: a binding check invalidated live sources. The driver actor's source-binding retry re-walks every
   desired reference (offset 0, every <= 30 s once any one failed); for an already-bound reference it took the
   source's serialization gate, and when the poll thread was publishing that source both sides invalidated it
   (BindingContention / SerializationContention) and reset every origin stream holding it. Live s1026-c: the
   only invalidation reasons were those two (5+5 during the open, recurring every ~30 s). EnsureDriverBinding now
   answers an already-bound, current source without the gate. Live after: 0 BindingContention.

2. Consumer: per-item metadata lease renewal could not keep up. Each projected item renewed its 15 s lease with
   its own capabilities + GetMetadata pair holding a 256 KiB unary reservation; at the default 1 MiB budget four
   ran at once and the rest retried on the next 250 ms tick (~16 items/s). Live s1026-d: 155 703 renewals
   started, 153 019 refused by the unary budget, 2 564 committed; ~1900 of 2048 items stood down
   BadUserAccessDenied; 0 recovered after the origin restart. RemoteNamespaceResolver.RenewExactBatchAsync renews
   many items with one capabilities call and one GetMetadata per origin MaxBatchItems (the single-item renewal is
   now the batch of one: same checks, lease bound and commit); a cohort renews every due item of a tick in
   batches of 128, and the between-attempt renewal (every item after an origin restart) is batched too.

3. Consumer: two demands of one node in one cohort deadlocked the batch: the second joined (#969) the first's
   claim, and the batch waited for the joiner before publishing its verdict. The batch now publishes first.

Live (OrbStack rig, 160 + 1888 items, 4 Hz churn, SOURCE pair restart): s1026-f run 1 open 10.2 s, recovery
1.5 s, 0 resets of any kind; s1026-h run 2 PASS (open 3.1 s, recovery 3.6 s, 0 resets, no history-expired or
source-invalidated log line). Remaining (not fixed here): s1026-h run 1 recovered only 852 of 1888 large-mapping
items after the restart: their renewals fail in the catalog cache's predecessor-chain bound
(RenewalFail.Cache.PredecessorChain 81 163).

Tests: GrpcData1026BindingContentionTests (fails without the fast path), GrpcData1026RenewalBatchWireTests
(one tick renews all due items in one metadata call - fails with per-item renewals; two demands of one node -
fails without the ordering fix), GrpcData1026ResetReasonTests.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-05 05:43:03 -05:00
Joseph Doherty 8ddae2f43d test(grpc-data-rig): #1115 scale profile (seed --scale N) and the #1026 scale gate
- device: read-only scale block (holding registers 1000..5095) + scale_set control action
- seed: GRPC_DATA_SCALE=N adds SOURCE driver modscale/dev with N UInt16 tags in TagGroups
  small (first 160) / large (rest), one RawTagGroup export + CONSUMER mapping each
  (map-scale-small|large); fixture.json records the counts
- rig.py: seed --scale N; deploy trigger gets a 60 s socket timeout (the AdminUI's
  StartDeployment ask waits up to 45 s; a 2048-tag snapshot read took ~25 s, so the
  general 15 s cap aborted the POST)
- scale_gate.py: opens a >128 and a >1024-item mapping via Client CLI recursive
  subscribes on CONSUMER, requires all Good, churns the block, restarts the SOURCE pair,
  requires all Good with a post-restart value, checks the consumer ResetHistory counter
  and the container logs for 'history expired'; PASS/FAIL + evidence/S1026-results.json

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-05 03:34:02 -05:00
Joseph Doherty 762bcd7b8d feat(admin): #1078 headless POST /api/cluster/failover (key-gated, same service+audit) and unattended SCM-restart gate
fix(install): #1075 worker identity gets read+execute (not Modify) on <PeCacheDir>\pe; re-run replaces the old grant
2026-12-03 16:29:27 -05:00
Joseph Doherty 2a8bac5bf5 feat(audit,install): #1030 audit overflow drops exported as otopcua.audit.dropped; scripted SCM-restart-after-cluster-exit gate
- AuditWriterActor: every buffer-full drop is added to OtOpcUaTelemetry.AuditDropped
  (otopcua.audit.dropped{reason=buffer_full, actor}) — the count used to be readable only
  through the actor's own property.
- scripts/install/tests/Test-ScmRestartAfterClusterExit.Windows.ps1: the windev manual gate
  of 2026-12-03 as a script (qfailure restart action; failover/command trigger => non-zero exit,
  7031, Running under a new pid; Stop-Service stays stopped; optional kill control). Parse-checked
  with pwsh on macOS; must be run elevated on a Windows box hosting OtOpcUaHost.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-03 15:20:06 -05:00
Joseph Doherty 6b60845931 Merge #937: scripted-alarm Part 9 methods report the engine's verdict (BadInvalidState / BadTimeout outcome-unknown), refused changes reverted, broadcast to the peer only after a local Applied/Unknown; MaxNodesPerMethodCall quota; 2 review rounds
v2-ci / unit-tests (push) Failing after 12m14s
2026-11-28 12:47:33 -05:00
Joseph Doherty 6a9c787307 Merge #923: gRPC data H4 Gateway-backend remote history live leg vs the real AVEVA Historian (read-only gateway), H01–H08 pass; rig --history-backend gateway; drop the #922 H01 re-browse workaround now that #922 is fixed
v2-ci / unit-tests (push) Has been cancelled
2026-11-28 11:48:10 -05:00
Joseph Doherty ac96d1f3d3 docs(grpc-data): Gateway origin remote history verified live (H01–H08 vs real AVEVA, read-only) — drop the unverified wording (#923) 2026-11-28 11:47:21 -05:00
Joseph Doherty 7d9818cf18 test(grpc-data): reverse-read reference is (W0, W1]; #922 renew before H01's UNS leg (#923) 2026-11-28 11:40:16 -05:00
Joseph Doherty 66b75aed0f Merge master into #937 (scenarios: keep A09 + F937) 2026-11-28 11:32:41 -05:00
Joseph Doherty 6ab7050c38 test(grpc-data): gateway overlay sends a placeholder key (the client refuses an empty one) (#923) 2026-11-28 11:22:02 -05:00
Joseph Doherty e45012b69d fix(alarms): a native condition's AddComment is not subject to the scripted verdict (#937)
Native AddComment shares HandleAlarmCommand but is applied at the node only;
asking the scripted host made it BadInvalidState (live A02 on fu937-1).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-28 11:01:47 -05:00
Joseph Doherty b569d5c5dd Merge branch 'master' into worktree-agent-aad6291e992ef79ba 2026-11-28 10:48:21 -05:00
Joseph Doherty efb3a39229 test(grpc-data): live H05 vs pinned 0c86edc1 origin PASS 25/25 (#921) and A09 driver-failure ack revert PASS 12/12 (#927); v1 listener refuses HistoryRead PERMISSION_DENIED; evidence 2026-11-28 10:25:31 -05:00
Joseph Doherty 7f071955ba docs(grpc-data): lapsed-lease behaviour; H3 gate drops the re-browse workaround and idles past the lease (#922) 2026-11-28 09:45:04 -05:00
Joseph Doherty d6f2a1b5e2 fix(alarms): a scripted condition's Part 9 method returns the engine's verdict (#937)
Before: the alarm-commands topic is fire-and-forget, so an OPC UA method (and a
remote gRPC-data condition method) returned Good even when the engine rejected
the command because its last load failed.

- ScriptedAlarmCommandReadinessView: the host's latest load outcome; the node
  manager's handler refuses BadInvalidState before the SDK applies anything
  while the last load failed (lock-free read).
- Bounded ask: inside CallAsync (off Lock) each local request runs base.Call
  alone; the handler only STARTS AlarmCommandAsker (broadcast for the peer +
  DriverHostActor -> ScriptedAlarmHostActor.ExecuteAlarmCommand on the local
  engine, CommandId-deduplicated) and the Call awaits the verdict: refused =>
  BadInvalidState, no answer => BadTimeout OutcomeUnknown.
- Remote CallConditionMethod: ExecuteConditionMethodAsync => DriverConfirmedFailure
  / OutcomeUnknown on the origin.
- Host ownership uses the latest plan set (stable across a load in flight and a
  failed load's half-built set).
- Docs: ScriptedAlarms.md (verdicts, residual, duplicate-activation trade-off),
  DataConnections.md, rules/alarms.md. Live leg scenario F937 + seeder
  scripted_predicate mutation.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-28 09:40:35 -05:00
Joseph Doherty cdbbe22a9d docs(grpc-data): rig README for the pinned SOURCE / H05V1 gate and A09; CLI read --attribute (#921, #927) 2026-11-28 09:34:15 -05:00
Joseph Doherty a0901ddf39 test(grpc-data): pinned pre-H2 SOURCE option (rig.py up --source-revision), wire tap, H05 v1-origin gate (#921); A09 driver-failure ack revert scenario (#927) 2026-11-28 09:28:59 -05:00
Joseph Doherty a6ae08146d test(grpc-data): Gateway origin backend for the history rig — read-only AVEVA bindings, reverse/end-only H07, strict-ceiling H08 (#923) 2026-11-28 09:23:45 -05:00
Joseph Doherty dc5ed011ce test(grpc-data): A03 phase 1 permits exactly one RefreshRequired after the held-set takeover (still forbids extra condition events); docs: the deploy hold settles on any completion, is bounded, reports held, and resyncs once
Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-25 04:07:58 -05:00
Joseph Doherty 7425b4c4fe test(grpc-data): A03 native D7 probe uses AddComment (a forwarded native ack froze opc-plc's EastTankYellow at the origin for the rest of a4s-4) 2026-11-25 02:28:20 -05:00
Joseph Doherty 42e3800f2c test(grpc-data): A4 part 2 — A03 gap via pause+stop, origin watcher + re-assert mirror check, latest-EventId positive control; duplicate-transition checks (A03/A06/A07); docs: folder-first event item still refused BadNotSupported (workaround: i=2253 first) 2026-11-25 02:04:30 -05:00
Joseph Doherty 9ea50c11b2 test(grpc-data): A4 live scenarios part 2 harness — A03 origin failover (same-incarnation stream reset via mapping revision bump, clear-and-re-raise in the gap, RefreshRequired, BadEventIdUnknown, refreshed EventId acks), A06 consumer Primary change across both nodes + second CONSUMER principal fixture-cli-alt, A07 consumer restart refresh-vs-barrier; CLI alarms prints EventType (names RefreshStart/End/Required) 2026-11-25 01:44:58 -05:00
Joseph Doherty c82b8683b0 docs(grpc-data): A4 live scenarios part 1 — A01/A02/A04/A05/A08 PASS on a4s-2, observations, part-2 harness notes 2026-11-25 01:37:21 -05:00
Joseph Doherty 6bf7dc8930 test(grpc-data): A4 scenarios — native alarm on EastTank?Yellow (cycles live), condition mappings WriteThrough (DataMappingOperationsInvalid), folders subscribe after demand opens, ConfirmedState read, origin audit for A08 denial 2026-11-25 01:23:14 -05:00
Joseph Doherty 304e8b1b7d test(grpc-data): A4 live scenarios part 1 harness — run-owned opc-plc --alm, native alarm + 2 referencing equipment + 3 condition mappings, UNS-only origin principal, no-grant consumer principal; probe condition-records; node-probe alert-transitions; conditions_scenarios.py (A01/A02/A04/A05/A08) 2026-11-25 01:05:53 -05:00
Joseph Doherty 969f3d4645 test(grpc-data): A4 manifest entry; condition-access tests wait for the barrier's RefreshRequired, not the barrier count
Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-24 23:11:39 -05:00
Joseph Doherty 4e6535ee1d test(grpc-data): A3 live smoke — conditions profile makes the CONSUMER condition-bearing; conditions_a3_smoke.py acknowledges the imported ScalarHigh through the consumer 2026-11-24 17:25:31 -05:00
Joseph Doherty 2d0147f9da test(grpc-data): A3b consumer method port runtime tests (per-caller gate with real policy, mapping bit + timeout, serving incarnation, connection down unsent, lease refusal) + A3 manifest 2026-11-24 17:20:50 -05:00
Joseph Doherty 762b0fa15d test(grpc-data): A3 unit-phase manifest entry 2026-11-24 16:43:22 -05:00
Joseph Doherty 90db1e68b7 test(grpc-data): A2b smoke probe — a fresh operation id per run 2026-11-24 14:25:54 -05:00
Joseph Doherty 97c639b556 test(grpc-data): A2b smoke probe — scripted outcome is applied (2), method bits Primary-only, record comment/ClientUserId/marker 2026-11-24 14:25:45 -05:00
Joseph Doherty d63884e624 test(grpc-data): A2b smoke — conditions profile grants the method bits; probe remote ack (+ duplicate, header-less, Secondary); origin CLI alarms watcher counts exactly one ack 2026-11-24 13:55:45 -05:00
Joseph Doherty 84836dd5e2 test(grpc-data): A2b manifest — method tests, OpcUaServer NM tests, unknown-bit tolerance 2026-11-24 13:51:08 -05:00
Joseph Doherty d3a4e70f6f test(grpc-data): A2a smoke — address the UNS export root by EquipmentId + subject; publish tools and set the scenario deadline 2026-11-24 13:05:40 -05:00
Joseph Doherty 45a3eee9c8 test(grpc-data): A2a — revocation test awaits the worker teardown; README conditions profile 2026-11-24 12:42:17 -05:00
Joseph Doherty 6572ee83bc test(grpc-data): A2a — rig --conditions overlay (AlarmSubscribe exports + ScalarHigh scripted alarm), probe conditions scenario, conditions_smoke.py; X0/H2 tests move the 'future' bit off 64 2026-11-24 12:29:19 -05:00
Joseph Doherty 06c8740f94 test(grpc-data): A2a — unit-phase manifest key A2; probe carries history,conditions; metadata never carries AlarmSubscribe 2026-11-24 12:21:18 -05:00
Joseph Doherty 27a59716aa Merge A1 review round 1 fixes 2026-11-24 11:03:44 -05:00
Joseph Doherty 6c94a2ec0e test(grpc-data): rig dev literal DataConnections__ConditionKeySecret on both source services 2026-11-24 10:37:02 -05:00
Joseph Doherty 141e4412d2 test(grpc-data): A1 — real-driver signal rig (StartRig over IDriver), FOCAS end-to-end; driver test classes in the A1 manifest 2026-11-24 10:25:47 -05:00
Joseph Doherty eb688a4ee0 Merge A1 keys/placements/ids into A1 core 2026-11-24 10:02:34 -05:00
Joseph Doherty 81ebdf4fb0 test(grpc-data): A1 unit-phase manifest key 2026-11-24 09:39:27 -05:00
Joseph Doherty 066372ce41 test(grpc-data): A1 — condition ids, condition_key (m-T6), secret validation, UNS-only no-RawPath property test; A1 manifest key 2026-11-24 09:23:06 -05:00
Joseph Doherty 7498f1ce82 test(grpc-data): H4 review 7 — diagnostics snapshot round-trips on the cluster serializer; old-shape payloads decode
Round-trips NodeDiagnosticsSnapshot (OriginHistory, HistoryVariants and the other H4 members) through
the serializer Akka picks for the fleet-diagnostics reply, and decodes payloads stripped of the H4
members. The origin flag is renamed NoPeerTrafficYet (default false): Akka's JSON serializer fills a
missing constructor argument with the CLR default, so a payload without it must never claim it.
2026-11-24 08:41:52 -05:00
Joseph Doherty e3f21cb86c feat(grpc-data): H4 remote-history diagnostics and metrics
Consumer and origin history evidence for data connections (plan §6):
- DataConnectionHistoryDiagnostics: otopcua.dataconn.history.reads{variant,status_class,side} and
  otopcua.dataconn.history.continuations.active{side} on the exported OtOpcUa meter (the H2 origin
  counter sat on a private meter the host never exported); the plan's unknown-bits counter is the
  existing X0 otopcua.dataconnection.unknown_operations_dropped, reused
- per-connection projected answers by status class and open consumer continuations (settled on
  resume claim or release); origin sessions, open continuations and answers by status class
- negotiated features and advertised history variants/aggregates per connection
- AdminUI data-connections page renders them plus the dropped unknown-operation bits (#919)
- H4 unit-phase manifest key
2026-11-24 08:01:57 -05:00
Joseph Doherty 60e594dddd test(grpc-data): H06 held legs start right after a deploy (idle projection authority lapses)
The review re-run showed a re-browse served from the cached page does not
renew an idle projected node's 15 s metadata lease (value Read is refused the
same way; pre-existing v1 projection behaviour). Each held H06 leg now starts
right after a baseline restore + re-browse.
2026-11-24 02:19:03 -05:00
Joseph Doherty 8f630bec98 test(grpc-data): H3 gate re-browses before held reads (projection authority lapses with the metadata lease)
Found on the review re-run (H06d, SqlServer): a projected node read more than
MetadataLeaseMilliseconds (15 s) after its last browse/renewal is
BadUserAccessDenied — the same for a value Read (pre-existing v1 projection
behaviour, confirmed in the Runtime harness), not an H3 defect. The gate now
re-browses before each held read.
2026-11-24 02:02:49 -05:00
Joseph Doherty f26b12085f test(grpc-data): H3 gate — Float32 legs in H01/H03, H06 origin refusal over the wire
Seed profile historizes a Float32 (registers 30..31) driven through two values;
H01/H03 compare its projected rows/types with the origin (Good Singles). H06(a)
also reads the denied and the unhistorized node through the consumer's deployed
connection (node probe) so the origin's per-item refusal itself is compared,
not only the metadata that drops the access bit.
2026-11-24 01:51:01 -05:00
Joseph Doherty af06183412 fix(grpc-data): projected Processed values keep their aggregate's type
Found by the H3 live gate (H02): a Double Average of a UInt16 node was decoded
against the node's catalog kind and came back null + BadTypeMismatch per
interval (the result status stayed Good, which is why the wire test missed
it). Raw/AtTime values are still checked against the catalog kind; Processed
values accept any scalar kind. The wire test now asserts the interval's value.
Gate: re-browse the projected leaves after every deploy (a deploy retires cold
projected nodes; the same opaque ids come back).
2026-11-24 01:04:04 -05:00
Joseph Doherty 763669562e docs(grpc-data): H3 OPC UA HistoryRead on projected nodes; rig H3 gate recipe 2026-11-24 00:44:04 -05:00