Skip to content

A stuck source clock's arrival deltas are exact - #9274

Merged
kixelated merged 2 commits into
mainfrom
quest/m0/test-flakes-3/publish-stuck-clock-delta
Nov 21, 2026
Merged

kixelated merged 2 commits into
mainfrom
quest/m0/test-flakes-3/publish-stuck-clock-delta

Conversation

@kixelated

@kixelated kixelated commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m0/test-flakes-3/publish-stuck-clock-delta.md (deleted here).

Summary

TrackProcessor now rounds each frame's timestamp to whole microseconds, in the worker path (Epoch.stamp) and the <video> fallback. The arrival comes from msg.at - performance.timeOrigin, so MediaClock.capture(at).asMicros() carried float error that depended on the wall clock; a VideoFrame timestamp is an integer a browser truncates, so a frame could land 1µs early. The test asserts the first timestamp is an integer; its exact-delta assertions are unchanged, and no toBeCloseTo.

The test's frozen base needed no change: the media timeline is microseconds since instant zero, so the error is about 1e-12µs and a rounded delta only moves if a fraction lands within that of .5.

Validation

  • Reproduced before the fix: bun test src/video/processor.test.ts in js/publish failed 4 of 6 runs (Expected: 10000, Received: 9999.999999999998).
  • After: 100 of 100 runs pass; the full @moq/publish suite (448 tests) and just check pass.

Public API / Wire

None. Timestamps were fractional microseconds before and are now whole; no consumer depends on the fraction.

Caused by

  • moq-dev/moq#9169 - routed the arrival through MediaClock.capture(at).asMicros() and the arrived - instant slew term, which let wall-clock-dependent float error into frame timestamps (found by check).

Notes

moq-dev/moq#9236 also edits this quest's Plan; this PR deletes the quest, so whichever lands second needs a trivial merge (drop the file).

Models

Size: XS
Implementer: Claude, claude-sonnet-5-5, high effort (arm A)

Review

Rewritten by quest review after each round.

  • Head: 4f8a52b

  • Base: origin/main at 9f3c781

  • Risk: medium, Rounding video timestamps changes shipped publishing behavior and could affect frame timing for @moq/publish users, but preserves the API and wire format and is fully undone by a revert.

  • Classified: medium by Codex, gpt-6.1-sol, low effort, session 01a1fbb4-e4bd-74b2-9b68-de5e7920b558

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

  • Session: 01a1fbb5-02f9-7751-a86a-113ff8641b87, round 1

  • Score: 9/10, Static review found no actionable regressions in the focused timestamp rounding change and matching assertion; builds and 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 20, 2026 17:18
@kixelated
kixelated marked this pull request as ready for review November 21, 2026 01:25

@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.

Approach: sound. It rounds at the point where the timestamp is produced, so the worker and <video> paths both emit whole microseconds, as a VideoFrame stores them. That fixes the cause of the float error instead of loosening the test.

Reviewed changes

Reviewed the full diff in this run.

  • Epoch.stamp: wraps the computed timestamp, both the stuck and non-stuck branches, in Math.round. Rounding is monotonic, so frame ordering is preserved.
  • <video> fallback: rounds MediaClock.capture(at).asMicros() before building the VideoFrame.
  • Test: asserts the first timestamp is an integer. The exact 10_000µs delta assertions are unchanged.
  • Quest file: the completed quest doc is deleted.

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

@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The video processor now rounds timestamps to whole microseconds in the epoch and video-element fallback paths before creating VideoFrame objects. The stuck-source-clock test now checks that the first emitted frame timestamp is an integer. A document describing the flaky test and proposed investigation was removed.

Merge Risk: Minimal · up to 4f8a5

Video frame timestamps become whole microseconds, which removes a flaky floating-point delta in the stuck-clock test. Impact is narrow and easy to revert, so merge-readiness risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "A stuck source clock's arrival deltas are exact" describes the main goal of the change: the stuck-source-clock test now checks exact arrival deltas, which the fix enables by rounding frame …
Description check Passed The description explains the change in detail. It covers rounding in Epoch.stamp and the
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 "A stuck source clock's arrival deltas are exact" describes the main goal of the change: the stuck-source-clock test now checks exact arrival deltas, which the fix enables by rounding frame timestamps to whole microseconds. The title is specific and matches the changeset. It does not name the mechanism (rounding), so it is a little indirect, but it is still related to the main change.

Full details: Description check

Explanation

The description explains the change in detail. It covers rounding in Epoch.stamp and the <video> fallback, the floating-point cause, the test assertion, validation results, and the deleted quest file. It matches the changeset and is not off-topic.

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: de32d071-9c9a-4e5a-ab31-ff497a47f4c0
Commits

Reviewing files that changed from the base of the PR and between 9f3c781 and 4f8a52b.

Files selected for processing: 3

  • js/publish/src/video/processor.test.ts
  • js/publish/src/video/processor.ts
  • quest/m0/test-flakes-3/publish-stuck-clock-delta.md
Files with no reviewable changes: 1

  • quest/m0/test-flakes-3/publish-stuck-clock-delta.md

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

@kixelated
kixelated added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit 9b22abb Nov 21, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m0/test-flakes-3/publish-stuck-clock-delta branch November 21, 2026 02:15
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