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:
Joseph Doherty
2026-11-25 04:07:58 -05:00
parent 6bdca132fe
commit dc5ed011ce
3 changed files with 24 additions and 4 deletions
@@ -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"])