Skip to content

test(scene): the looping media test holds under load - #181

Merged
kixelated merged 4 commits into
mainfrom
quest/m0/flaky-looping-media
Nov 16, 2026
Merged

kixelated merged 4 commits into
mainfrom
quest/m0/flaky-looping-media

Conversation

@kixelated

@kixelated kixelated commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Finishes quest/m0/flaky-looping-media.md: source::media_tests::a_looping_media_file_starts_over now passes however busy the host is.

Summary

The test jumped the paused clock from the first picture to 950 ms in one sleep. Pictures decode on moq-video's own thread, which tokio can't see, so while the runtime sat idle tokio auto-advanced the clock past the 800 and 900 ms moments before those pictures had decoded. The feed's slot then still held the 700 or 800 ms picture.

  • The play-once test already stepped the clock to one picture's moment at a time and waited for that picture there. That loop is now a shared helper, plays_on_time, and the looping test uses it too.
  • The loop's second play is now read at the first play's recorded end (Feed::run().ended) instead of at a fixed 1.1 s. That end is a little past 1 s because the clip's sound outlasts its last picture. Holding the clock at the end also stops the second play's next picture from replacing its first.
  • The source itself is unchanged. In a real run the clock is the wall clock, so a slow decoder only shows its pictures late, and the slot replacing an undrawn picture is the intended behavior under load. The skip only happens with a paused clock.

Public API and wire: none. Only test code changes.

Validation

  • Reproduced before the fix: the test binary 200 times, 16 at a time, beside stress-ng --cpu 96 on a 32-CPU host already at load 25 to 40. 34 of 200 runs failed at the 900 ms assertion, showing 700 ms (10) or 800 ms (24).
  • After the fix, same load and harness, each run under timeout 120: 200 of 200 passed.
  • My first version held the clock at exactly 1 s for the second play and hung, because that play begins after 1 s. A load run caught it, and the second commit fixes it. Both tests also pass once unloaded.
  • Whole source::media_tests:: module, 60 runs beside the same stress: 59 passed. The one failure was a hang in a different test, a_media_file_restarts_going_on_program; see Follow-ups.
  • just ci passed (check, plus 333 tests).
  • After merging main (the moq pin bump in fix: the Flatpak lists cameras again #173 and more): the conflict was main's Duration::try_from catch-up inside the loop this PR moved into plays_on_time; the helper now uses it. Both tests, 500 runs, 16 at a time, beside stress-ng --cpu 96 at load 81: 500 of 500 passed. just ci passed (359 tests).

Caused by

Follow-ups

  • quest/m0/flaky-media-restart.md [S]: a_media_file_restarts_going_on_program hung once in 60 module runs under the same load. The quest has a lead: the test holds the clock at a fixed 1.1 s, which may fall short of a play's end. No open decisions. Recommendation: keep it.

Models

Size: S
Implementer: Claude, claude-opus-5-5, unknown effort (arm A)
Implementer: Claude Code, claude-opus-5-5, low effort (iterate, XS, arm A)

🤖 Generated with Claude Code

Review

Rewritten by quest review after each round.

  • Head: e9a4cf6

  • Base: origin/main at f232c0b

  • 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: 01a1e145-264c-7f00-a922-8338b91db321, round 2

  • Score: 9/10, The merge preserves the previously reviewed test fixes, with no new actionable regression found by code inspection; builds and tests were not run.

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

  • Findings: none

  • Reviewer: Codex, gpt-6.1-sol, low effort, shadow

  • Session: 01a1e145-264c-7610-ab26-f7738d11c358

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

kixelated and others added 3 commits November 15, 2026 10:07
The test jumped a paused clock to 950 ms in one sleep. Pictures decode
on moq-video's own thread, which tokio cannot see, so while the runtime
sat idle the clock ran past 800 and 900 ms before those pictures
existed, and the slot still held 700 or 800 ms. Step the clock to one
picture's moment at a time and wait for it there, as the play-once test
already did, through a helper both share; then read the loop's start
at its end, before the second play's next picture can replace it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The second play begins at the first one's end, which its sound puts a
little past 1 s, so holding the clock at 1 s waited forever. Read the
end from the feed's run instead. Adds a follow-up quest for the restart
test, which hung once under the same load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title The looping media test holds under load test(scene): the looping media test holds under load Nov 15, 2026
@kixelated
kixelated marked this pull request as ready for review November 15, 2026 22:13
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 35 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

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: 76607e94-30ab-4cb4-b84d-a5ab17a8effe
Commits

Reviewing files that changed from the base of the PR and between f232c0b and e9a4cf6.

Files selected for processing: 3

  • quest/m0/flaky-looping-media.md
  • quest/m0/flaky-media-restart.md
  • rs/moq-scene/src/source.rs
  • 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

pullfrog[bot]
pullfrog Bot previously approved these changes Nov 15, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

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

Reviewed the test-only fix for the looping media flake and the quest bookkeeping around it.

  • Shared plays_on_time helper: the play-once test's loop, which moves the clock to one picture's moment at a time and waits for that picture there, is extracted unchanged and reused by the looping test in place of the single jump to 950 ms.
  • Second play read at the first play's end: the looping test waits with until(|| feed.run().ended) and then moves the clock to that end, instead of using a fixed 1.1 s. This cannot hang. For a loop, play_clip returns at ahead(end) (end − WRITE_LEAD, 50 ms), so run.ended is already set while the clock is held at 998 ms. ran records it once for the loop's cue.play, so it equals the second play's begin.
  • Quest files: the completed flaky-looping-media quest is removed, and flaky-media-restart is added for the restart-test hang found under the same load.

Note: the review shell has no quest binary, so quest context was not run.

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

@kixelated kixelated left a comment

Copy link
Copy Markdown
Contributor 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: 142af2c057a646621f627ccd95b08ae074a9f899.

No actionable issue found in the test-only change. Reviewed the extracted per-frame pacing loop, shown helper and second-play synchronization: the looping test now consumes each decoded picture before advancing instead of jumping past frames, and waits for the recorded playback end rather than assuming 1.1 seconds. Production source behavior is unchanged. Limits: static source review only; I did not rerun the decoder/load stress tests or the full suite.

# Conflicts:
#	rs/moq-scene/src/source.rs

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

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

Reviewed the merge of main into the branch since the approved 142af2c.

  • Merge resolution in plays_on_time: the shared helper now uses main's Duration::try_from(timestamp).unwrap() - Duration::try_from(first).unwrap(), the same as main's play-once loop. The test logic is otherwise unchanged.

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

@kixelated
kixelated merged commit 365cfad into main Nov 16, 2026
4 checks passed
@kixelated
kixelated deleted the quest/m0/flaky-looping-media branch November 16, 2026 10:49
kixelated added a commit that referenced this pull request Nov 16, 2026
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