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>
This commit is contained in:
@@ -839,7 +839,10 @@ This section is what an OPC UA client of the **consumer** sees. Code: `OpcUaServ
|
||||
- **A consumer's own deploy is not a removal.** Every deploy begins with an empty, undecided mapping set (the catalog
|
||||
attempt is suspended until it completes). Imported conditions are **held** across it — the connection's next runner takes
|
||||
them over and re-snapshots onto the same nodes, so an unchanged condition reports no event and keeps its EventIds. Only a
|
||||
settled set without the mapping's connection (or the demand linger) removes them. (A4 findings F1–F3, fixed on `a4-code`:
|
||||
settled set without the mapping's connection (or the demand linger) removes them. Any completion settles the set, a failed
|
||||
or degraded deploy included (its settled set is empty). A hold that never settles goes `BadNoCommunication` on the stale
|
||||
timeout and is removed past `MaxHold`. The runner that takes a held set over sends one RefreshRequired at its first
|
||||
barrier, because events queued during the hold were not delivered (A4 review round 2). (A4 findings F1–F3, fixed on `a4-code`:
|
||||
each deploy used to remove and re-create every imported condition — a phantom event per active condition, an origin
|
||||
transition delivered twice, every older EventId `BadEventIdUnknown` with no RefreshRequired.)
|
||||
- **One event per origin transition.** It is delivered to every wired folder item and to the Server object (`i=2253`),
|
||||
|
||||
+12
-2
@@ -360,7 +360,17 @@ An origin streams its alarm condition state to a peer that negotiated `condition
|
||||
review, S1. Earlier text here said a deploy's adds/removes arrive as deltas; only a fixture could do that.)
|
||||
- **A consumer deploy holds its imported conditions.** The consumer's own deploy publishes an empty mapping set while its
|
||||
catalog attempt is in progress; that set is undecided, not a removal. Conditions are held and handed to the next runner
|
||||
(same nodes, same EventIds); only the settled set decides a removal (A4 F1–F3).
|
||||
(same nodes, same EventIds); only the settled set decides a removal (A4 F1–F3). A4 review round 2 bounds and settles it:
|
||||
- The runtime publishes the placements and the "undecided" flag as one value (`ProjectedMappingSet`), so no reader pairs
|
||||
a settled flag with the attempt's empty list.
|
||||
- **Any** completion settles the set. A failed or degraded apply leaves the catalog unactivated, so the settled set is
|
||||
empty and the held conditions are removed. (Browse anchors still stay retained until a successful activation.)
|
||||
- An attempt that never completes is bounded. The held conditions go `BadNoCommunication` on the connection's stale
|
||||
timeout, as for any stream gap, and are removed past `ProjectedConditionOptions.MaxHold` (5 min, 2.5× the deploy apply
|
||||
deadline). Until then they stay charged to the host caps and diagnostics show the connection as `held`.
|
||||
- The runner that takes a held set over sends **RefreshRequired once** at its first barrier. While the set was held
|
||||
nothing imported was visible, so an event queued then was dropped and a ConditionRefresh replayed nothing. RefreshRequired
|
||||
is a Server-object event, not a condition event: EventIds are kept and no condition event is added.
|
||||
- **Priority and overflow.** A control or ack at the head of the stream goes first, then condition frames, then queued
|
||||
values. Condition production is pull-based: a slow consumer leaves records in the bounded condition-state hub. The item
|
||||
notices an eviction of records it has not read the next time it reads the hub. If its previous snapshot's last chunk is
|
||||
@@ -598,7 +608,7 @@ The AdminUI **Data connections** page (`/clusters/{id}/data-connections`) shows,
|
||||
"Imported conditions" line. It reads "no condition-bearing mapping (or evidence unavailable)" when there is none, or when the
|
||||
node is older than A4. Otherwise it shows:
|
||||
|
||||
- `stream` state (idle, connecting, snapshotting or live) and `last snapshot` (UTC, or "none since start");
|
||||
- `stream` state (idle, connecting, snapshotting, live, or held — kept across an undecided deploy, see the condition stream lifetime) and `last snapshot` (UTC, or "none since start");
|
||||
- `conditions` materialised, with the `state unknown` count (`state_known = false`);
|
||||
- `node budget` charged against the host condition limit;
|
||||
- `RefreshRequired`, `resyncs` and `capacity rejections` counts;
|
||||
|
||||
@@ -538,6 +538,7 @@ class ConditionScenarios:
|
||||
time.sleep(3)
|
||||
e1 = self.latest(imported, name)["EventId"]
|
||||
mark, origin_mark = len(imported.blocks(name)), len(origin.blocks(name))
|
||||
mark_all_p1 = len(imported.blocks())
|
||||
self.r.mutate(bump_mapping_revision=self.fixture["conditions"]["native"]["mappings"]["pumpb"])
|
||||
self.r.manifest = self.r.rig.load()
|
||||
opened = wait_for(lambda: self.stream_opened(consumer, since), 120)
|
||||
@@ -545,14 +546,20 @@ class ConditionScenarios:
|
||||
time.sleep(8)
|
||||
reset_events = imported.blocks(name)[mark:]
|
||||
origin_events = origin.blocks(name)[origin_mark:]
|
||||
p1_required = self.refresh_required(imported.blocks()[mark_all_p1:])
|
||||
self.report["phase1"] = {"stream_opened": opened[-2:], "barrier": barrier[-2:], "events_during_reset": [(b.get("State"), b.get("Time")) for b in reset_events],
|
||||
"origin_events_during_reset": [(b.get("State"), b.get("Time")) for b in origin_events],
|
||||
"origin_reassert_log": self.log_lines(source, since, "re-asserted")[-2:], "watcher_alive": imported.process.poll() is None}
|
||||
"origin_reassert_log": self.log_lines(source, since, "re-asserted")[-2:], "watcher_alive": imported.process.poll() is None,
|
||||
"refresh_required": [(b.get("Time"), b.get("Source")) for b in p1_required]}
|
||||
self.check("p1_stream_reopened_same_origin", opened and all(source in line for line in opened))
|
||||
self.check("p1_barrier_after_reset", barrier)
|
||||
# A deploy is the rig's only stream-reset trigger, and it also makes the origin re-assert its scripted alarms (a new
|
||||
# record time, same activation marker): the consumer must mirror exactly the origin's events — no resync extras.
|
||||
self.check("p1_consumer_events_mirror_origin", len(reset_events) == len(origin_events) and self.unique_event_ids(imported.blocks(name)))
|
||||
# A4 review r2 S3: the runner that takes the HELD set over after the consumer's deploy sends RefreshRequired exactly once
|
||||
# (the rig has one condition-bearing connection) — the resync signal for anything missed during the hold. It is a
|
||||
# Server-object event, not a condition event: the mirror check above still forbids any extra condition event.
|
||||
self.check("p1_exactly_one_refresh_required_after_held_takeover", len(p1_required) == 1)
|
||||
comment = self.ack(consumer, condition, e1, "comment-old-eventid-same-incarnation", command="comment")
|
||||
self.report["phase1"]["comment_with_pre_reset_eventid"] = comment
|
||||
self.check("p1_pre_reset_eventid_still_accepted", comment["good"])
|
||||
|
||||
Reference in New Issue
Block a user