From ae2a2d78bafbfab48b72eaefdbe2e96821cc297c Mon Sep 17 00:00:00 2001 From: dingo Date: Mon, 19 Oct 2026 11:14:36 -0400 Subject: [PATCH] Keep the cell through a lone empty view (no-cell panel blinking) The DEV server still runs a build that sends every session an empty view each tick around the owner's real one. fcc6c57's client guard covered only an empty view after the real one of the same tick; the next tick's empty view arriving first still made the cell vanish for a frame, so the no-cell panel blinked a few times a minute. While a cell is shown, the client now counts empty views only after 20 ticks (one second) with no real view. A death is unaffected: it arrives as CellularLifeEnded. The session test covers both orders and the grace running out. Co-Authored-By: Claude Opus 5.5 --- .../region/dev-session-route/listener.yaml | 2 +- src/client/session/region_session.cpp | 19 ++++++-- tests/quic_sessions.cpp | 45 ++++++++++++++----- 3 files changed, 50 insertions(+), 16 deletions(-) diff --git a/deploy/kubernetes/region/dev-session-route/listener.yaml b/deploy/kubernetes/region/dev-session-route/listener.yaml index 9cec590..703a80e 100644 --- a/deploy/kubernetes/region/dev-session-route/listener.yaml +++ b/deploy/kubernetes/region/dev-session-route/listener.yaml @@ -12,7 +12,7 @@ spec: env: - {name: REGION_SESSION, value: "dev"} - {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"} - - {name: REGION_SESSION_WINDOW, value: "dev-20261019T130838-2a437d9d:1792429718"} + - {name: REGION_SESSION_WINDOW, value: "dev-20261019T151436-42953:1792433676"} - {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"} ports: # QUIC (ADR-0090): UDP only; nothing listens on TCP 7400. diff --git a/src/client/session/region_session.cpp b/src/client/session/region_session.cpp index f08d132..449c0b5 100644 --- a/src/client/session/region_session.cpp +++ b/src/client/session/region_session.cpp @@ -29,6 +29,8 @@ struct RegionSessionClient::Impl { std::vector primitive_life_outcomes; std::optional snapshots; std::optional cellular_perception; + // First tick of a run of empty views while a cell was shown (0: none). See message(). + std::uint64_t empty_since{}; std::optional mutation_offer; std::optional life_ended; std::uint64_t snapshot_chunks{}, snapshot_bytes{}; @@ -145,11 +147,20 @@ struct RegionSessionClient::Impl { return keep(action_outcomes, *m); if (const auto* m = std::get_if(&*decoded)) { seen_tick(m->tick); - // An empty view never replaces a real one of the same tick: older servers - // sent both, and the cell vanished for a frame (input stopped, panels opened). + // Older servers send every session an empty view each tick around the real + // one, in either order, so a lone empty view made the cell vanish for a frame + // (input stopped, the no-cell panel blinked). While a cell is shown, empty + // views count only after a second of ticks with no real view; a death still + // arrives at once as CellularLifeEnded. + constexpr std::uint64_t empty_grace_ticks = 20; if (m->life_identity == 0 && cellular_perception && - cellular_perception->tick == m->tick && cellular_perception->life_identity != 0) - return; + cellular_perception->life_identity != 0) { + if (empty_since == 0) + empty_since = m->tick; + if (m->tick < empty_since + empty_grace_ticks) + return; + } + empty_since = 0; cellular_perception = *m; return; } diff --git a/tests/quic_sessions.cpp b/tests/quic_sessions.cpp index d4a0578..9dbf81b 100644 --- a/tests/quic_sessions.cpp +++ b/tests/quic_sessions.cpp @@ -780,17 +780,16 @@ void cellular_v5_spawn_and_v7_action_share_region_sessions(const Files& f) { auto legacy_perception = perception; legacy_perception.diagnostics.reset(); CHECK(*legacy_owner->cellular_perception() == legacy_perception); + // An empty view reaches every v8+ session; a session showing a cell keeps it for now + // (the client's grace, below), one with none shows the empty view. h.server->clear_cellular_perceptions(102); CHECK(h.until([&] { - return perception_owner->cellular_perception() && - perception_owner->cellular_perception()->tick == 102; + return other_owner->cellular_perception() && + other_owner->cellular_perception()->tick == 102; })); - CHECK(h.until([&] { - return legacy_owner->cellular_perception() && - legacy_owner->cellular_perception()->tick == 102; - })); - CHECK(perception_owner->cellular_perception()->life_identity == 0 && - perception_owner->cellular_perception()->patches.empty()); + CHECK(other_owner->cellular_perception()->life_identity == 0 && + other_owner->cellular_perception()->patches.empty()); + CHECK(perception_owner->cellular_perception()->life_identity == 901); // A session given a view this tick is never cleared in the same tick (the cell would // vanish for a frame); one without a view still is. auto later = perception; @@ -798,15 +797,39 @@ void cellular_v5_spawn_and_v7_action_share_region_sessions(const Files& f) { CHECK(h.server->send_cellular_perception(owner_account, later)); h.server->clear_cellular_perceptions(103); CHECK(h.until([&] { - return legacy_owner->cellular_perception() && - legacy_owner->cellular_perception()->tick == 103; + return other_owner->cellular_perception() && + other_owner->cellular_perception()->tick == 103; })); - CHECK(legacy_owner->cellular_perception()->life_identity == 0); + CHECK(other_owner->cellular_perception()->life_identity == 0); CHECK(h.until([&] { return perception_owner->cellular_perception() && perception_owner->cellular_perception()->tick == 103; })); CHECK(*perception_owner->cellular_perception() == later); + // An older server cleared before the real view: the client keeps the cell through a + // lone empty view, and drops it only after a second (20 ticks) of nothing else. + auto next = later; + next.tick = 104; + h.server->clear_cellular_perceptions(104); // No view yet this tick: an empty one goes. + CHECK(h.server->send_cellular_perception(owner_account, next)); + CHECK(h.until([&] { + return perception_owner->cellular_perception() && + perception_owner->cellular_perception()->tick == 104; + })); + CHECK(*perception_owner->cellular_perception() == next); + h.server->clear_cellular_perceptions(110); + h.server->clear_cellular_perceptions(123); + CHECK(h.until([&] { + return other_owner->cellular_perception() && + other_owner->cellular_perception()->tick == 123; + })); + CHECK(perception_owner->cellular_perception()->life_identity == 901); // Within the grace. + h.server->clear_cellular_perceptions(131); + CHECK(h.until([&] { + return perception_owner->cellular_perception() && + perception_owner->cellular_perception()->tick == 131; + })); + CHECK(perception_owner->cellular_perception()->life_identity == 0); } // M10.4: intentions, actions and their distinct answers against a simulated host.