Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,10 @@ path = "junit.xml"
slow-timeout = { period = "300s", terminate-after = 3 }
retries = 0
failure-output = "immediate-final"

# A sweep run past its gate count on purpose, such as `MOQ_ROUTE_SCENARIOS=20000
# just rs test -P sweep ...`, takes minutes. Still bounded, so a lost wakeup
# ends in a TIMEOUT rather than a wedge.
[profile.sweep]
slow-timeout = { period = "60s", terminate-after = 60 }
retries = 0
10 changes: 2 additions & 8 deletions quest/m2/cluster-routing/routes/handoff-revival.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ the same whichever neighbours the router believes. It has not been traced.
Decided the same day (maintainer, /quest-plan): ✅ plan it.

- Reproduce it: the sweep draws every scenario from one random stream, so run
the first 16,317. Record the scenario's steps as it runs and remove them
one at a time while the revival remains, as
[the false END](/quest/m2/cluster-routing/routes/widen-false-end.md) was
shrunk.
the first 16,317 with `MOQ_ROUTE_SCENARIOS=16317`. Record the scenario's
steps as it runs and remove them one at a time while the revival remains.
- Decide whether it is a revival the contract forbids or one it excuses: a
replay after a collection or a restart is allowed only until the
withdrawal behind it lands
Expand All @@ -31,7 +29,3 @@ Decided the same day (maintainer, /quest-plan): ✅ plan it.
pin it as a `residual_` test naming that quest instead of fixing it twice.

Public API: none. Wire: none.

## Related

- [Widening an interest ends no live claim](/quest/m2/cluster-routing/routes/widen-false-end.md) - found the same way, and adds the way to run more scenarios
1 change: 0 additions & 1 deletion quest/m2/cluster-routing/routes/interest-set.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,3 @@ Public API: none (the router is crate-private). Wire: none.
## Related

- [The router keeps a route per scope](/quest/m2/cluster-routing/routes/scope.md) - rewrites how the router keeps a floor per prefix; whichever lands second adapts
- [Widening an interest ends no live claim](/quest/m2/cluster-routing/routes/widen-false-end.md) - a false END on an interest change today, which the edit in place may remove
93 changes: 0 additions & 93 deletions quest/m2/cluster-routing/routes/widen-false-end.md

This file was deleted.

11 changes: 8 additions & 3 deletions rs/moq-net/src/route/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ pub(crate) struct Shown<A> {
/// Whether the node has a usable route to the claim's origin through a
/// neighbor certifying it.
pub available: bool,
/// Whether the claim sits at the root of a region its view was presented at,
/// where it stands for whichever claim covers that region.
pub presented: bool,
}

/// A change a node's announcement reader sees.
Expand Down Expand Up @@ -1971,11 +1974,12 @@ impl<N: Key, A: Clone + Eq + fmt::Debug> Router<N, A> {
.as_ref()
.is_some_and(|regions| !regions.iter().any(|region| within(claim, region)))
|| !ctx.own && self.views.get(&id).is_none_or(|view| view.as_of(claim).is_none());
// A claim presented at a narrower interest moved up to the claim it
// stood for, which is still shown.
// A claim presented at a narrower region moved up to the claim it
// stood for, which is still shown. That claim may have changed
// meanwhile, so a presented claim needs only something shown above it.
let moved = ancestors(claim)
.filter(|above| above != claim)
.any(|above| shown(&above).is_some_and(|now| now.item == was.item));
.any(|above| shown(&above).is_some_and(|now| was.presented || now.item == was.item));
let kind = if !within(claim, &self.watch) {
Kind::Unwatched
} else if ctx.live && !uncertified && !moved {
Expand Down Expand Up @@ -2056,6 +2060,7 @@ impl<N: Key, A: Clone + Eq + fmt::Debug> Router<N, A> {
Some(Shown {
item: item.clone(),
available,
presented: merged.is_some_and(|merged| merged.floors.contains_key(claim)),
})
};
claims.map(|claim| (claim.clone(), at(claim))).collect()
Expand Down
52 changes: 50 additions & 2 deletions rs/moq-net/src/route/tests/handoff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,54 @@ fn a_claim_above_an_interest_is_presented_at_it() {
sim.check().unwrap();
}

/// A client presented a claim at a narrow interest widens it after the claim
/// changed, while cut off from the change. Its stale presentation may come
/// back first, and moves up to the changed claim without ending.
#[test]
fn widening_past_a_changed_claim_moves_it_up() {
let (origin, relay, client) = (0, 1, 2);
let mut sim = Sim::new(3);
sim.leaf(origin);
sim.leaf(client);
sim.join(origin, relay, 1);
sim.join(client, relay, 1);
sim.originate(origin, 7, 0);
sim.announce(origin, "live/", 0, None);
sim.watch(client, "live/b/z");
assert!(sim.run());
assert_eq!(sim.shows(client, 7, "live/b/z"), Some(true));

sim.disconnect(client, relay);
sim.announce(origin, "live/", 1, None);
sim.watch(client, "");
assert!(sim.run());
sim.connect(client, relay);
assert!(sim.run());
assert_eq!(sim.shows(client, 7, "live/"), Some(true));
assert_eq!(sim.shown(client).len(), 1);
assert_eq!(false_ends(&sim.events), 0);
}

/// A claim withdrawn below one its origin still has ends: the claim above
/// covers its path but is not the claim it was.
#[test]
fn a_claim_withdrawn_under_a_live_one_ends() {
let (origin, relay, client) = (0, 1, 2);
let mut sim = Sim::new(3);
sim.leaf(origin);
sim.leaf(client);
sim.join(origin, relay, 1);
sim.join(client, relay, 1);
sim.originate(origin, 7, 0);
sim.announce(origin, "live/", 0, None);
sim.announce(origin, "live/a/x", 0, None);
assert!(sim.run());

sim.unannounce(origin, "live/a/x");
assert!(sim.run());
assert_eq!(life(&sim, client, "live/a/x"), [Kind::Start, Kind::End]);
}

/// Two origins hold the same wildcard capability for one epoch, and a client
/// watches a region below it. Withdrawing one origin's wildcard ends only that
/// origin's claim, and a lagging relay's older copy of it is refused after the
Expand Down Expand Up @@ -1015,7 +1063,7 @@ fn sweep_scoped_handoff() {
let (origin, r1, r2, client) = (0, 1, 2, 3);
let mut rng = XorShift(0x5c0b_ed00);
let mut live_starts = 0;
for scenario in 0..150 {
for scenario in 0..scenarios() {
let mut sim = Sim::new(4);
sim.leaf(origin);
sim.leaf(client);
Expand Down Expand Up @@ -1132,7 +1180,7 @@ const CLAIMS: [&str; 4] = ["live/", "live/a/", "live/a/x", "live/b"];
#[test]
fn sweep_handoff() {
let mut rng = XorShift(0x4a4d_0ff5);
for scenario in 0..150 {
for scenario in 0..scenarios() {
let mut sim = churn(&mut rng);
let label = format!("scenario {scenario}");
assert_eq!(revivals(&sim.events), 0, "{label}");
Expand Down
8 changes: 8 additions & 0 deletions rs/moq-net/src/route/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,14 @@ impl Sim {
}
}

/// How many scenarios a sweep runs: `MOQ_ROUTE_SCENARIOS`, or the gate's 150.
/// Each sweep draws its scenarios from one seeded stream, so a larger count
/// replays the gate's first and continues past them. Run a large count under
/// nextest's `sweep` profile (`just rs test -P sweep`), which waits up to an hour.
pub(super) fn scenarios() -> usize {
std::env::var("MOQ_ROUTE_SCENARIOS").map_or(150, |count| count.parse().expect("MOQ_ROUTE_SCENARIOS"))
}

pub(super) struct XorShift(pub u64);

impl XorShift {
Expand Down