You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(twitter): handle missing source in broadcast stream status - #2789
When \live_video_stream/status\ returns an error/empty response without \source\ (or \source.location),
enderCard\ in \packages/atmosphere/src/providers/twitter/card.ts\ threw \TypeError: Cannot read properties of undefined (reading 'location')\ because it only checked \if (broadcastData).
Changes
Type \�roadcastData\ fields from \ witterFetch\ as optional/nullable and guard stream assignment with \if (broadcastData?.source?.location).
Downstream \processor.ts\ already handles an unset \�roadcast.stream\ via \card.broadcast.stream?.url ?? ''.
Add regression tests in \ est/api.broadcast.test.ts\ covering both v1 (/status/:id) and v2 (/2/status/:id) broadcast statuses when \live_video_stream/status\ omits \source, as well as preserving \�roadcast.stream.url\ when \source.location\ is present.
Verification
pm run build\ (@fxembed/atmosphere + worker esbuild) passed
No actionable comments were generated in the recent review.
Walkthrough
The broadcast response fields are optional, and the response may be null. Stream assignment now requires source.location. Tests cover v1 and v2 status endpoints when stream lookup returns an error, and verify that a valid stream URL is retained.
Changes: Broadcast stream response handling
Layer / File(s)
Summary
Guard broadcast stream assignment and verify API responses packages/atmosphere/src/providers/twitter/card.ts, test/api.broadcast.test.ts
The broadcast response type allows optional fields and a null response. The code sets broadcast.stream only when source.location exists. Tests cover v1 and v2 responses without a source, plus a v2 response with a source location.
Broadcast statuses should no longer fail when the live-stream response lacks a source location. The stream is omitted in that case and kept when a location exists. No merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title 'fix(twitter): handle missing source in broadcast stream status' matches the main change. The PR makes broadcast response fields optional and sets broadcast.stream only when source.location …
Linked Issues check
[#2764] The issue requires that a missing or error-shaped live_video_stream/status response must not fail the status. The diff in packages/atmosphere/src/providers/twitter/card.ts changes the response…
Out of Scope Changes check
The changes touch only packages/atmosphere/src/providers/twitter/card.ts (type declarations and one guard condition) and test/api.broadcast.test.ts (regression tests). Both directly implement #2764. N…
Full details: Title check
Explanation
The title 'fix(twitter): handle missing source in broadcast stream status' matches the main change. The PR makes broadcast response fields optional and sets broadcast.stream only when source.location exists, so a missing source no longer fails the status lookup. The title names the Twitter provider, the bug fixed, and the affected status path. The title is specific and describes the primary change in the changeset.
Full details: Linked Issues check
Explanation
[#2764] The issue requires that a missing or error-shaped live_video_stream/status response must not fail the status. The diff in packages/atmosphere/src/providers/twitter/card.ts changes the response type so source and its fields are optional, and the response may be null. It changes the guard from if (broadcastData) to if (broadcastData?.source?.location), which matches the suggested fix in the issue. When no location exists, broadcast.stream is not set. The card and status are still returned. The PR description reports regression tests in test/api.broadcast.test.ts for v1 and v2 endpoints with no source, and for preserving broadcast.stream.url when source.location exists. The raw summary confirms these tests. I did not read the test file. The diff does not add a try/catch around twitterFetch. If twitterFetch throws on a non-2xx HTTP response, that path would still fail. The issue's core failure (TypeError on undefined source) is fixed. The remaining uncertainty is limited to the HTTP-error transport path, which I did not inspect.
Full details: Out of Scope Changes check
Explanation
The changes touch only packages/atmosphere/src/providers/twitter/card.ts (type declarations and one guard condition) and test/api.broadcast.test.ts (regression tests). Both directly implement #2764. No unrelated behavior change appears in the reviewed card.ts diff. The console.log lines were already present and are not changed in scope.
Finishing Touches
Generate unit tests (beta)
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.
A rabbit checks the broadcast stream, And skips the link when none is seen. The status stays, the card remains, A valid URL flows through the lanes. The burrow cheers: the tests are green.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 74600b15-5723-46fb-96ff-3420e4077897
Commits
Reviewing files that changed from the base of the PR and between f55c37f and 68b9274.
Files selected for processing: 2
packages/atmosphere/src/providers/twitter/card.ts
test/api.broadcast.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2764.
When \live_video_stream/status\ returns an error/empty response without \source\ (or \source.location),
enderCard\ in \packages/atmosphere/src/providers/twitter/card.ts\ threw \TypeError: Cannot read properties of undefined (reading 'location')\ because it only checked \if (broadcastData).
Changes
Verification
pm run build\ (@fxembed/atmosphere + worker esbuild) passed
px prettier --check test/api.broadcast.test.ts packages/atmosphere/src/providers/twitter/card.ts\ passed
px eslint --max-warnings=0 src/providers/twitter/card.ts\ (inside \packages/atmosphere) passed
px vitest run\ passed (76 test files, 502 tests)
Summary by CodeRabbit