From 0db681f3affe80b61d0cce0c373f91419d360f48 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 28 Sep 2026 10:43:16 -0700 Subject: [PATCH] quest(qos): block the line on the #4298 splice lag findings Co-Authored-By: Claude Opus 5.5 --- quest/m1/qos/README.md | 3 +++ quest/m1/qos/lag-splice.md | 39 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 quest/m1/qos/lag-splice.md diff --git a/quest/m1/qos/README.md b/quest/m1/qos/README.md index 1ac265ffa50..7490ca14fe9 100644 --- a/quest/m1/qos/README.md +++ b/quest/m1/qos/README.md @@ -33,6 +33,9 @@ preflight, consumes them downstream. ## Quests +- [Lag across a splice](/quest/m1/qos/lag-splice.md) - a route switch + neither loses pending lag weight nor keeps weighing a segment replaced + before its first frame - [Starvation at frame granularity](/quest/m1/qos/starvation-frames.md) - the acknowledged frontier moves at every frame boundary through `poll_acked`, with a delivery-delay histogram for jitter diff --git a/quest/m1/qos/lag-splice.md b/quest/m1/qos/lag-splice.md new file mode 100644 index 00000000000..c750cc9543a --- /dev/null +++ b/quest/m1/qos/lag-splice.md @@ -0,0 +1,39 @@ +# [S] Lag across a splice + +## Goal + +A spliced subscription's `lag` histogram stays exact across a route switch: +every byte the viewer could read is weighed once, and nothing a retired +segment produces afterwards is weighed at all, however early in its life the +segment was replaced. + +## Plan + +[#4298](https://github.com/moq-dev/moq/pull/4298) added the per-broadcast +viewer lag sampler (`FrontierInner::sample` in `rs/moq-net/src/stats.rs`) and +had a spliced subscription watch each segment's track +(`rs/moq-net/src/model/resume.rs`). Two Codex findings on its last round +merged unanswered, and the maintainer ruled in the 09-28 merged-PR audit that +both block the line: + +- **Pending weight is lost when the replacement has no frame yet** + ([r4113824520](https://github.com/moq-dev/moq/pull/4298#discussion_r4113824520)). + `sample` takes `state.unsampled` before it knows a source supplies `newest` + and `first`. When a capped segment folded bytes into `unsampled` and the + replacement has not produced, the `?` returns and those bytes are gone. + Keep the weight until a sample can record it, or keep the retired source's + edge alongside its weight. +- **A segment replaced before its first frame is never unwatched** + ([r4113824522](https://github.com/moq-dev/moq/pull/4298#discussion_r4113824522)). + `unwatch` runs only when an existing segment's `end` changes. A segment + the producer replaces outright is marked `pruned` and dropped through + `retired()` without it, so if its route keeps publishing, those + unreachable bytes keep weighing this viewer's lag. Unwatch on every path + that retires or replaces a segment, not just on a cap. + +Extend the existing splice lag test (`lag_weighs_every_segment`) or add +siblings so each case fails without its fix. + +## Related + +- [QoS](/quest/m1/qos/README.md) - the line this blocks