Skip to content

test(moq-relay): bitrate cap tests run on the QUIC simulator - #8812

Merged
kixelated merged 3 commits into
mainfrom
quest/m1/bitrate-cap-sim
Nov 15, 2026
Merged

kixelated merged 3 commits into
mainfrom
quest/m1/bitrate-cap-sim

Conversation

@kixelated

@kixelated kixelated commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m1/bitrate-cap-sim.md, which this PR deletes.

Summary

The tokio half of rs/moq-relay/tests/integration/bitrate_caps.rs now serves on kio's QUIC simulator (quic_sim, #8709), so the capped transfer's time is exact and asserted within a window in simulated time, and neither tokio test waits on the real clock. The io_uring half stays on real sockets and keeps its lower bound.

  • A Dial enum names where a relay is and builds its clients and raw QUIC endpoint (Real for io_uring, Sim for the simulator), so the transfer and SETUP-window bodies are shared by both halves.
  • The sim relay is quic_sim::serve over Auth::embedded, answered through Admissions as before; quic_sim exports the pieces it reuses.
  • window_opens_once_admitted no longer spawns a task (the sim spawn is not tokio's): the blocked write is polled alongside each wait.
  • bitrate_caps now builds only with test-support or the io_uring workers, since each of its listeners needs one.

Impact

Public API: none. Wire: none. Test-only.

Validation

  • cargo test -p moq-relay --features test-support,io-uring --test integration -- bitrate_caps: all 4 pass (sim and io_uring, 2.4 s total; the sim pair 0.7 s).
  • Measured in simulated time: a 2 MiB frame under a 1 MB/s cap takes 1.125 s (capped publisher) and 1.157 s (capped subscriber), against the window 700 ms..=2.097 s.
  • Mutation checks, both fail as intended: a publisher cap of RATE / 4 takes 7.5 s (above the window); no cap takes 672 ns (below it).
  • cargo clippy --tests is clean with default features, io-uring, test-support alone, and --all-features.

Decisions

Choices made without asking, each open to review:

  • Upper bound is FRAME * 8 / RATE (2.097 s): the time at the cap with no burst credit at all, so anything slower is throttled below the cap. Observed is about 1.14 s, so this catches a throttle of roughly 2x or worse; a tighter bound (say 1.5 s) would catch a 30% throttle at the cost of a number tied to the simulator's pacing. Recommendation: keep the derived bound.
  • Lower bound stays LEAST (700 ms), unchanged.
  • The sim path is a clean, zero-latency link, with no loss or queue: the test checks the cap, not the network. Recommendation: keep it, since impairment would blur the window.
  • Dial carries real and sim variants rather than duplicating the bodies, with the cfg gating in main.rs. The alternative, two copies of transfer, was larger.
  • The sim relay runs Connection::run over quic_sim::serve and does not go through Relay::load, so the sim half no longer exercises Relay's own listener wiring (the [quic] config defaults); the io_uring half still does. Recommendation: accept, as the quest asks for the simulator and Connection::run is the admission and cap code under test.
  • ✅ Module doc of bitrate_caps.rs names the simulator and says it runs Connection behind a moq-tokio server, not Relay's listener (rejected: refuting Pullfrog's finding, since the doc's "tokio listener" wording was wrong for the sim half; rejected: adding a Relay-listener test to this file, outside the quest's goal). Recommendation: keep.

Follow-ups

None.

Models

Size: S
Implementer: Claude Code, claude-sonnet-5-5, high effort (iterate, S, arm B)

Review

Rewritten by quest review after each round.

  • Head: 833a639

  • Base: origin/main at d09ca93

  • Risk: medium, the base has no RISK.md to name what is always high or customer-facing, so every change is medium

  • Classified: medium by default

  • Reviewer: Codex, gpt-6.1-sol, medium effort

  • Session: 01a1df2b-a013-7470-9cd9-92164930b7b5, round 2

  • Score: 10/10, The incremental change only clarifies the test documentation to accurately describe the simulator setup, with no actionable findings; builds and tests were not run as instructed.

  • Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

kixelated and others added 2 commits November 15, 2026 03:25
The tokio half of bitrate_caps now serves on kio's QUIC simulator and asserts the
capped transfer's time within a window in simulated time, so a throttle far below
the cap fails and the test no longer waits on the real clock. The io_uring half
stays on real sockets.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Relay bitrate cap tests run on the QUIC simulator test(moq-relay): bitrate cap tests run on the QUIC simulator Nov 15, 2026
@kixelated
kixelated marked this pull request as ready for review November 15, 2026 12:26
@kixelated
kixelated enabled auto-merge November 15, 2026 12:26

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one stale doc comment inline.

Reviewed changes

I reviewed the move of the tokio half of the relay bitrate-cap tests onto kio's QUIC simulator, plus the shared Dial plumbing.

  • Dial enum: Real (io_uring) and Sim variants build the clients, raw endpoint, URL, and address, so transfer, held_to_its_caps, and window_opens_once_admitted are shared by both halves.
  • Sim half: serves Connection::run through quic_sim::serve over Auth::embedded on a clean link, and asserts each capped transfer within LEAST..=FRAME * 8 / RATE in simulated time.
  • Window test: the blocked write is no longer spawned. It is a pinned future polled in a biased select! alongside each wait.
  • Gating: bitrate_caps builds only with test-support or the io_uring workers. sh/rs/select.sh turns on moq-relay/test-support (through the bench's required-features) and moq-relay/io-uring on Linux, so both halves stay in the merge gate.
  • quic_sim exports: PORT, PUBLISHER, SUBSCRIBER, ip, Relay, and serve become pub(crate) for reuse.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

@moq-bot
moq-bot Bot disabled auto-merge November 15, 2026 12:29
@moq-bot

moq-bot Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

quest land watch: ended this pull request's pick, disarming its auto-merge, since its head dafdc7d is held by finding by pullfrog[bot]: The module doc still says these tests cover "the tokio listener", but the sim half never builds a Relay. It runs `Conn (#8812 (comment)). Push a fix, or answer each by a thread reply or a comment linking its review or decision, then land it again.

(written by quest land watch)

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The bitrate-cap integration tests now use shared helpers for simulated QUIC and real io_uring transports. Simulator tests check lower and upper transfer-time bounds. io_uring tests check the lower bound and skip unsupported workers unless CI_STRICT is set. The module is compiled only with test-support or on Linux with _uring. Simulator test helpers in quic_sim.rs are now crate-visible.

Merge Risk: Minimal · up to 833a6

This is a test-only change that moves the tokio bitrate-cap tests onto the QUIC simulator and keeps the io_uring tests on real sockets. It does not alter production behavior, and the reported test runs pass. It is safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the bitrate cap tests in moq-relay now run on the QUIC simulator. The test(...) prefix matches the change type. It omits the io_uring half, which is a secondary detail…
Description check Passed The description states that the tokio half of bitrate_caps.rs now runs on the QUIC simulator and that the io_uring half stays on real sockets. It also names the Dial enum, quic_sim::serve, window_open…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the bitrate cap tests in moq-relay now run on the QUIC simulator. The test(...) prefix matches the change type. It omits the io_uring half, which is a secondary detail.

Full details: Description check

Explanation

The description states that the tokio half of bitrate_caps.rs now runs on the QUIC simulator and that the io_uring half stays on real sockets. It also names the Dial enum, quic_sim::serve, window_opens_once_admitted, and the test-support gating. These match the changeset. It also covers validation and decisions.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: edfaf16b-eaef-4692-a2cc-b3310800e5ad
Commits

Reviewing files that changed from the base of the PR and between dafdc7d and 833a639.

Files selected for processing: 1

  • rs/moq-relay/tests/integration/bitrate_caps.rs
Files skipped from review as they are similar to previous changes: 1

  • rs/moq-relay/tests/integration/bitrate_caps.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

…ay's listener

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

I reviewed what changed since the prior Pullfrog review (dafdc7d).

  • Module doc fix: the bitrate_caps.rs header now says the simulator runs the relay's Connection behind a moq-tokio server, not Relay's own listener. This resolves my earlier stale-doc comment.

Pullfrog  | View workflow run | Using claude-sonnet-5-5 | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 46f844a Nov 15, 2026
5 checks passed
@kixelated
kixelated deleted the quest/m1/bitrate-cap-sim branch November 15, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant