diff --git a/doc/concept/stats.md b/doc/concept/stats.md index 2247609f79..bf7b6a6560 100644 --- a/doc/concept/stats.md +++ b/doc/concept/stats.md @@ -448,7 +448,8 @@ release costs only that route. `routes` counts what the label's moq-lite-07 sessions did on the route layer, each under the label of the session whose peer caused it. Its size never -depends on how many broadcasts or relays the mesh has. When rolling a mesh onto +depends on how many broadcasts or relays the mesh has, and a label with nothing +counted leaves it out, which readers read as zeros. When rolling a mesh onto a new release one relay at a time, compare a canary's rates with its neighbours': diff --git a/js/stats/src/stats.test.ts b/js/stats/src/stats.test.ts index 41e13c6ebe..8a5ddc1866 100644 --- a/js/stats/src/stats.test.ts +++ b/js/stats/src/stats.test.ts @@ -121,6 +121,8 @@ test("a frame names each counter once and a missing counter reads zero", () => { expect(PresenceSchema.parse({ sessions_started: 4, sessions_ended: 2 })).toMatchObject({ sessions_started: 4, sessions_ended: 2, + // A label that never routed sends no `routes`. + routes: { changed: 0, closed: { other: 0 } }, }); // The pre-rename spellings are neither read nor kept. expect(PresenceSchema.parse({ sessions: 4, sessions_closed: 2 })).toMatchObject({ diff --git a/quest/m0/nightly/shared-bench-regressions.md b/quest/m0/nightly/shared-bench-regressions.md deleted file mode 100644 index 61090cd546..0000000000 --- a/quest/m0/nightly/shared-bench-regressions.md +++ /dev/null @@ -1,29 +0,0 @@ -# [M] The 2026-11-19 shared-bench regressions are fixed or accepted - -## Goal - -Nightly's Rust shared bench targets pass the paired comparison again: each -regression from 2026-11-19 is fixed, or accepted by the PR that caused it -with a stated reason. - -## Plan - -Found by the 2026-11-19 triage of run [44562804083](https://github.com/moq-dev/moq/actions/runs/44562804083), -against the 2026-11-18 head (`4f3ba3317`). Twelve regressions, consistent -across all three rounds: - -- `connection_blocked/*/churn_*` +22 to 33%. Suspect - [moq-dev/moq#9152](https://github.com/moq-dev/moq/pull/9152), which also - changed that bench; check whether the bench now measures more, which is - not a regression. -- `stats/presence/*` +38 to 56%. Suspect - [moq-dev/moq#9054](https://github.com/moq-dev/moq/pull/9054), which adds - `poll_refresh` per tick. -- `relay_auth_refresh/1/1` +11.3%. - -Confirm each suspect with a paired local run of the bench at its PR and its -parent before changing code. - -Caused by: the suspects above, once confirmed. - -Public API: none expected. Wire: none. diff --git a/rs/kio/src/waiter.rs b/rs/kio/src/waiter.rs index 6c8d8a7a85..8f88330799 100644 --- a/rs/kio/src/waiter.rs +++ b/rs/kio/src/waiter.rs @@ -75,7 +75,7 @@ impl Waiter { /// Whether this is a [`noop`](Self::noop) waiter. #[inline] - pub(crate) fn is_noop(&self) -> bool { + pub fn is_noop(&self) -> bool { self.noop } diff --git a/rs/moq-net/src/stats.rs b/rs/moq-net/src/stats.rs index 86b1600da9..5f08713fb6 100644 --- a/rs/moq-net/src/stats.rs +++ b/rs/moq-net/src/stats.rs @@ -611,6 +611,8 @@ pub struct Presence { /// [`Routes::refused`]. pub routes_refused: u64, /// What the label's lite-07 sessions did on the route layer. + // Most labels never route, so an all-zero readout stays off the wire; readers default it. + #[serde(skip_serializing_if = "Routes::is_zero")] pub routes: Routes, } @@ -2319,6 +2321,22 @@ mod tests { assert_eq!(output["wire_rx"], 29); } + /// A label that never routed writes no `routes` and reads back as zeros, and one count + /// writes the whole readout. + #[test] + fn presence_routes_stay_off_the_wire_until_counted() { + let mut presence = Presence::default(); + let output = serde_json::to_value(presence).unwrap(); + assert!(output.get("routes").is_none(), "{output}"); + assert_eq!(serde_json::from_value::(output).unwrap(), presence); + + presence.routes.closed.other = 1; + let output = serde_json::to_value(presence).unwrap(); + assert_eq!(output["routes"]["closed"]["other"], 1); + assert_eq!(output["routes"]["changed"], 0); + assert_eq!(serde_json::from_value::(output).unwrap(), presence); + } + #[test] fn outcomes_survive_clones_tier_changes_and_pruning() { let stats = test_stats(); diff --git a/rs/moq-net/src/stats/routes.rs b/rs/moq-net/src/stats/routes.rs index 360a8afb7b..b5f2a49404 100644 --- a/rs/moq-net/src/stats/routes.rs +++ b/rs/moq-net/src/stats/routes.rs @@ -171,6 +171,11 @@ pub struct Routes { } impl Routes { + /// Whether nothing has been counted. + pub(crate) fn is_zero(&self) -> bool { + *self == Self::default() + } + /// Add every counter from another readout. pub fn add(&mut self, other: Self) { self.changed += other.changed; diff --git a/rs/moq-quic/src/connection/waits.rs b/rs/moq-quic/src/connection/waits.rs index c9f3b7027b..20701dae6d 100644 --- a/rs/moq-quic/src/connection/waits.rs +++ b/rs/moq-quic/src/connection/waits.rs @@ -89,12 +89,11 @@ pub(crate) struct Waits { impl Waits { /// Register `waiter` for `wait` on stream `id` pub(crate) fn register(&mut self, id: StreamId, wait: Wait, waiter: &Waiter) { - let waits = self.streams.entry(id).or_default(); - waiter.register(waits.list(wait)); - // A no-op waiter registers nothing, so a poll for the answer alone keeps no entry. - if waits.is_empty() { - self.streams.remove(&id); + // A no-op waiter registers nothing, so a poll for the answer alone costs no entry. + if waiter.is_noop() { + return; } + waiter.register(self.streams.entry(id).or_default().list(wait)); } /// Wake the waiters for `wait` on stream `id`