From cc2e08dcd767c4b81fcc888e4e4571fe47796c7f Mon Sep 17 00:00:00 2001 From: AAA <35992542+TNTcraftHIM@users.noreply.github.com> Date: Wed, 25 Nov 2026 10:40:15 +0800 Subject: [PATCH] docs(adr): propose quiet topology improvement The canon asks for a topology that keeps improving by itself without disturbing what works, and that nobody tunes. ADR-0018 proposes how: records and a shadow planner first, direct voice, capacity learned from what a node carried, placement by proved facts, and one proved move at a time for repair and promotion, with each later stage justified by the records of the first. It rests on two surveys of primary sources and on three designers who worked from the requirements, the canon and the verified evidence without reading the repository; the evidence note records where they agree, where they differ and which measurements are still missing. The three earlier rules stay: no weighted score, no media probe of an idle pair, no periodic re-solve. --- docs/README.md | 1 + docs/adr/0018-quiet-topology-improvement.md | 113 +++++++++++++++ docs/research/topology-improvement-design.md | 143 +++++++++++++++++++ docs/todo.md | 21 ++- 4 files changed, 265 insertions(+), 13 deletions(-) create mode 100644 docs/adr/0018-quiet-topology-improvement.md create mode 100644 docs/research/topology-improvement-design.md diff --git a/docs/README.md b/docs/README.md index 2ac8299e5..71c313549 100644 --- a/docs/README.md +++ b/docs/README.md @@ -90,6 +90,7 @@ and [website preview and publishing](./operations/website.md). | 3.0 forwarding design and candidate delivery details | [Channel, room and activity forwarding](./research/channel-forwarding-plan.md) | | 3.0 target channel modes, authority and moderation | [Server hosting design](./research/server-hosting-plan.md) | | 3.0 design compared with designs written from requirements alone | [Clean-room design review](./research/clean-room-design-review.md) | +| How the topology should keep improving, and voice without a server | [Topology improvement evidence](./research/topology-improvement-design.md) | | Stereo verification and HDR-to-SDR assessment | [Media fidelity](./research/media-fidelity.md) | ## Shared conventions diff --git a/docs/adr/0018-quiet-topology-improvement.md b/docs/adr/0018-quiet-topology-improvement.md new file mode 100644 index 000000000..b852db2c8 --- /dev/null +++ b/docs/adr/0018-quiet-topology-improvement.md @@ -0,0 +1,113 @@ +# ADR-0018: Quiet Topology Improvement + +- Status: proposed +- Date: 2026-11-25 + +## Context + +The [canon](../canon.md#media-and-network) asks that the topology keep +improving by itself, judged by how playback goes, until every node has its +best upstream and downstream, and that it never disturb what works. It also +says that nobody tunes a network. + +Today a viewer is placed by fewest hops and stays there. A parent that plays +badly is not replaced until it fails, the one voluntary move is a single +shortcut to the source, forwarding capacity is a peer count that a person +sets, and a speaker's voice follows that count through relays. The +[evidence and three independent designs](../research/topology-improvement-design.md) +agree on what to add and on what to keep. + +## Decision + +The rules below are the design. The numbers are starting values, to be +corrected by the records of stage 0. + +1. **Record first.** Each endpoint reports once a second what it sent and + rendered per stream and per connection. The room authority keeps a decision + log, and the planner first runs in shadow: it logs the move it would make + and makes none. +2. **Health is frames, confirmed.** A viewer is unwell when it renders under + 90% of the frames the source sent over a window and loss or a freeze + confirms it. A static screen sends nothing and proves nothing, so only + active content counts toward a verdict. +3. **Voice goes direct.** A speaker sends to every listener it has a + connection with, with discontinuous transmission on. A pair that cannot + connect takes one relay hop through a node that forwards unchanged. Voice + ranks above screens. In a room with voice this mesh is the pool. +4. **The pool grows from demand.** Nothing is connected in advance across a + site. A viewer in a room without voice keeps one spare connection to an + eligible parent. A pair's last result is remembered, and an idle pair is + retired after a minute. +5. **Capacity is learned.** A node starts from a prior, the present default of + two. It gains one when every child has stayed healthy under real load, and + falls back when its sender reports a limit or its children suffer together. + What it proved is remembered for that device and network. No person sets or + sees the number. Whether a person forwards at all stays their choice. +6. **Placement is an order over proved facts.** Among eligible parents with + room: fewest re-encode generations, then fewest hops, then proved room + before a prior, then least load. Whether a node forwards unchanged is a + fact proved for that node, not a property of its platform. +7. **Two reasons to move, one move at a time.** Repair, when a viewer has + been unwell for a sustained period and blame says a move can help. + Promotion, when a place strictly better in generations or hops is open. + The switch is make-before-break, and its overlap is the only trial: the new + copy must render as well as the old one over the same seconds before the + old one stops. A failed trial marks that parent or pair, with a doubling + wait before it is tried again. +8. **Blame before repair.** Siblings unwell together mean the parent is full, + and its newest child leaves. A viewer unwell on streams from two parents is + limited locally and does not move. A viewer still unwell after two moves + stops moving. +9. **A silent parent is found from frames.** The source advances and the + child receives nothing for two seconds, or the parent leaves. Only the head + of the stalled subtree moves, over a connection that exists, and the + picture holds its last frame meanwhile. + +## What Stays + +No weighted route score, no media probe of a pair that carries nothing, and +no periodic re-solve of the whole tree. The evidence supports all three. What +they lacked was the continuous single move of decision 7. + +## Stages + +Each stage after the first needs the record named beside it. + +| Stage | Adds | Justified by | +| --- | --- | --- | +| 0 | Reports, decision log, shadow planner | Nothing; it produces the evidence | +| 1 | Direct voice, learned capacity, placement order, repair after failure | Removes the setting and the voice hops | +| 2 | Repair moves with blame | Parent or edge faults that outlast the trigger in a real share of unwell time | +| 3 | Promotions | Viewers deeper, or behind more generations, than proved capacity requires | +| 4 | Memory across days | Proved capacity that repeats from day to day | +| 5 | Moves for delay alone, relays for a speaker short of upload | Logs that show the gap | + +Stages 2 and 3 need a change to touch only the edge that changed. Today a +change of a relay's input gives every flow below it a new identity. + +## Not Built + +A speed test or any probe with dummy traffic. A second copy of a stream kept +ready on another path. A voice tree or ring. An exact tree solver as the +actuator; it may run on the records as a measure of the gap. Any number that +asks a person how much to forward. + +## Open Measurements + +The [evidence](../research/topology-improvement-design.md#measurements-that-decide) +lists them. Three decide parts of this record: the cost of one re-encoding +hop sets how hard decision 6 avoids a generation, idle audio connections on a +phone set whether decision 3 needs a ceiling, and whether a Chromium Browser +can forward encoded frames unchanged decides how many nodes count as +forwarders. + +## Consequences + +- The forwarding limit a person sets becomes a choice to forward or not. The + room default becomes the prior. +- Voice no longer depends on the room fanout, and a room with voice needs no + separate standby connections. +- The single shortcut per viewer is replaced by decision 7. +- [ADR-0005](./0005-automatic-hybrid-media-routing.md) and the + [forwarding design](../research/channel-forwarding-plan.md) keep their + owners and are amended stage by stage. diff --git a/docs/research/topology-improvement-design.md b/docs/research/topology-improvement-design.md new file mode 100644 index 000000000..c9654bbf2 --- /dev/null +++ b/docs/research/topology-improvement-design.md @@ -0,0 +1,143 @@ +# Quiet Topology Improvement: Evidence And Independent Designs + +- Date: 2026-11-25 +- Status: evidence for [ADR-0018](../adr/0018-quiet-topology-improvement.md), + not a decision. + +## Question + +The [canon](../canon.md#media-and-network) asks for a topology that keeps +improving by itself, judged by how playback goes, without disturbing what +works. Three earlier rules stood in the way for stated reasons: no weighted +route score, because an edge has too few samples; no probing of all pairs, +because a probe is a real media session; and no periodic rebalancing, because +it risks working playback. This note records what mature systems do about +those three difficulties and what three independent designers proposed. + +## What Mature Systems Do + +No system found faces all three difficulties at once. Each well-known +mechanism leans on a condition a room of friends lacks: a playout buffer of +many seconds, trial traffic that is useful in itself, hundreds of peers, or a +history over many sessions. + +- **Round-trip time is free, capacity is not.** The candidate pair's + round-trip time comes from connectivity checks, including consent checks, so + it exists on an idle pair. The available outgoing bitrate does not exist for + a pair that never sent media. + [WebRTC statistics](https://www.w3.org/TR/webrtc-stats/) · + [RFC 7675](https://www.rfc-editor.org/rfc/rfc7675.html) +- **A deployed single-tree broadcast** changed parent only when throughput + fell below 90% of the source rate and loss confirmed it. It lengthened the + detection time after recent changes. Loss seen by siblings at the same time + pointed at the parent, and a node that kept changing parent and still + suffered was itself the cause. + [End System Multicast, USENIX 2004](https://www.usenix.org/legacy/publications/library/proceedings/usenix04/tech/general/full_papers/chu/chu.pdf) +- **Comparing a loaded path with an idle one fails.** A multipath transport + did so, switched about once a minute, and lost most of its throughput. Its + maintainers concluded that minimum round-trip times should be compared and + that a switch needs a real margin. + [Path selection under load](https://github.com/n0-computer/iroh/issues/4644) +- **Sending on both paths until the new one is trusted** is how a mesh VPN + moves from a relay to a direct path, with a retry at most once a minute and + no switch for a marginal gain. + [magicsock](https://github.com/tailscale/tailscale/blob/main/wgengine/magicsock/endpoint.go) +- **Exploration budgets** such as the optimistic unchoke work where a trial is + cheap and useful. A relay-selection study for a large calling service + explored only at call setup, from history across calls, never mid-call. + [BitTorrent](https://bittorrent.org/bittorrentecon.pdf) · + [VIA](https://www.cs.cmu.edu/~junchenj/via.pdf) +- **Voice.** A tree per speaker saves a listener nothing, because each + listener still receives one copy of each speaker. It moves upload from the + speaker to relaying listeners and adds hops. A direct mesh of 20 needs about + 1 Mbps of upload from whoever is speaking, with discontinuous transmission + on. [RFC 7587](https://www.rfc-editor.org/rfc/rfc7587) + +## What The Literature Does Not Answer + +- What a viewer sees when a parent changes at sub-second latency. +- The delay and quality cost of a forwarder that decodes and encodes again, + for video and for Opus speech. +- Whether an adaptive overlay beats a static one at 2 to 50 nodes. +- What 7 or 19 idle audio connections cost a phone. +- Whether a Browser can forward encoded frames unchanged. Chrome shipped + constructors for encoded frames and named forwarding to another peer + connection as a use, while the specification still says a processor cannot + move frames between streams. + [Intent to ship](https://www.mail-archive.com/blink-dev@chromium.org/msg10120.html) · + [Encoded Transform](https://w3c.github.io/webrtc-encoded-transform/) + +## Three Independent Designs + +Each designer received the requirements, the canon's principles, the facts of +the platform and the evidence above, and read nothing in the repository. Two +received the same brief. The third was asked to test whether the conventional +answer is wrong for a group of 2 to 20. They are instances of one model +family, so their agreement marks a design worth testing, not a proof. + +All three agree on the following. The third designer concluded that the three +earlier rules were right in substance. + +- **Voice is a direct mesh at every size**, with discontinuous transmission + on and one relay hop only for a pair that cannot connect. In a room with + voice, that mesh is the connection pool: every pair is connected and its + round-trip time is known. +- **Nothing speculative across a site.** A viewer without voice keeps one + spare connection to an eligible parent. A pair's last result is remembered. +- **No weighted score.** Candidates are ordered lexicographically over proved + facts, with margins. +- **No separate media trial.** The overlap of a make-before-break switch is + the trial: the same frames in the same seconds on two paths, both loaded. +- **One move at a time per stream.** Every voluntary move strictly lowers a + bounded quantity, so moves end. +- **Blame before moving.** Siblings bad together mean the parent is full. A + node bad alone moves once, and a node still bad after moving is limited + locally and is left alone. +- **Capacity is learned, not set.** A node starts from a prior, grows by one + when every child stays healthy under real load, shrinks when its sender + reports a limit or its children suffer together, and its proved value is + remembered across days. +- **Health is frames rendered against frames the source sent**, confirmed by + loss or freezes. Freeze counters alone misfire on screen content. +- **Failure** is detected when the source advances and the child receives + nothing for about two seconds. Only the head of the stalled subtree moves, + over a connection that already exists. +- **Record first.** One report a second from each endpoint, a decision log, + and the planner run in shadow before it acts. +- **Not built:** media probes, speed tests, a periodic global re-solve, media + standby, voice trees, an exact solver as the actuator, and any capacity + number shown to a person. + +| Topic | Positions | +| --- | --- | +| Unit of capacity | Outgoing edges (one); the peak rate a node has carried (two) | +| Moves for delay alone | Allowed above 30 ms and 20%, or 50 ms and 25% (two); refused until logs show the gap (one) | +| Re-encode generations | At most one (one); at most two (one); ordered, not capped (one) | +| Depth | At most three (one); not capped (two) | + +## Compared With The Tree + +| Topic | The three designs | The tree | +| --- | --- | --- | +| Voice | Direct mesh, one relay hop for a failed pair | A tree per speaker under the room fanout | +| Pool standby | The voice mesh, or one spare per viewer | Ring neighbours and a bounded alternate | +| Capacity | Learned from what was carried | A peer count a person sets, 2 by default | +| Parent choice | Generations, then depth, then proved headroom | Fewest hops, ties by session identifier | +| Health | Rendered frames against source frames | Decoded frames in a window, which a static screen cannot supply | +| A parent that degrades | Repair after sustained evidence and blame | Never replaced until it fails | +| Voluntary improvement | Continuous, one proved move at a time | One shortcut to the source per viewer | +| Silent parent | About two seconds, from frame counters | Connection failure, up to the consent timeout | +| Proof before a switch | The overlap, both paths loaded | The same, already present | + +## Measurements That Decide + +1. The share of bad viewer-time caused by a parent or an edge, as opposed to + the viewer's own link. If small, placement and failure repair are enough. +2. How long an untreated bad episode lasts. +3. The cost of a switch on a pooled connection: time to proved render, and any + glitch at the cut. +4. The cost of one re-encoding hop: delay, resolution, frame rate. +5. Whether a node's proved capacity repeats from day to day. +6. A hop chain for voice, with a Native forwarder and with a Browser. +7. Idle audio connections on a phone, at 3, 7 and 19. +8. Whether a Chromium Browser can forward encoded frames unchanged. diff --git a/docs/todo.md b/docs/todo.md index 5c8e85ec6..b193d738a 100644 --- a/docs/todo.md +++ b/docs/todo.md @@ -231,19 +231,14 @@ the feedback period; they do not delay that delivery. ## Next -- [ ] **Design quiet topology improvement.** The - [canon](./canon.md#media-and-network) asks for a topology that keeps - improving by itself, judged by actual playback and by how well two nodes - suit each other, without disturbing what works. No design exists yet. Gather - primary evidence on how mature overlays measure, explore and stay stable, - then propose one. The earlier decisions against a weighted route score, an - all-pairs probe and periodic rebalancing are inputs to revisit with that - evidence, each with the reason it gave. The same design settles two shapes - it depends on. One is how dense the pool's standby connections should be: - they are ring neighbours and a bounded alternate today, and a denser mesh - would give faster repair and more candidates to improve with. The other is - voice, which follows the room fanout today and so reaches most listeners - over several hops. +- [ ] **Quiet topology improvement.** Decide + [ADR-0018](./adr/0018-quiet-topology-improvement.md): direct voice, + capacity learned from what a node carried, placement by proved facts, and + one proved move at a time for repair and promotion. Stage 0 comes first: a + report a second from each endpoint, a decision log and the planner in + shadow. Its records decide every later stage. The + [evidence](./research/topology-improvement-design.md) lists the + measurements still missing. - [ ] **Separate the canon from derived design in the documents.** Where a record states a founding idea beside defaults, numbers or mechanisms, link the [canon](./canon.md) and keep the derived design. Start with