Skip to content

test(moq-c): raw track reads hold no wall-clock budget - #8995

Merged
kixelated merged 2 commits into
mainfrom
quest/m0/test-flakes-3/c-raw-track-options
Nov 17, 2026
Merged

kixelated merged 2 commits into
mainfrom
quest/m0/test-flakes-3/c-raw-track-options

Conversation

@kixelated

@kixelated kixelated commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m0/test-flakes-3/c-raw-track-options.md and deletes it.

Problem

raw_track_subscription_options_and_update received two where it expected one under load. I traced it with the reader instrumented: the ordered reader reported 20000..20001 as an Old gap, then handed out group 40000. The library behaved as designed, and the test's premise was wrong in two ways:

  • The max_us: 25_000 budget runs on the wall clock: a group is stale once its successor arrived a full budget ago (TrackState::superseded). Any suite stall over 25 ms between publishing and subscribing ages one out.
  • The "far ahead" open range is MOQ_ANCHOR_ABSOLUTE 100,000,000, which maps to Anchor::Time, meaning the group containing that time: the newest held, two. So two was always in range. That's why the reader moved on to it instead of waiting, and why the old update ("widen to 40001, then read two") never showed the update doing anything.

raw_track_time_anchor had the same wall-clock dependence on a 1 s budget.

Approach

  • Both tests use max_age_unlimited and delay.max_unlimited, so no budget runs on the wall clock and the read waits for each group.
  • The options test now expects one then two (the open range really starts at two). Its update replaces both ranges with one bounded range ending at 60000. It then publishes three and four and checks that the read delivers three and then ends on its own (terminal 0, cancel refused). That makes the update's effect observable.

Impact

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

Validation

  • Reproduced at base: running the whole moq-c unit binary (test::) in one process 20 times failed this test 20/20 on this host (the quest saw 6/20).
  • Deterministic cause check: a 1.5 s thread::sleep before subscribing makes both original tests fail every time (two instead of one). The rewritten tests pass with the same sleep.
  • After the fix, the same 20-run loop gave 0/20 failures for these tests. The only failure in that loop was route_broadcast_survives_id_reuse, which documents that it needs nextest's process-per-test, so it is an artifact of the loop and not a flake.
  • just check passes.

Alternatives

  • Driving a paused or manual clock: moq-c's tests run on the library's global runtime and cache pool, which have no clock injection. An unlimited budget removes the clock from the test entirely, which is simpler.
  • A larger finite budget: still wall-clock, only rarer.

Caused by

  • moq-dev/moq#8638 - turned the absolute anchor into a time anchor, so the far open range (formerly an exact group 100 that never existed) began containing two. From then on, a wall-clock drop of one handed out two (found by check). The 25 ms budget itself came from moq-dev/moq#7697.

Follow-ups

None.

Models

Size: S
Implementer: Claude Code, claude-opus-5-5, medium effort

(Written by Claude Opus 5.5 with medium)

Review

Rewritten by quest review after each round.

  • Head: b098785

  • Base: origin/main at 0051c3d

  • 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: 01a1e90e-e16e-7170-9d9b-1abde4b21ef0, round 1

  • Score: 9/10, Source inspection found no actionable regressions in the test changes, with remaining uncertainty limited to execution validation because tests were not run as instructed.

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

  • Findings: none

kixelated and others added 2 commits November 17, 2026 02:02
…e ends the read

The options test's 25 ms max_us aged group one out whenever the suite
took longer than that between publishing and subscribing, and the far
open range (a time anchor, containing the newest group) then handed out
two first. The time anchor test had the same dependence on a 1 s budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title moq-c's raw track options test reads its first group under load test(moq-c): raw track reads hold no wall-clock budget Nov 17, 2026
@kixelated
kixelated marked this pull request as ready for review November 17, 2026 10:31

@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: the full diff of the 2 changed files.

  • Unlimited budgets in raw_track_subscription_options_and_update and raw_track_time_anchor: both tests now use max_age_unlimited and delay.max_unlimited, so no wall-clock budget can age out one.
  • Corrected expectations: the options test now expects one then two, because the open range starts at the newest group held.
  • Observable update: the update replaces both ranges with one bounded range ending at 60000. The test then publishes three and four and checks that the read delivers three and ends on its own (terminal 0, cancel refused).
  • Quest file removed: c-raw-track-options.md is deleted as the quest is finished.

I read the diff but didn't run the tests. The author reports 20/20 failures at base and 0/20 after the fix, and the reasoning in the diff holds up.

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

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Automated review by review (OpenAI)

Reviewed head b098785927e0c7d73102dd3938a979e3d4bbad8e.

Go. Unlimited budgets remove the scheduling assumption without changing what the time anchors mean. The revised fixture proves the update actually replaces the open range: without the update it can receive four, rather than ending cleanly after three. The terminal-before-cancel assertion is race-safe by inspection: the raw reader removes its handle before it invokes the terminal callback. Other fixtures retain successful cancellation coverage. Static review; the 20-run result is from the PR's validation, not an independent rerun.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The raw-track subscription test now uses unlimited track age and subscription delay. It reads groups one and two, updates the ranges, and verifies that it receives three but not four before the read ends. The time-anchor test also uses unlimited track age and delay. The pull request removes the document describing an intermittent moq-c test failure.

Merge Risk: Minimal · up to b0987

This updates two moq-c tests to stop depending on wall-clock read budgets and removes a note about the flaky test. It has no production, API, or wire impact, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the test(moq-c) scope and the core change: raw track reads no longer depend on a wall-clock budget. The summary shows both tests switched to unlimited track age and delay, which matche…
Description check Passed The description explains the flaky moq-c test, the wall-clock budget cause, the anchor behavior, the rewritten tests, and the validation. It matches the changeset, which deletes the quest doc and rewr…
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 test(moq-c) scope and the core change: raw track reads no longer depend on a wall-clock budget. The summary shows both tests switched to unlimited track age and delay, which matches the title. The title is specific and concise, and it describes the primary change.

Full details: Description check

Explanation

The description explains the flaky moq-c test, the wall-clock budget cause, the anchor behavior, the rewritten tests, and the validation. It matches the changeset, which deletes the quest doc and rewrites the two tests in test.rs.

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: d7458f5e-dda6-4419-b9f8-767d8c6f88bf
Commits

Reviewing files that changed from the base of the PR and between dac066a and b098785.

Files selected for processing: 2

  • quest/m0/test-flakes-3/c-raw-track-options.md
  • rs/moq-c/src/test.rs
Files with no reviewable changes: 1

  • quest/m0/test-flakes-3/c-raw-track-options.md

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

@kixelated
kixelated added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit ecdbb3d Nov 17, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m0/test-flakes-3/c-raw-track-options branch November 17, 2026 10:43
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