Skip to content

test(publish): a late subscriber's test stamps capture on a mocked clock - #9532

Merged
kixelated merged 2 commits into
mainfrom
fix/publish-late-subscriber-clock
Nov 24, 2026
Merged

kixelated merged 2 commits into
mainfrom
fix/publish-late-subscriber-clock

Conversation

@kixelated

@kixelated kixelated commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The merge queue dropped moq-dev/moq#9523 when js/publish failed a late subscriber reaches captured audio with either encoding policy (undefined and "all"): the first group read started at 80000n, not 0n (job).

The test pushes capture frames stamped from 0, but the encoder's backlog expires them against MediaClock.now(), which counts from process start. The late subscription's 10s replay budget (within(10_000)) then drops all four retained frames once the bun process is more than 10s old, so the first group is the first live one, at 80ms. "off" passes because it encodes eagerly and retains nothing. Whether it fails depends on how long the runner took to reach this test.

Approach

Install a Manual clock at 0 (the file's existing manualAt), as the other retention tests here already do, so capture and the media clock share a timeline.

Impact

Test only. No public API, wire, or behavior change.

Caused by

  • moq-dev/moq#7656 - expired retained audio against the subscriber's budget on the real media clock, which this test (from moq-dev/moq#7238) never mocked (found by queue)

Validation

  • Reproduced on main: bun test --preload <11s delay> src/audio/encoder.test.ts -t "late subscriber" fails both variants with Received: 80000n, as in the queue. The full js/publish suite under the same preload fails only these two.
  • With the fix: the file passes under the 11s preload (61 pass), and the full js/publish suite passes.

Follow-ups

None.

Models

Size: XS
Implementer: Claude Code, claude-opus-5-5, high effort

(Written by Claude Opus 5.5 with high)

🤖 Generated with Claude Code

Review

Rewritten by quest review after each round.

  • Head: 21f0437

  • Base: origin/main at 35e6841

  • Risk: low, The only change is three added lines in one test file (js/publish/src/audio/encoder.test.ts) that install a manual clock at zero for a late-subscriber test; nothing a consumer or peer relies on reads test code, and a revert fully undoes it.

  • Classified: low by Claude Code, claude-haiku-5-5, low effort, session 3690ff4e-b510-48ae-be82-1219d3255bb9

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

  • Session: 01a20cf5-f303-7662-b4c3-47d27952ddc9, round 1

  • Score: 10/10, The manual clock aligns retention time with the feed’s zero-based timestamps without changing production contracts; code inspection found no issues, and tests were not run as instructed.

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

  • Findings: none

The test fed capture timestamps from zero while the encoder's backlog
expired them against the real media clock, which counts from process
start. Once the bun process was more than 10s old, the subscription's
10s replay budget expired all retained audio and the first group read
was the live one at 80ms, not the retained one at 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 24, 2026 09:50
@pullfrog

pullfrog Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

No configured credential can serve this run. Your Claude subscription has hit its usage limit, which resets at 2026-11-25 06:00 UTC. Re-trigger after it resets, or add an API key for this provider, which Pullfrog falls back to automatically.

The providers' responses
CLAUDE_CODE_OAUTH_TOKEN: 429: This request would exceed your account's rate limit. Please try again later.

Pick another model →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using claude-sonnet-5-5

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

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: 5f09742b-7dd3-4c6b-a71e-ce0fd505a5a0
Commits

Reviewing files that changed from the base of the PR and between 21f0437 and 1789890.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The late-subscriber test now sets a manual clock to zero before creating the broadcast and encoder.

Merge Risk: Minimal · previous review 21f04

This is a test-only change that makes a timing-dependent test deterministic. It does not affect production behavior, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: a test in js/publish, the late-subscriber test, now stamps capture on a mocked clock. This matches the test-only change that installs a Manual clock at zero in encoder.test…
Description check Passed The description explains the problem, which is a late-subscriber test failing because the encoder backlog expires against MediaClock.now() while capture frames start at zero. It states the approach of…
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 change: a test in js/publish, the late-subscriber test, now stamps capture on a mocked clock. This matches the test-only change that installs a Manual clock at zero in encoder.test.ts. The title is 72 characters, which is slightly long but readable.

Full details: Description check

Explanation

The description explains the problem, which is a late-subscriber test failing because the encoder backlog expires against MediaClock.now() while capture frames start at zero. It states the approach of installing a Manual clock at 0, the impact (test only), the cause, and validation steps. This directly relates to the changeset.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • 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: f02d8f5f-3119-49b7-9fa8-c3448fe31cd6
Commits

Reviewing files that changed from the base of the PR and between 35e6841 and 21f0437.

Files selected for processing: 1

  • js/publish/src/audio/encoder.test.ts

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

A new head drops the failed Pullfrog check its quota left on the old one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated added this pull request to the merge queue Nov 24, 2026
@pullfrog

pullfrog Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

No configured credential can serve this run. Your Claude subscription has hit its usage limit, which resets at 2026-11-25 06:00 UTC. Re-trigger after it resets, or add an API key for this provider, which Pullfrog falls back to automatically.

The providers' responses
CLAUDE_CODE_OAUTH_TOKEN: 429: This request would exceed your account's rate limit. Please try again later.

Pick another model →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using claude-sonnet-5-5

Merged via the queue into main with commit c14e942 Nov 24, 2026
4 of 5 checks passed
@kixelated
kixelated deleted the fix/publish-late-subscriber-clock branch November 24, 2026 17: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