From 7f071955bafb69c6688bf5ae422b3b4faed763b0 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Sat, 28 Nov 2026 09:45:04 -0500 Subject: [PATCH] docs(grpc-data): lapsed-lease behaviour; H3 gate drops the re-browse workaround and idles past the lease (#922) --- docs/DataConnections.md | 24 ++++++++++++++++++++ scripts/validation/grpc-data/history_gate.py | 14 +++++++----- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/docs/DataConnections.md b/docs/DataConnections.md index 07fc7c2db..6abcf2173 100644 --- a/docs/DataConnections.md +++ b/docs/DataConnections.md @@ -90,6 +90,30 @@ reply cannot lengthen it. Renewal grants no parent or sibling visibility, Browse local Browse privilege. Missing capability, denied Metadata or an invalid lease leaves the item unavailable until valid authority can be established. +**A lapsed lease is not an access denial (#922).** A projected node idle longer than its mapping's +`MetadataLeaseMilliseconds` keeps its retained proof; the lease is only *lapsed* when its time ran +out or its route was replaced while the local catalog authority, mapping binding and cache +generation are all still current and nothing revoked it. On a refused value Read / attribute Read / +HistoryRead of such a node, the consumer first authorizes the caller against the lapsed subject +(local grant + mapping bit, everything but the lease). A caller without the grant is still +`BadUserAccessDenied` and nothing is sent to the origin. A granted caller gets the same exact +`GetMetadata` renewal as above, for the operation it is performing (Read / HistoryRead bit, not +Subscribe), one per node at a time, bounded by the unary budget, with a 250 ms back-off after a +failure: + +- **Value Read** answers `BadWaitingForInitialData` (as a cold read does) while the renewal runs off + the request thread; once it commits, a read is scheduled so the client's retry is served from the + fresh sample. `BadResourceUnavailable` while a renewal cannot be started (capacity, back-off). + A non-Value attribute of a lapsed node answers `BadResourceUnavailable` while it renews. +- **HistoryRead** renews within the request (one wait per batch, at most 5 s, no node-manager `Lock` + held) and is then served; a renewal that cannot complete (origin unreachable) answers + `BadResourceUnavailable`, never `BadUserAccessDenied`. +- **Browse:** a cached page past half its lease is served as is *and* refreshed in the background + (one refresh per page key), so a re-browse renews the leases of the nodes it lists. + +An origin that stopped granting the operation fails the renewal; the consumer then keeps answering +the retryable status (it cannot tell that from an unreachable origin). + An authorized logical monitored-item request can survive a physical stream expiry and seek a new pinned binding with bounded retries. The old binding and any queued sample evidence remain tied to their original authority and serving generation. The same item needs a fresh, complete baseline diff --git a/scripts/validation/grpc-data/history_gate.py b/scripts/validation/grpc-data/history_gate.py index 5a5dc2587..d3c975463 100644 --- a/scripts/validation/grpc-data/history_gate.py +++ b/scripts/validation/grpc-data/history_gate.py @@ -24,6 +24,8 @@ NODE_PERMISSIONS_ADMIN = 4095 # NodePermissions.Admin = bits 0..11 (HistoryUpda NODE_PERMISSIONS_HISTORY_READ = 1 << 3 NODE_PERMISSIONS_BROWSE = 1 << 0 EXPORT_WITHOUT_HISTORY = 31 # Browse | Metadata | Read | Write | Subscribe +# #922: longer than the rig mappings' 15 s MetadataLeaseMilliseconds, so a projected node idles past its lease. +LEASE_LAPSE_SECONDS = 20 def _iso(moment): @@ -266,9 +268,8 @@ class HistoryGate: with self.runner.stopped(source): observed["new_primary"] = self.runner.wait_primary("source", exclude=source) self.runner.wait_connection_ready(consumer, "raw") - # Resume INSIDE the stop window: the issuing endpoint is down, the pinned resume cannot move. Re-browse first so - # the node's projection authority is current (it lapses with the 15 s metadata lease, as for a value Read). - self.rebrowse() + # Resume INSIDE the stop window: the issuing endpoint is down, the pinned resume cannot move. No re-browse: a + # projected node whose 15 s metadata lease lapsed renews on demand within the HistoryRead (#922). self.held_resume_now() self.runner.wait_pair_topology("source") @@ -374,10 +375,11 @@ class HistoryGate: self.runner.check(any(l.startswith("Page 2: BadContinuationPointInvalid") for l in lines), "resume after the origin rebuild is invalid") self.runner.check(any(l.startswith("Fresh: Good") for l in lines), "a fresh read after the rebuild succeeds") report["rebuild"] = lines - # (c) a consumer session close releases the origin continuation. Each held read starts right after a deploy + re-browse: - # an idle projected node's authority lapses with its 15 s metadata lease and a re-browse served from the cached page - # does not renew it (a value Read is refused the same way — pre-existing v1 projection behaviour, reported). + # (c) a consumer session close releases the origin continuation. The restore's deploy retires cold projected nodes, so it + # re-browses; the held read then deliberately starts only after the node's 15 s metadata lease has LAPSED (#922: it + # renews on demand within the HistoryRead instead of answering BadUserAccessDenied). self.restore() + time.sleep(LEASE_LAPSE_SECONDS) consumer = self.runner.primary("consumer") self.runner.check(self.origin_state() == 0, "no origin continuation open before") counts = {}