Skip to content

[docs]Add tests for CallJoinInterceptor#1131

Merged
ipavlidakis merged 1 commit intodevelopfrom
iliaspavlidakis/add-docs-for-call-join-interceptor
Apr 22, 2026
Merged

[docs]Add tests for CallJoinInterceptor#1131
ipavlidakis merged 1 commit intodevelopfrom
iliaspavlidakis/add-docs-for-call-join-interceptor

Conversation

@ipavlidakis
Copy link
Copy Markdown
Contributor

@ipavlidakis ipavlidakis commented Apr 21, 2026

🎯 Goal

Add docs for https://github.com/GetStream/docs-content/pull/1220

☑️ Contributor Checklist

  • I have signed the Stream CLA (required)
  • This change follows zero ⚠️ policy (required)
  • This change should receive manual QA
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Comparison screenshots added for visual changes
  • Affected documentation updated (tutorial, CMS)

Summary by CodeRabbit

  • Documentation
    • Added a new SwiftUI/Combine example demonstrating call join interception with custom event handling.

@ipavlidakis ipavlidakis self-assigned this Apr 21, 2026
@ipavlidakis ipavlidakis requested a review from a team as a code owner April 21, 2026 09:59
@ipavlidakis ipavlidakis added the documentation Improvements or additions to documentation label Apr 21, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

📝 Walkthrough

Walkthrough

A new Swift documentation example file is added to demonstrate a custom CallJoinIntercepting interceptor that monitors participant readiness via custom events. The Xcode project configuration is updated to include this file in the build.

Changes

Cohort / File(s) Summary
Project Configuration
DocumentationTests/DocumentationTests/DocumentationTests.xcodeproj/project.pbxproj
Added build file and file reference entries for new source file; included in target's build phase.
Documentation Example
DocumentationTests/DocumentationTests/DocumentationTests/05-ui-cookbook/10-call-join-interceptor.swift
New SwiftUI/Combine example introducing ParticipantReadyCallJoinInterceptor that observes ringing calls, subscribes to custom events, filters for other users' readiness signals, and delays join completion until other participants are ready.

Sequence Diagram(s)

sequenceDiagram
    participant Caller as Caller
    participant ViewModel as CallViewModel
    participant Interceptor as ParticipantReadyCallJoinInterceptor
    participant StreamVideo as streamVideo.state
    participant EventStream as CustomVideoEvent Stream

    Caller->>ViewModel: callReadyToJoin()
    activate Interceptor
    ViewModel->>Interceptor: callReadyToJoin()
    Interceptor->>Interceptor: Send custom event<br/>(current user id)
    Interceptor->>StreamVideo: Monitor ringingCall
    Interceptor->>EventStream: Subscribe to events
    EventStream->>Interceptor: Receive event (other user)
    Interceptor->>Interceptor: Filter & publish<br/>readiness = true
    Interceptor->>Interceptor: Await readiness signal
    Interceptor-->>ViewModel: Return (join allowed)
    deactivate Interceptor
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A new interceptor hops into place,
Watching for friends in the joining race,
Custom events dance through the stream,
Patience rewarded—a synchronized dream!
Ready together, they call with grace.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[docs]Add tests for CallJoinInterceptor' is directly related to the changeset, which adds a new example file demonstrating CallJoinInterceptor usage in the documentation tests.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch iliaspavlidakis/add-docs-for-call-join-interceptor

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
DocumentationTests/DocumentationTests/DocumentationTests/05-ui-cookbook/10-call-join-interceptor.swift (1)

22-22: Wrap long Swift lines to match the project style.

These lines exceed the 80-character Swift guideline; wrapping them keeps the documentation examples consistent with the rest of the project. As per coding guidelines, **/*.swift: “Use 80 characters as the maximum line length”.

♻️ Proposed wrapping
-            private let hasOtherReadyParticipants = CurrentValueSubject<Bool, Never>(false)
+            private let hasOtherReadyParticipants =
+                CurrentValueSubject<Bool, Never>(false)

-                    .sinkTask(storeIn: disposableBag) { `@MainActor` [weak self] ringingCall in
+                    .sinkTask(storeIn: disposableBag) {
+                        `@MainActor` [weak self] ringingCall in
                         self?.didUpdate(ringingCall: ringingCall)
                     }

-        callViewModel.callJoinInterceptor = ParticipantReadyCallJoinInterceptor(streamVideo: streamVideo)
+        callViewModel.callJoinInterceptor =
+            ParticipantReadyCallJoinInterceptor(streamVideo: streamVideo)

Also applies to: 37-37, 85-85

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@DocumentationTests/DocumentationTests/DocumentationTests/05-ui-cookbook/10-call-join-interceptor.swift`
at line 22, The single long Swift declaration private let
hasOtherReadyParticipants = CurrentValueSubject<Bool, Never>(false) (and the
similar long lines at the other mentioned locations) should be wrapped to
respect the 80-character line-length rule; break the initializer across lines so
the identifier and type stay on one line and the CurrentValueSubject
generic/type and initializer arguments are on subsequent indented lines (e.g.,
split after = or after the generic), updating the declarations for
hasOtherReadyParticipants and the two other long lines referenced to match the
project style.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@DocumentationTests/DocumentationTests/DocumentationTests.xcodeproj/project.pbxproj`:
- Line 10: Project contains duplicate cookbook filename prefixes (e.g.,
"10-call-join-interceptor.swift" conflicts with
"10-network-quality-indicator.swift"); rename the new file to the next unused
numeric prefix and update all Xcode project references accordingly: change the
PBXBuildFile entry (e.g., 41A1C0DE2F82100100A1B2C3) and the corresponding
PBXFileReference (e.g., 41A1C0DE2F82100200A1B2C3) to point to the renamed file,
and also rename the file on disk; apply the same fix for other duplicates noted
(95-95, 283-284, 457-457) so cookbook ordering by filename prefix remains unique
and consistent.

In
`@DocumentationTests/DocumentationTests/DocumentationTests/05-ui-cookbook/10-call-join-interceptor.swift`:
- Around line 53-55: The readiness wait currently swallows CancellationError by
using "try?" on hasOtherReadyParticipants.filter { $0 }.nextValue(); update the
call in callReadyToJoin to remove the "try?" so that nextValue() is awaited with
normal error propagation (allowing CancellationError to bubble up) — locate the
invocation using hasOtherReadyParticipants and nextValue() inside the
callReadyToJoin async throws function and replace the try? usage with a plain
try/await so cancellation propagates.

---

Nitpick comments:
In
`@DocumentationTests/DocumentationTests/DocumentationTests/05-ui-cookbook/10-call-join-interceptor.swift`:
- Line 22: The single long Swift declaration private let
hasOtherReadyParticipants = CurrentValueSubject<Bool, Never>(false) (and the
similar long lines at the other mentioned locations) should be wrapped to
respect the 80-character line-length rule; break the initializer across lines so
the identifier and type stay on one line and the CurrentValueSubject
generic/type and initializer arguments are on subsequent indented lines (e.g.,
split after = or after the generic), updating the declarations for
hasOtherReadyParticipants and the two other long lines referenced to match the
project style.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f19df8fd-f28e-44a4-a013-fa1b2b019e3c

📥 Commits

Reviewing files that changed from the base of the PR and between 1d600ef and ff2d7a4.

📒 Files selected for processing (2)
  • DocumentationTests/DocumentationTests/DocumentationTests.xcodeproj/project.pbxproj
  • DocumentationTests/DocumentationTests/DocumentationTests/05-ui-cookbook/10-call-join-interceptor.swift

objects = {

/* Begin PBXBuildFile section */
41A1C0DE2F82100100A1B2C3 /* 10-call-join-interceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41A1C0DE2F82100200A1B2C3 /* 10-call-join-interceptor.swift */; };
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Avoid duplicate cookbook numbering.

The new page uses the 10- prefix while 10-network-quality-indicator.swift already exists. If docs are ordered by filename prefix, this makes the cookbook order ambiguous. Consider renaming this to the next unused prefix and updating the project references plus the file on disk together.

Also applies to: 95-95, 283-284, 457-457

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@DocumentationTests/DocumentationTests/DocumentationTests.xcodeproj/project.pbxproj`
at line 10, Project contains duplicate cookbook filename prefixes (e.g.,
"10-call-join-interceptor.swift" conflicts with
"10-network-quality-indicator.swift"); rename the new file to the next unused
numeric prefix and update all Xcode project references accordingly: change the
PBXBuildFile entry (e.g., 41A1C0DE2F82100100A1B2C3) and the corresponding
PBXFileReference (e.g., 41A1C0DE2F82100200A1B2C3) to point to the renamed file,
and also rename the file on disk; apply the same fix for other duplicates noted
(95-95, 283-284, 457-457) so cookbook ordering by filename prefix remains unique
and consistent.

Comment on lines +53 to +55
_ = try? await hasOtherReadyParticipants
.filter { $0 }
.nextValue()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect the project's `nextValue` implementation and call sites that may swallow cancellation.
# Expected: `nextValue` is throwing/cancellation-aware, and join-gating usages should not use `try?`.
rg -n -C4 --type swift '\bfunc\s+nextValue\b|\btry\?\s+await\s+.*nextValue\s*\('

Repository: GetStream/stream-video-swift

Length of output: 1188


🏁 Script executed:

# Get the full nextValue() implementation
cat -n Sources/StreamVideo/Utils/Extensions/Combine/Publisher+AsyncStream.swift | sed -n '100,180p'

Repository: GetStream/stream-video-swift

Length of output: 1512


🏁 Script executed:

# Check the actual file and lines being reviewed
cat -n DocumentationTests/DocumentationTests/DocumentationTests/05-ui-cookbook/10-call-join-interceptor.swift | sed -n '40,75p'

Repository: GetStream/stream-video-swift

Length of output: 1675


🏁 Script executed:

# Search for all try? await nextValue usages to understand the pattern
rg -n "try\?" --type swift -A2 -B2 | grep -A2 -B2 "nextValue"

Repository: GetStream/stream-video-swift

Length of output: 1648


Propagate cancellation from the readiness wait.

try? suppresses all errors including CancellationError from nextValue(), allowing a cancelled join to proceed without waiting for participant readiness. Since callReadyToJoin is marked async throws, cancellation should propagate to the caller. Remove try? to preserve cancellation semantics.

🐛 Proposed fix
-                _ = try? await hasOtherReadyParticipants
+                _ = try await hasOtherReadyParticipants
                     .filter { $0 }
                     .nextValue()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
_ = try? await hasOtherReadyParticipants
.filter { $0 }
.nextValue()
_ = try await hasOtherReadyParticipants
.filter { $0 }
.nextValue()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@DocumentationTests/DocumentationTests/DocumentationTests/05-ui-cookbook/10-call-join-interceptor.swift`
around lines 53 - 55, The readiness wait currently swallows CancellationError by
using "try?" on hasOtherReadyParticipants.filter { $0 }.nextValue(); update the
call in callReadyToJoin to remove the "try?" so that nextValue() is awaited with
normal error propagation (allowing CancellationError to bubble up) — locate the
invocation using hasOtherReadyParticipants and nextValue() inside the
callReadyToJoin async throws function and replace the try? usage with a plain
try/await so cancellation propagates.

@ipavlidakis ipavlidakis merged commit e9a16d6 into develop Apr 22, 2026
13 checks passed
@ipavlidakis ipavlidakis deleted the iliaspavlidakis/add-docs-for-call-join-interceptor branch April 22, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant