Skip to content

test(moq-c): keep the open range in the raw track update test - #7745

Merged
kixelated merged 1 commit into
mainfrom
fix/moq-c-raw-track-flake
Nov 3, 2026
Merged

kixelated merged 1 commit into
mainfrom
fix/moq-c-raw-track-flake

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Fixes the flaky test::raw_track_subscription_options_and_update in rs/moq-c/src/test.rs. The flake keeps knocking PRs out of the merge queue, including moq-dev/moq#7498, moq-dev/moq#7690, and moq-dev/moq#7722.

Cause

The test builds its update from a one-element widened array but spreads ..subscription, so ranges_len stays 2. moq-c then reads a second moq_range past the end of that stack array, which is undefined behavior in the test. Either way, the update drops the open far-ahead range. The test's own comment says that range keeps the read open. Without it, the read ends after delivering "two", and the consumer task removes itself. When that wins the race against the test's moq_consume_track_cancel, the cancel returns -27 (MOQ_ERROR_TRACK_NOT_FOUND) at the cancel assert.

The implementation behaves as documented: a read whose ranges have all ended closes, and the cancel then reports the consumer as gone. The bug is in the test, so only the test changes.

Fix

The update now passes [widened, ranges[1]] with ranges_len: widened.len(). That keeps the open range, as the comment intends, and the length matches the array. There are no sleeps and no timeout changes.

Reproduction

The loop runs the test binary 600 times with xargs -P 32 on a 24-core host:

Binary Runs Parallel Failures
main (e5ec95c) 600 32 72
main (e5ec95c), rerun 600 32 61
this branch 600 32 0
this branch 2400 48 0

Every failure on main was at test.rs:2285, the moq_consume_track_cancel assert, with left: -27.

Checks

  • just rs check-test -p moq-c: passed
  • quest review --base origin/main (Codex gpt-6.1-sol): 0 findings

Review

Head 97bbed0: quest review with Codex found nothing.

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

raw_track_subscription_options_and_update updated its subscription with a
one-element range array while `..subscription` kept `ranges_len` at 2, so
moq-c read a second range past the array's end. When the read ended after
"two", the task removed itself before the test cancelled it, and the cancel
returned MOQ_ERROR_TRACK_NOT_FOUND.

Pass the widened range alongside the open far-ahead range with a matching
length, as the test's comment intends.

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

@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 97bbed0 against base e5ec95c. No actionable findings. The updated test retains the open range and passes the matching array length while widening the bounded range.

Verification: static review of the patch and surrounding test and range semantics via GitHub. I did not run the test or reproduce the reported flake.

@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

Test-only fix for the flaky raw_track_subscription_options_and_update in rs/moq-c/src/test.rs.

  • widened now keeps the open range: the update is built from [widen(ranges[0]), ranges[1]] instead of a one-element array, and ranges_len: widened.len() replaces the inherited value. This removes the out-of-bounds moq_range read and keeps the read open so the moq_consume_track_cancel assertion no longer races the consumer's self-removal.

The fix matches the test's own comment at rs/moq-c/src/test.rs:2197 that an open far-ahead range keeps the read alive, and it closes the root cause (parse_subscription reads exactly ranges_len entries, api.rs:844) rather than papering over it. I checked the other moq_subscription constructions in this file: all use ranges_len: ranges.len(), and ..subscription appears nowhere else, so there is no sibling instance of the same mismatch. No sleeps or assertion changes.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The test now checks that widening the bounded subscription range from groups 1..2 to 1..3 preserves the existing open-ended range. The update uses a two-entry range array and sets ranges_len to match.

Merge Risk: Minimal · up to 97bbe

The test update preserves both subscription ranges and fixes the range-count mismatch. No actionable merge-blocking issue remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "test(moq-c): keep the open range in the raw track update test" matches the changeset. The raw summary says the update keeps the open-ended range when widening the bounded range from 1..2 to…
Description check Passed The description is directly related to the changeset. It explains the flaky test::raw_track_subscription_options_and_update in rs/moq-c/src/test.rs, identifies the cause (a one-element widened array w…
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 "test(moq-c): keep the open range in the raw track update test" matches the changeset. The raw summary says the update keeps the open-ended range when widening the bounded range from 1..2 to 1..3, and the objectives confirm the fix passes [widened, ranges[1]] with ranges_len matching the array. The title names the component and the specific change, and it stays within one sentence.

Full details: Description check

Explanation

The description is directly related to the changeset. It explains the flaky test::raw_track_subscription_options_and_update in rs/moq-c/src/test.rs, identifies the cause (a one-element widened array with ranges_len left at 2, which drops the open far-ahead range), describes the fix (passing [widened, ranges[1]] with ranges_len: widened.len()), and gives reproduction results and check outcomes. The level of detail is more than the check requires.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

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

Warning

Some tools did not complete. Review the errors below.

Clippy (1.99.0)

Clippy execution timed out

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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
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: 2ae5df76-9a98-46c7-bc25-b1e798b782d9
Commits

Reviewing files that changed from the base of the PR and between e5ec95c and 97bbed0.

Files selected for processing: 1
  • rs/moq-c/src/test.rs

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

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