Skip to content

test(web): wait for the Watch Party fallback call before checking it - #3708

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
blurbery:test/watchpage-fallback-race
Nov 9, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
blurbery:test/watchpage-fallback-race

Conversation

@blurbery

@blurbery blurbery commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: none

The Watch Party test "retains the refusal without looping when no shared fallback exists" fails now and then on CI with expected "vi.fn()" to be called 1 times, but got 0 times. It failed in "ci / Web test (1/4)" on #3704, which doesn't touch the player. This change makes the test deterministic. It doesn't change the player.

The test waited for the refusal text and then expected exactly one fallback call. The text isn't a sign that the fallback has run, though. When the Watch Party gate mounts the player, the player's first commit already shows the refusal. The fallback effect runs after that commit and then waits on a capability check before it calls fallbackSource. If that first commit lands, waitFor matches the text and the test checks the count before the effect has got that far. That's 0 calls.

Approach

The test now waits for the fallback call first. It then waits for the refusal to come back, which only happens once the rejected fallback clears the pending state, and checks that the "Finding a compatible version" message is gone. That makes the "retains the refusal" part of the name a real check rather than a match on the first frame.

For the no-loop part, the rerender now passes a fresh room object. Before, the room object was the same one, so the effect never ran again and the guard against a second request was never exercised. With a new object the effect runs again. If it got past the guard, it would set the pending state synchronously inside rerender's act(). So straight after the rerender the test checks that the refusal is still shown, the pending message isn't, and there's still one call. There are no timers or sleeps.

I checked the sibling tests in the same block. The per-role test waits for the call before it checks the pending message, and the other two only assert that something wasn't called. None of them have this race, so I left them alone.

Validation

  • pnpm exec vitest run src/player/components/WatchPage.test.ts: 19 passed, six runs.
  • Reproduced the CI failure by delaying the mocked capability check by 20 ms in this test. The old test failed with the same "got 0 times" error and the new test passed. The delay isn't committed.
  • Removing the fallbackHandledRef guard in WatchPage.tsx makes the new test fail, so the no-loop check catches a second request. The old test passed with the guard removed.
  • Prettier and ESLint are clean on the test file.
  • Full web and Go suites: left to CI.

Evidence

Evidence: none, no user-visible change

Risks

None identified. Only the test changes.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code (desktop app)
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5
  • Involvement: AI-assisted. AI-assisted with Claude Opus. I directed the task and designed the work.
  • Adversarial review: n/a

Note

Make Watch Party fallback refusal test wait for the fallback call

Reworks the fallback refusal test in WatchPage.test.ts. The test now waits for the fallback request before asserting the refusal state, stores the refusal text for reuse, and verifies that no pending fallback message appears. It also rerenders with a fresh room object and confirms no second fallback request occurs.

Macroscope summarized cc8d6cd.

The "retains the refusal" test waited for the refusal text and then
expected one fallback call. The player's first commit shows the refusal
before the fallback effect runs, so on a slow runner the text matched
before the call and the test failed with 0 calls.

Wait for the call first, then for the refusal to come back after the
rejected fallback. Rerender with a fresh room object so the effect runs
again and the loop guard is what keeps the count at one.
@silo-triage silo-triage Bot added the size/S 0–49 added + deleted lines (all files); change volume, not priority. label Nov 9, 2026
@silo-kody

silo-kody Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Code Review Could Not Complete ⚠️

The review failed before suggestions could be generated.

Reason: Transient error reaching the provider (openai_compatible). Try again.

openai_compatible · gpt-6.1-terra · HTTP 503 · generalist

Provider said: auth_unavailable: no auth available (providers=codex, model=gpt-6.1-terra; last upstream error: unauthorized: token: [REDACTED] "type": "invalid_request_error", "param": null, "code": "refresh_token_expired" } })

After fixing the issue, comment @kody review on this PR to re-run the review.

Silo Kody — review incomplete

This review did not finish. Resolve the error reported above, then retry with @kody start-review in a PR comment. Treat any comments already posted as a partial review.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Access your configuration settings here.

​

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The fallback-refusal test waits for the fallback request, then checks the refusal and pending messages before and after rerendering with a fresh room object. It retains the assertion that only one fallback request occurred.

Changes: Fallback refusal test

Layer / File(s) Summary
Refusal state checks
web/src/player/components/WatchPage.test.ts
The test checks the refusal message and absence of the pending message after the fallback request completes and again after rerendering with a fresh room object. It retains the single-request assertion.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Other

Suggested labels: javascript

Suggested reviewers: quick104

Merge Risk: Minimal · up to cc8d6

The test update has no identified merge-blocking risk.

Architecture risk: Low · up to cc8d6

The change affects 1 system.

Changed systems: web

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — web (ui) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in web/src/player/components/WatchPage.test.ts: The test now waits for the fallback request before asserting the refusal message and absence of the pending message. It then rerenders with a fresh room object and checks those messages again; the existing single-request assertion remains after this block.
Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title names the change: a test fix that makes the test wait for the Watch Party fallback call before checking it. It matches the main change in the changeset, which reworks the fallback refusal te…
Description check Passed The description states the problem (a flaky Watch Party test that checks the fallback call count before the fallback effect runs), the approach (wait for the fallback call, check the refusal returns, …
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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 fix that makes the test wait for the Watch Party fallback call before checking it. It matches the main change in the changeset, which reworks the fallback refusal test in WatchPage.test.ts. The title is specific and concise, and it uses the conventional test(web) prefix.

Full details: Description check

Explanation

The description states the problem (a flaky Watch Party test that checks the fallback call count before the fallback effect runs), the approach (wait for the fallback call, check the refusal returns, and rerender with a fresh room object to test the no-loop guard), and the validation steps. It is directly related to the changeset.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. 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 0 functions across 1 files.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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: 312b1ea5-c8b8-4315-a160-1e13ff649bc3
Commits

Reviewing files that changed from the base of the PR and between 4018816 and cc8d6cd.

Files selected for processing: 1

  • web/src/player/components/WatchPage.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.

@coderabbitai coderabbitai Bot added the javascript Pull requests that update javascript code label Nov 9, 2026
@Quick104

Quick104 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

🤖 Claude Code (claude-opus-5-5)

Review of cc8d6cd: no findings. This change only touches the test and makes it deterministic.

What I checked

  • The race is real. WatchPage sets the pending fallback state and then waits on playbackCapabilitiesV2 before it calls fallbackSource, so the refusal text can be on screen while the call count is still 0.
  • I added a 20 ms delay to the capability mock in this one test, and the test on main failed with the same CI error (expected "vi.fn()" to be called 1 times, but got 0 times). The test on this branch passed with the same delay.
  • Removing the fallbackHandledRef.current === fallbackKey guard from WatchPage.tsx makes this branch's test fail. The test on main still passed without the guard, so the no-loop check is new coverage, not a reworded one.
  • The whole WatchPage.test.ts file passes (19 tests), Prettier and ESLint are clean, and the head passed the test 3 times in a row.
  • The sibling tests in the Watch Party source fallback block either wait for the call before checking state or only assert that something wasn't called, so they don't share this race.

Other feedback: CodeRabbit left no comments. The failed Kody check was a provider outage on Kody's side and isn't related to this branch.

Validated features: none affected. The change only touches tests.
User manual: unaffected.
Apple/Android parity: not applicable.

Fit: 9/10 · Readiness: 9/10 — ready

  • Fit: fixing a flaky CI test is the kind of correctness work the project wants now, and the change stays inside the one test.
  • Readiness: I reproduced the CI failure against the old test and confirmed that the new test passes. The new test also catches a regression the old one missed.

@silo-triage silo-triage Bot added bug Something isn't working priority: P2 Limited scope, workaround exists, or polish labels Nov 9, 2026
@Quick104
Quick104 merged commit 1eaafc4 into Silo-Server:main Nov 9, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish size/S 0–49 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants