Commit Graph

13 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 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 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 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 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 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 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 1d3f172f83 test(grpc-data): H2 smoke asserts the no-grant capabilities shape (review fix 7a) 2026-11-23 23:35:41 -05:00
Joseph Doherty a3e2f13815 test(grpc-data): H2 live smoke on the standalone rig - denied-principal modes, pinned-build check, parity; evidence 2026-11-23 23:31:30 -05:00
Joseph Doherty eb29360d47 test(grpc-data): opt-in H2 history profile for the standalone rig (SqlServer historian overlay, history seed grants, probe HistoryRead, smoke runner) 2026-11-23 23:13:31 -05:00
Joseph Doherty 29fec57fac test: validate grpc data connections with local docker and opcua cli 2026-11-23 09:55:04 -05:00