Skip to content

fix(client): remove deprecated SendStats fields - #2488

Merged
oliverlaz merged 1 commit into
mainfrom
oliverlazoroski/react-1204-remove-deprecated-sendstats-fields
Oct 6, 2026
Merged

oliverlaz merged 1 commit into
mainfrom
oliverlazoroski/react-1204-remove-deprecated-sendstats-fields

Conversation

@oliverlaz

@oliverlaz oliverlaz commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

💡 Overview

Follow-up to GetStream/protocol#2116, which removed the deprecated SendStatsRequest fields (subscriber_stats, publisher_stats, audio_devices, video_devices, subscriber_rtc_stats, publisher_rtc_stats). The client stops sending them and drops the code that only existed to fill them.

📝 Implementation notes

  • signal.ts regenerated without the removed fields.
  • SfuStatsReporter no longer serializes raw getStats() reports or observes mic/camera device lists, so it no longer needs microphone, camera and state in its options.
  • StatsTracer.takeSample() returns PerformanceStats[] instead of { performanceStats, stats }; the ComputedStats type is gone.
  • The reporter's device subscription used to warm the device-list cache that device persistence reads synchronously. Without it, a camera preference could be saved with an empty label, so DeviceManager.persistPreference now falls back to the active track's label when the device isn't in the cached list. Covered by a new CameraManager test.
  • Type-level note: StreamSfuClient.sendStats() is exported, and its parameter type loses the removed fields.
  • Smoke-tested in a two-participant browser call: SendStats returns 200 without the removed fields, encode/decode stats map to publisher/subscriber, the leave flush is sent, and device preferences keep their labels.

🎫 Ticket: https://linear.app/stream/issue/REACT-1204

📑 Docs: not needed (internal stats payload only)

Summary by CodeRabbit

  • Bug Fixes

    • Selected camera or microphone preferences can now be saved using the active track’s device label when the device list hasn’t loaded yet.
  • Improvements

    • SFU telemetry reports delta-compressed WebRTC stats and encoding and decoding performance metrics. Sampling and reporting now use the updated stats flow.

Follow-up to GetStream/protocol#2116. Stop sending the legacy
subscriber/publisher stats, input devices and per-PC rtc stats, which
the SFU no longer accepts. StatsTracer.takeSample() now returns only
the derived PerformanceStats.

The stats reporter's device subscription used to warm the device-list
cache that device persistence reads, so persist the active track's
label as a fallback when that cache is cold.

Ticket: REACT-1204
@oliverlaz oliverlaz added the backport-v1 PRs that need to be backported to the `release-v1` branch label Oct 2, 2026
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: ef36c992-e2d6-4127-a90f-0b04004dd0af

📥 Commits

Reviewing files that changed from the base of the PR and between bf6d27f and f38be05.

⛔ Files ignored due to path filters (1)
  • packages/client/src/gen/video/sfu/signal_rpc/signal.ts is excluded by !**/gen/**
📒 Files selected for processing (9)
  • packages/client/CLAUDE.md
  • packages/client/src/Call.ts
  • packages/client/src/devices/DeviceManager.ts
  • packages/client/src/devices/__tests__/CameraManager.test.ts
  • packages/client/src/devices/__tests__/mediaStreamTestHelpers.ts
  • packages/client/src/stats/SfuStatsReporter.ts
  • packages/client/src/stats/__tests__/SfuStatsReporter.test.ts
  • packages/client/src/stats/rtc/StatsTracer.ts
  • packages/client/src/stats/rtc/types.ts
💤 Files with no reviewable changes (2)
  • packages/client/src/stats/rtc/types.ts
  • packages/client/src/Call.ts

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


📝 Walkthrough

Walkthrough

The client now persists a label from an active media track when device enumeration omits the selected device. Stats sampling and reporting now use performance-stat arrays and exclude input-device details from report payloads.

Changes

Device preference persistence

Layer / File(s) Summary
Persist labels from active tracks
packages/client/src/devices/DeviceManager.ts, packages/client/src/devices/__tests__/CameraManager.test.ts, packages/client/src/devices/__tests__/mediaStreamTestHelpers.ts
When the selected device is absent from enumeration, DeviceManager uses the label of a matching active root-stream track. The camera test checks persistence while enumeration remains unresolved. The video-stream test helper accepts an optional track label.

Stats sampling and reporting

Layer / File(s) Summary
Return performance-stat arrays
packages/client/src/stats/rtc/StatsTracer.ts, packages/client/src/stats/rtc/types.ts
StatsTracer.takeSample returns PerformanceStats[] instead of a ComputedStats object. The ComputedStats type is removed.
Build reports from performance samples
packages/client/src/stats/SfuStatsReporter.ts, packages/client/src/Call.ts, packages/client/src/stats/__tests__/SfuStatsReporter.test.ts, packages/client/CLAUDE.md
SfuStatsReporter accepts performance-stat arrays, removes device observation and device details from reports, and retrieves and commits publisher deltas when both a publisher and tracer exist. The call site and reporter tests use the updated options and sample shape. The documentation describes the updated reporting flow.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to f38be

The device-label and stats-reporting changes have no identified merge-blocking issue after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to f38be

The change reduces device and raw-stat reporting while preserving the existing session-bound sending path. No new privilege or cross-user access was identified in the inspected flows. Remaining uncertainty concerns server compatibility and device-preference behavior during interrupted or overlapping transitions.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected exposure is bounded to the existing browser-origin preference storage and the client's existing joined-session SFU statistics channel. The changed flows do not establish new cross-tenant authority or additional access to media devices; server-side enforcement remains outside the inspected evidence.

Trust Boundaries and Controls

  • observed — The SFU wrapper waits for joinTask and overwrites the outgoing sessionId with its own session identity. Preference persistence requires granted browser permission, and label recovery uses an existing matching track rather than requesting additional device access.

Resilience and Maintainability Implications

  • observed — Terminal flushing time-boxes sampling to two seconds and does not await network delivery, limiting telemetry's ability to block teardown. Scheduled reporting avoids sends already in flight, and the sampler bounds sustained-failure delta accumulation by re-anchoring its chain.
  • inferred — Preference persistence remains separate from successful stream application: selection changes state before applying settings, and force-stop disable can remove the track before persistence. The fallback therefore does not guarantee label preservation throughout every transition. These limitations are not evidence of a newly introduced authorization or media-access failure.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the client fix that removes deprecated SendStats fields, which is the main change.
Description check ✅ Passed The description includes the required Overview and Implementation notes sections, the ticket reference, documentation status, implementation details, and testing results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 6…
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.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

Bundle size

Built package output. Sizes in KB; delta vs main@b8788fb.

Package Unminified Minified Δ min vs main
@stream-io/video-client 802.7 KB 281.7 KB -1.3 KB (-0.5%)
@stream-io/video-react-sdk 376.9 KB 229.2 KB 0 KB
↳ install total (+ client + react-bindings) 1209.2 KB 520.9 KB -1.3 KB (-0.2%)
@stream-io/video-react-native-sdk 462.3 KB 209.8 KB +2.6 KB (+1.2%)
↳ install total (+ client + react-bindings) 1294.6 KB 501.5 KB +1.3 KB (+0.3%)

@oliverlaz
oliverlaz merged commit 9f31f62 into main Oct 6, 2026
22 checks passed
@oliverlaz
oliverlaz deleted the oliverlazoroski/react-1204-remove-deprecated-sendstats-fields branch October 6, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v1 PRs that need to be backported to the `release-v1` branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants