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).
This commit is contained in:
Joseph Doherty
2026-11-24 01:04:04 -05:00
parent 0a83c10ef6
commit af06183412
3 changed files with 49 additions and 11 deletions
+30 -7
View File
@@ -98,6 +98,29 @@ class HistoryGate:
self.runner.save("H-projected-nodes.json", {f"{k[0]}/{k[1]}": v for k, v in found.items()})
return consumer
def rebrowse(self, timeout=90):
"""A deploy retires cold projected nodes; browse from the anchor again (the SAME opaque ids come back)."""
end = time.monotonic() + timeout
while True:
try:
previous = dict(self.projected)
self.resolve_projected()
self.runner.check(not previous or previous == self.projected, "projected NodeIds are stable across a deploy")
return
except scenarios.ScenarioError:
if time.monotonic() >= end:
raise
time.sleep(3)
def change(self, **mutation):
"""A production mutation + deploy, then re-materialise the projected leaves by browse."""
self.runner.mutate(**mutation)
self.rebrowse()
def restore(self):
self.runner.baseline()
self.rebrowse()
def held(self, consumer, extra, name, during, *, marker_timeout=60):
"""Runs a hand-paged CLI read in the background; `during()` runs once the read reports its held point."""
marker = self.runner.folder / (name + "-" + uuid.uuid4().hex[:6] + ".held")
@@ -270,7 +293,7 @@ class HistoryGate:
consumer = self.runner.primary("consumer")
before, _, _ = self.poll_status(consumer, self.projected[("raw", "counter")], "Good", "before", timeout=30)
self.runner.check(before == "Good", "history served before the change")
self.runner.mutate(export_id="export-raw", export_allowed_operations=EXPORT_WITHOUT_HISTORY)
self.change(export_id="export-raw", export_allowed_operations=EXPORT_WITHOUT_HISTORY)
observed, attempts, result = self.poll_status(consumer, self.projected[("raw", "counter")], "BadHistoryOperationUnsupported",
"not-advertised", timeout=180)
self.runner.check(observed == "BadHistoryOperationUnsupported", "an origin that does not advertise history ⇒ unsupported")
@@ -287,22 +310,22 @@ class HistoryGate:
unhistorized, _, unh = self.poll_status(consumer, self.projected[("raw", "scalar")], "BadHistoryOperationUnsupported", "unhistorized",
timeout=30)
self.runner.check(unhistorized == "BadHistoryOperationUnsupported", "unhistorized ⇒ BadHistoryOperationUnsupported")
self.runner.mutate(acl_permissions={"node_acl_id": "source-peer", "permission_flags": NODE_PERMISSIONS_ADMIN & ~NODE_PERMISSIONS_HISTORY_READ})
self.change(acl_permissions={"node_acl_id": "source-peer", "permission_flags": NODE_PERMISSIONS_ADMIN & ~NODE_PERMISSIONS_HISTORY_READ})
denied, attempts, den = self.poll_status(consumer, self.projected[("raw", "counter")], "BadHistoryOperationUnsupported", "origin-denied",
timeout=180)
normalise = lambda text: re.sub(r"ns=\d+;s=\S+", "<node>", "\n".join(l for l in (text.stdout + text.stderr).splitlines() if "Bad" in l))
self.runner.check(denied == "BadHistoryOperationUnsupported", "origin ACL denial ⇒ BadHistoryOperationUnsupported")
self.runner.check(normalise(unh) == normalise(den), "denied and unhistorized are indistinguishable")
report["indistinguishable"] = {"unhistorized": normalise(unh), "denied": normalise(den), "attempts": attempts}
self.runner.baseline()
self.restore()
# (b) the LOCAL mapping-scope grant: without it, BadUserAccessDenied (a local decision); the other mapping keeps its grant.
self.runner.mutate(acl_permissions={"node_acl_id": "cli-history-map-raw", "permission_flags": NODE_PERMISSIONS_BROWSE})
self.change(acl_permissions={"node_acl_id": "cli-history-map-raw", "permission_flags": NODE_PERMISSIONS_BROWSE})
local, attempts, _ = self.poll_status(consumer, self.projected[("raw", "counter")], "BadUserAccessDenied", "local-denied", timeout=90)
self.runner.check(local == "BadUserAccessDenied", "no local HistoryRead grant on the mapping scope ⇒ BadUserAccessDenied")
other, _, _ = self.poll_status(consumer, self.projected[("uns", "counter")], "Good", "local-other-mapping", timeout=30)
self.runner.check(other == "Good", "the UNS mapping's own grant still serves")
report["local_deny"] = {"raw": local, "uns": other, "attempts": attempts}
self.runner.baseline()
self.restore()
consumer = self.runner.primary("consumer")
# (c) a consumer session close releases the origin continuation.
self.runner.check(self.origin_state() == 0, "no origin continuation open before")
@@ -323,7 +346,7 @@ class HistoryGate:
report["session_close"] = {"held": counts.get("held"), "after": after, "lines": self.status_lines(abandoned.stdout)}
# (d) origin rebuild mid-page: a resumed page after the origin's history epoch moved is BadContinuationPointInvalid.
def rebuild():
self.runner.mutate(rename_tag={"tag_id": "source-array1", "name": "array1-renamed"})
self.change(rename_tag={"tag_id": "source-array1", "name": "array1-renamed"})
rebuilt = self.held(consumer, ["-n", self.projected[("raw", "counter")], *self.window_args(), "--page-size", "3",
"--pause-after-page", "1", "--fresh-after-failure"], "rebuild", rebuild)
lines = self.status_lines(rebuilt.stdout)
@@ -354,7 +377,7 @@ class HistoryGate:
finally:
try:
self.runner.deadline = time.monotonic() + 600
self.runner.baseline()
self.restore()
restored = True
except Exception as failure:
error = (error + "; " if error else "") + "restoration " + type(failure).__name__ + ": " + str(failure)