Skip to content

Conversation

@laevandus
Copy link
Contributor

@laevandus laevandus commented Dec 3, 2025

🔗 Issue Links

Fixes: IOS-1276

🎯 Goal

Allow configuring how much of the channel history is visible for added members

📝 Summary

  • Add hideHistoryBefore to add members functions
  • Update existing add members debug to ask for how many days to show
  • Docs PR: 826

🛠 Implementation

Note: hideHistoryBefore takes precedence over the existing hideHistory Bool value

🧪 Manual Testing Notes

  1. Open an existing channel created by the current user
  2. Use the add members debug command and add a new member and specify how many days of history is visible
  3. Log in with the other user and verify that loaded history is correct

☑️ Contributor Checklist

  • I have signed the Stream CLA (required)
  • This change should be manually QAed
  • Changelog is updated with client-facing changes
  • Changelog is updated with new localization keys
  • New code is covered by unit tests
  • Documentation has been updated in the docs-content repo

Summary by CodeRabbit

  • New Features

    • Added hideHistoryBefore when adding channel members so you can specify a date threshold to hide past messages from newly added members.
    • Demo app now prompts for a history window (days) when adding members.
  • Tests

    • Added tests covering hideHistoryBefore behavior and its precedence over the existing hideHistory option.
  • Documentation

    • CHANGELOG updated to announce the new StreamChat add-members option.

✏️ Tip: You can customize this high-level summary in your review settings.

@laevandus laevandus requested a review from a team as a code owner December 3, 2025 08:27
@laevandus laevandus added the ✅ Feature An issue or PR related to a feature label Dec 3, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 3, 2025

Walkthrough

Adds an optional hideHistoryBefore: Date? parameter to addMembers across UI, controller, updater, state, and API layers; threads the value to the endpoint and documents that hideHistoryBefore takes precedence over the hideHistory boolean. Tests and mocks updated accordingly.

Changes

Cohort / File(s) Summary
Changelog
CHANGELOG.md
Added StreamChat entry documenting hideHistoryBefore for add-members.
Demo UI
DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift
"Add member" flow now prompts for a history window (days), computes hideHistoryBefore and calls channelController.addMembers with it.
API Endpoint
Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift
addMembers extended to accept hideHistoryBefore: Date?; request body includes hide_history_before when provided, otherwise preserves prior hide_history behavior.
Controller API
Sources/StreamChat/Controllers/ChannelController/ChannelController.swift
Added hideHistoryBefore: Date? to both addMembers overloads and forwarded it to the updater.
State Layer (Chat)
Sources/StreamChat/StateLayer/Chat.swift
Chat.addMembers overloads accept hideHistoryBefore: Date? and forward it to the updater; docs updated about precedence.
Worker (Updater)
Sources/StreamChat/Workers/ChannelUpdater.swift
addMembers (sync/async) gained hideHistoryBefore: Date? and forwards it to the API; precedence over hideHistory documented and enforced in request construction.
Mocks
TestTools/StreamChatTestTools/Mocks/StreamChat/Workers/ChannelUpdater_Mock.swift
Added addMembers_hideHistoryBefore: Date? atomic property; method signature updated and property reset in cleanup.
Endpoint Tests
Tests/StreamChatTests/APIClient/Endpoints/ChannelEndpoints_Tests.swift
Added test_addMembers_withHideHistoryBefore_buildsCorrectly verifying request body contains hide_history_before when provided.
Controller Tests
Tests/StreamChatTests/Controllers/ChannelController/ChannelController_Tests.swift
Added test_addMembers_withHideHistoryBefore_callsChannelUpdater validating forwarding of parameters to updater.
State Tests
Tests/StreamChatTests/StateLayer/Chat_Tests.swift
Added tests ensuring forwarding and precedence of hideHistoryBefore over hideHistory.
Updater Tests
Tests/StreamChatTests/Workers/ChannelUpdater_Tests.swift
Added tests verifying API call includes hide_history_before and precedence behavior when both parameters are provided.

Sequence Diagram(s)

sequenceDiagram
    participant UI as DemoApp UI
    participant CC as ChannelController
    participant CU as ChannelUpdater
    participant API as API Endpoint

    UI->>UI: Prompt user for days\nCompute hideHistoryBefore
    UI->>CC: addMembers(members, hideHistoryBefore: Date?)
    CC->>CU: addMembers(..., hideHistoryBefore: Date?)
    CU->>API: POST /channels/{cid}/add_members\nbody includes hide_history_before when set
    API-->>CU: 200 / error
    CU-->>CC: completion callback
    CC-->>UI: completion callback
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review propagation and precedence of hideHistoryBefore vs hideHistory.
  • Verify date serialization format in hide_history_before payload in endpoint.
  • Check tests and mock resets for addMembers_hideHistoryBefore.

Possibly related PRs

Suggested labels

🌐 SDK: StreamChat (LLC)

Suggested reviewers

  • martinmitrevski
  • nuno-vieira

Poem

🐰 I hopped through code both near and far,
I tucked a date where histories are,
From UI prompt to API door,
New members glimpse what came before,
A tiny hop — and that's the star ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.43% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ 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 'Add hideHistoryBefore to add members' directly and clearly summarizes the main change - adding a new parameter to the add members functionality.
Linked Issues check ✅ Passed The PR fully implements IOS-1276 objectives: adds hideHistoryBefore parameter to control channel history visibility for new members, integrates it across the API layer, and includes comprehensive test coverage.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing hideHistoryBefore for add members, including API endpoints, controllers, workers, UI demo updates, and tests. No unrelated modifications detected.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/add-members-hide-history-before

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a90a154 and ca96e58.

📒 Files selected for processing (4)
  • DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift (1 hunks)
  • Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift (1 hunks)
  • Sources/StreamChat/StateLayer/Chat.swift (2 hunks)
  • Tests/StreamChatTests/StateLayer/Chat_Tests.swift (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Tests/StreamChatTests/StateLayer/Chat_Tests.swift
🧰 Additional context used
📓 Path-based instructions (2)
**/*.swift

📄 CodeRabbit inference engine (AGENTS.md)

**/*.swift: Write Swift code compatible with iOS deployment targets specified in Package.swift and podspec files; do not lower deployment targets without approval
Use SwiftLint with strict mode and respect .swiftlint.yml rules; justify and scope any exceptions rather than suppressing rules broadly
Run SwiftFormat for code formatting and respect repository-specific style conventions
Never commit API keys or customer data; use obvious placeholders (e.g., YOUR_STREAM_KEY) in example code
Follow the project's zero-warnings policy: fix new warnings and avoid introducing any

Files:

  • Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift
  • DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift
  • Sources/StreamChat/StateLayer/Chat.swift
Sources/StreamChat/**/*.swift

📄 CodeRabbit inference engine (AGENTS.md)

Ensure public API changes in StreamChat and StreamChatUI include inline documentation and migration notes

Files:

  • Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift
  • Sources/StreamChat/StateLayer/Chat.swift
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: Applies to CHANGELOG* : Update CHANGELOG entries for user-visible SDK changes in StreamChat and StreamChatUI
📚 Learning: 2025-11-25T12:17:18.459Z
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: Applies to Sources/StreamChat/**/*.swift : Ensure public API changes in StreamChat and StreamChatUI include inline documentation and migration notes

Applied to files:

  • Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift
  • DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift
  • Sources/StreamChat/StateLayer/Chat.swift
📚 Learning: 2025-11-25T12:17:18.459Z
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: Applies to Sources/StreamChatUI/**/*.swift : Ensure public API changes in StreamChatUI include inline documentation and migration notes

Applied to files:

  • Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift
  • DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift
  • Sources/StreamChat/StateLayer/Chat.swift
📚 Learning: 2025-11-25T12:17:18.459Z
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: Applies to CHANGELOG* : Update CHANGELOG entries for user-visible SDK changes in StreamChat and StreamChatUI

Applied to files:

  • DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift
  • Sources/StreamChat/StateLayer/Chat.swift
📚 Learning: 2025-11-25T12:17:18.459Z
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: Prefer additive changes and avoid breaking public APIs in StreamChat and StreamChatUI

Applied to files:

  • DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift
  • Sources/StreamChat/StateLayer/Chat.swift
📚 Learning: 2025-11-25T12:17:18.459Z
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: Prioritize backwards compatibility and API stability when changing code in the Stream iOS Chat SDK

Applied to files:

  • DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift
📚 Learning: 2025-11-25T12:17:18.459Z
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: Maintain high test coverage when changing code in the Stream iOS Chat SDK

Applied to files:

  • DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift
🧬 Code graph analysis (1)
Sources/StreamChat/StateLayer/Chat.swift (3)
Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift (1)
  • addMembers (176-201)
Sources/StreamChat/Workers/ChannelUpdater.swift (2)
  • addMembers (465-486)
  • addMembers (842-862)
TestTools/StreamChatTestTools/Mocks/StreamChat/Workers/ChannelUpdater_Mock.swift (2)
  • addMembers (438-456)
  • addMembers (458-474)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Metrics
🔇 Additional comments (3)
Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift (1)

176-201: LGTM! Clean implementation of the precedence logic.

The endpoint correctly implements the hideHistoryBefore precedence over hideHistory as documented in the PR objectives. The default nil value maintains backward compatibility.

Sources/StreamChat/StateLayer/Chat.swift (2)

224-250: LGTM! Well-documented public API addition.

The hideHistoryBefore parameter is correctly added with:

  • Proper inline documentation explaining the precedence rule
  • Optional parameter with nil default for backward compatibility
  • Correct forwarding to channelUpdater.addMembers

As per coding guidelines, public API changes include inline documentation.


252-275: LGTM! Consistent overload implementation.

The UserId-based overload correctly mirrors the MemberInfo-based variant and properly forwards hideHistoryBefore through the call chain.


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

@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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift (1)

248-268: “0 for full history” prompt doesn’t match implementation; 0 currently yields no history

In the “Add member” debug flow, the prompt says “0 for full history”, but the code computes:

  • hideHistoryBefore = Calendar.current.date(byAdding: .day, value: -days, to: Date())
  • For days == 0, this becomes hideHistoryBefore = Date(), which hides all past messages and effectively shows 0 days of history rather than full history.

To align behavior with the prompt and with the semantics of “last N days”, you can normalize and guard the parsed value so that 0 maps to “no cutoff”:

-                    ) { daysString in
-                        let hideHistoryBefore: Date? = {
-                            guard let daysString, let days = Int(daysString) else { return nil }
-                            return Calendar.current.date(byAdding: .day, value: -days, to: Date())
-                        }()
+                    ) { daysString in
+                        let hideHistoryBefore: Date? = {
+                            guard let daysString,
+                                  let rawDays = Int(daysString) else {
+                                return nil // invalid / empty => full history
+                            }
+                            let days = abs(rawDays)
+                            guard days > 0 else {
+                                return nil // 0 => full history
+                            }
+                            return Calendar.current.date(byAdding: .day, value: -days, to: Date())
+                        }()

This makes:

  • days > 0 → show last N days,
  • days == 0 or invalid input → full history (no hideHistoryBefore cutoff).
🧹 Nitpick comments (5)
TestTools/StreamChatTestTools/Mocks/StreamChat/Workers/ChannelUpdater_Mock.swift (1)

438-456: Override correctly records hideHistoryBefore; consider extending the helper as well

The overridden addMembers now matching the production signature (including hideHistoryBefore: Date? = nil) and storing it in addMembers_hideHistoryBefore gives tests the hook they need and aligns with the new API surface.

If you anticipate tests calling the addMembers(currentUserId:cid:userIds:message:hideHistory,completion) helper with hideHistoryBefore, you might also add an optional hideHistoryBefore parameter there and forward it, for parity with the main overload:

 func addMembers(
     currentUserId: UserId?,
     cid: ChannelId,
     userIds: Set<UserId>,
     message: String?,
-    hideHistory: Bool,
+    hideHistory: Bool,
+    hideHistoryBefore: Date? = nil,
     completion: ((Error?) -> Void)? = nil
 ) {
     addMembers(
         currentUserId: currentUserId,
         cid: cid,
         members: userIds.map { MemberInfo(userId: $0, extraData: nil) },
         message: message,
-        hideHistory: hideHistory,
+        hideHistory: hideHistory,
+        hideHistoryBefore: hideHistoryBefore,
         completion: completion
     )
 }
CHANGELOG.md (1)

6-8: Consider adding PR reference for consistency

Recent StreamChat entries usually include the originating PR number; consider appending [#3892](https://github.com/GetStream/stream-chat-swift/pull/3892) (or similar) to this bullet to match the existing changelog style.
Based on learnings, this keeps CHANGELOG formatting consistent for user-visible SDK changes.

Tests/StreamChatTests/StateLayer/Chat_Tests.swift (1)

330-367: New Chat.addMembers tests cover hideHistoryBefore forwarding; consider extending to the userIds overload

The two new tests correctly verify that Chat.addMembers forwards both hideHistory and hideHistoryBefore to ChannelUpdater and exercise the “both set” scenario as far as this layer can. To further harden coverage, you could optionally add a similar test for the [UserId] overload to ensure it also passes hideHistoryBefore through as expected.

Sources/StreamChat/Workers/ChannelUpdater.swift (1)

456-486: ChannelUpdater addMembers correctly threads hideHistoryBefore through to the endpoint

The updater’s addMembers now:

  • Documents and accepts hideHistoryBefore: Date? = nil alongside hideHistory,
  • Forwards both into the .addMembers endpoint, which is where precedence is enforced.

The async wrapper mirrors the new signature and correctly uses the shared CheckedContinuation.resume(with:) helper. If you find yourself often calling the async variant without an explicit hideHistory, you might optionally add a default (hideHistory: Bool = false) there as well, but the current form is perfectly fine.

Also applies to: 842-858

Sources/StreamChat/StateLayer/Chat.swift (1)

228-250: Public addMembers API: additive change and correct forwarding of hideHistoryBefore

The new hideHistoryBefore: Date? = nil parameter is added in a backward-compatible way and its documentation clearly states precedence over hideHistory, matching the endpoint behavior. Forwarding to channelUpdater.addMembers includes both hideHistory and hideHistoryBefore, so the state layer is correctly wired into the worker/API stack. One minor follow‑up you may want to consider separately: the existing hideHistory doc text (“If true, the previous history is available…”) seems inverted relative to its name and server behavior, and could be clarified in a later docs-only change. As per coding guidelines, this keeps API stability while extending functionality.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3adc76b and 003f3a1.

📒 Files selected for processing (11)
  • CHANGELOG.md (1 hunks)
  • DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift (1 hunks)
  • Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift (1 hunks)
  • Sources/StreamChat/Controllers/ChannelController/ChannelController.swift (3 hunks)
  • Sources/StreamChat/StateLayer/Chat.swift (2 hunks)
  • Sources/StreamChat/Workers/ChannelUpdater.swift (3 hunks)
  • TestTools/StreamChatTestTools/Mocks/StreamChat/Workers/ChannelUpdater_Mock.swift (4 hunks)
  • Tests/StreamChatTests/APIClient/Endpoints/ChannelEndpoints_Tests.swift (1 hunks)
  • Tests/StreamChatTests/Controllers/ChannelController/ChannelController_Tests.swift (1 hunks)
  • Tests/StreamChatTests/StateLayer/Chat_Tests.swift (1 hunks)
  • Tests/StreamChatTests/Workers/ChannelUpdater_Tests.swift (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.swift

📄 CodeRabbit inference engine (AGENTS.md)

**/*.swift: Write Swift code compatible with iOS deployment targets specified in Package.swift and podspec files; do not lower deployment targets without approval
Use SwiftLint with strict mode and respect .swiftlint.yml rules; justify and scope any exceptions rather than suppressing rules broadly
Run SwiftFormat for code formatting and respect repository-specific style conventions
Never commit API keys or customer data; use obvious placeholders (e.g., YOUR_STREAM_KEY) in example code
Follow the project's zero-warnings policy: fix new warnings and avoid introducing any

Files:

  • Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift
  • TestTools/StreamChatTestTools/Mocks/StreamChat/Workers/ChannelUpdater_Mock.swift
  • Sources/StreamChat/StateLayer/Chat.swift
  • Sources/StreamChat/Controllers/ChannelController/ChannelController.swift
  • Tests/StreamChatTests/APIClient/Endpoints/ChannelEndpoints_Tests.swift
  • Tests/StreamChatTests/Workers/ChannelUpdater_Tests.swift
  • Tests/StreamChatTests/Controllers/ChannelController/ChannelController_Tests.swift
  • Tests/StreamChatTests/StateLayer/Chat_Tests.swift
  • DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift
  • Sources/StreamChat/Workers/ChannelUpdater.swift
Sources/StreamChat/**/*.swift

📄 CodeRabbit inference engine (AGENTS.md)

Ensure public API changes in StreamChat and StreamChatUI include inline documentation and migration notes

Files:

  • Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift
  • Sources/StreamChat/StateLayer/Chat.swift
  • Sources/StreamChat/Controllers/ChannelController/ChannelController.swift
  • Sources/StreamChat/Workers/ChannelUpdater.swift
CHANGELOG*

📄 CodeRabbit inference engine (AGENTS.md)

Update CHANGELOG entries for user-visible SDK changes in StreamChat and StreamChatUI

Files:

  • CHANGELOG.md
Tests/**/*.swift

📄 CodeRabbit inference engine (AGENTS.md)

Add or extend tests in the matching module's Tests/ folder for changes to StreamChat or StreamChatUI code, covering core models, API surfaces, and view controller behaviors; use fakes/mocks from test helpers provided by the repo

Files:

  • Tests/StreamChatTests/APIClient/Endpoints/ChannelEndpoints_Tests.swift
  • Tests/StreamChatTests/Workers/ChannelUpdater_Tests.swift
  • Tests/StreamChatTests/Controllers/ChannelController/ChannelController_Tests.swift
  • Tests/StreamChatTests/StateLayer/Chat_Tests.swift
🧠 Learnings (9)
📓 Common learnings
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: Applies to CHANGELOG* : Update CHANGELOG entries for user-visible SDK changes in StreamChat and StreamChatUI
📚 Learning: 2025-11-25T12:17:18.459Z
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: Applies to Sources/StreamChatUI/**/*.swift : Ensure public API changes in StreamChatUI include inline documentation and migration notes

Applied to files:

  • TestTools/StreamChatTestTools/Mocks/StreamChat/Workers/ChannelUpdater_Mock.swift
  • CHANGELOG.md
  • Sources/StreamChat/StateLayer/Chat.swift
  • Sources/StreamChat/Controllers/ChannelController/ChannelController.swift
  • Tests/StreamChatTests/APIClient/Endpoints/ChannelEndpoints_Tests.swift
  • Tests/StreamChatTests/Workers/ChannelUpdater_Tests.swift
  • Tests/StreamChatTests/Controllers/ChannelController/ChannelController_Tests.swift
  • Tests/StreamChatTests/StateLayer/Chat_Tests.swift
  • DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift
  • Sources/StreamChat/Workers/ChannelUpdater.swift
📚 Learning: 2025-11-25T12:17:18.459Z
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: Applies to Sources/StreamChat/**/*.swift : Ensure public API changes in StreamChat and StreamChatUI include inline documentation and migration notes

Applied to files:

  • TestTools/StreamChatTestTools/Mocks/StreamChat/Workers/ChannelUpdater_Mock.swift
  • CHANGELOG.md
  • Sources/StreamChat/StateLayer/Chat.swift
  • Sources/StreamChat/Controllers/ChannelController/ChannelController.swift
  • Tests/StreamChatTests/APIClient/Endpoints/ChannelEndpoints_Tests.swift
  • Tests/StreamChatTests/Workers/ChannelUpdater_Tests.swift
  • Tests/StreamChatTests/Controllers/ChannelController/ChannelController_Tests.swift
  • Tests/StreamChatTests/StateLayer/Chat_Tests.swift
  • DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift
  • Sources/StreamChat/Workers/ChannelUpdater.swift
📚 Learning: 2025-11-25T12:17:18.459Z
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: Applies to Tests/**/*.swift : Add or extend tests in the matching module's Tests/ folder for changes to StreamChat or StreamChatUI code, covering core models, API surfaces, and view controller behaviors; use fakes/mocks from test helpers provided by the repo

Applied to files:

  • TestTools/StreamChatTestTools/Mocks/StreamChat/Workers/ChannelUpdater_Mock.swift
  • Tests/StreamChatTests/APIClient/Endpoints/ChannelEndpoints_Tests.swift
  • Tests/StreamChatTests/Workers/ChannelUpdater_Tests.swift
  • Tests/StreamChatTests/Controllers/ChannelController/ChannelController_Tests.swift
  • Tests/StreamChatTests/StateLayer/Chat_Tests.swift
📚 Learning: 2025-11-25T12:17:18.459Z
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: Applies to CHANGELOG* : Update CHANGELOG entries for user-visible SDK changes in StreamChat and StreamChatUI

Applied to files:

  • TestTools/StreamChatTestTools/Mocks/StreamChat/Workers/ChannelUpdater_Mock.swift
  • CHANGELOG.md
  • Sources/StreamChat/StateLayer/Chat.swift
  • Sources/StreamChat/Controllers/ChannelController/ChannelController.swift
  • Tests/StreamChatTests/StateLayer/Chat_Tests.swift
  • DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift
  • Sources/StreamChat/Workers/ChannelUpdater.swift
📚 Learning: 2025-11-25T12:17:18.459Z
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: Prefer additive changes and avoid breaking public APIs in StreamChat and StreamChatUI

Applied to files:

  • TestTools/StreamChatTestTools/Mocks/StreamChat/Workers/ChannelUpdater_Mock.swift
  • CHANGELOG.md
  • Sources/StreamChat/StateLayer/Chat.swift
  • Tests/StreamChatTests/StateLayer/Chat_Tests.swift
  • DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift
📚 Learning: 2025-11-25T12:17:18.459Z
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: For UI changes in StreamChatUI, attach comparison screenshots (before/after) in pull requests where feasible

Applied to files:

  • CHANGELOG.md
📚 Learning: 2025-11-25T12:17:18.459Z
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: Prioritize backwards compatibility and API stability when changing code in the Stream iOS Chat SDK

Applied to files:

  • CHANGELOG.md
  • Sources/StreamChat/StateLayer/Chat.swift
  • DemoApp/StreamChat/Components/DemoChatChannelListRouter.swift
📚 Learning: 2025-11-25T12:17:18.459Z
Learnt from: CR
Repo: GetStream/stream-chat-swift PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T12:17:18.459Z
Learning: Maintain high test coverage when changing code in the Stream iOS Chat SDK

Applied to files:

  • Tests/StreamChatTests/APIClient/Endpoints/ChannelEndpoints_Tests.swift
  • Tests/StreamChatTests/Workers/ChannelUpdater_Tests.swift
  • Tests/StreamChatTests/Controllers/ChannelController/ChannelController_Tests.swift
  • Tests/StreamChatTests/StateLayer/Chat_Tests.swift
🧬 Code graph analysis (6)
Sources/StreamChat/StateLayer/Chat.swift (3)
Sources/StreamChat/Controllers/ChannelController/ChannelController.swift (3)
  • addMembers (1153-1177)
  • addMembers (1188-1202)
  • message (2157-2162)
Sources/StreamChat/Workers/ChannelUpdater.swift (2)
  • addMembers (465-486)
  • addMembers (842-862)
TestTools/StreamChatTestTools/Mocks/StreamChat/Workers/ChannelUpdater_Mock.swift (2)
  • addMembers (438-456)
  • addMembers (458-474)
Sources/StreamChat/Controllers/ChannelController/ChannelController.swift (3)
Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift (1)
  • addMembers (176-201)
Sources/StreamChat/StateLayer/Chat.swift (2)
  • addMembers (235-250)
  • addMembers (263-275)
Sources/StreamChat/Workers/ChannelUpdater.swift (2)
  • addMembers (465-486)
  • addMembers (842-862)
Tests/StreamChatTests/APIClient/Endpoints/ChannelEndpoints_Tests.swift (1)
Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift (1)
  • addMembers (176-201)
Tests/StreamChatTests/Workers/ChannelUpdater_Tests.swift (2)
Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift (1)
  • addMembers (176-201)
Sources/StreamChat/Workers/ChannelUpdater.swift (2)
  • addMembers (465-486)
  • addMembers (842-862)
Tests/StreamChatTests/Controllers/ChannelController/ChannelController_Tests.swift (3)
Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift (1)
  • addMembers (176-201)
Sources/StreamChat/StateLayer/Chat.swift (2)
  • addMembers (235-250)
  • addMembers (263-275)
Sources/StreamChat/Workers/ChannelUpdater.swift (2)
  • addMembers (465-486)
  • addMembers (842-862)
Tests/StreamChatTests/StateLayer/Chat_Tests.swift (4)
Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift (1)
  • addMembers (176-201)
Sources/StreamChat/StateLayer/Chat.swift (2)
  • addMembers (235-250)
  • addMembers (263-275)
Sources/StreamChat/Workers/ChannelUpdater.swift (2)
  • addMembers (465-486)
  • addMembers (842-862)
TestTools/StreamChatTestTools/Mocks/StreamChat/Workers/ChannelUpdater_Mock.swift (2)
  • addMembers (438-456)
  • addMembers (458-474)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Test LLC (Debug)
  • GitHub Check: Build LLC + UI (Xcode 15)
  • GitHub Check: Build Test App and Frameworks
  • GitHub Check: Metrics
  • GitHub Check: Metrics
🔇 Additional comments (7)
TestTools/StreamChatTestTools/Mocks/StreamChat/Workers/ChannelUpdater_Mock.swift (1)

53-61: State tracking for hideHistoryBefore in mock looks correct

The new @Atomic var addMembers_hideHistoryBefore: Date? and its reset in cleanUp() are consistent with other recorded addMembers_* fields and keep the mock reusable between tests. No issues here.

Also applies to: 212-219

Tests/StreamChatTests/Controllers/ChannelController/ChannelController_Tests.swift (1)

3703-3726: New addMembers forwarding test is sound and matches existing patterns

test_addMembers_withHideHistoryBefore_callsChannelUpdater follows the existing style for controller→updater wiring tests and correctly asserts that cid, memberInfos, hideHistory, and hideHistoryBefore are forwarded to ChannelUpdater_Mock. Using a local Date() for equality is safe here since the mock stores the value verbatim.

Tests/StreamChatTests/APIClient/Endpoints/ChannelEndpoints_Tests.swift (1)

357-382: New addMembers test correctly covers hideHistoryBefore behavior

The test mirrors the existing addMembers case and validates that hide_history_before is set (with no hide_history), matching the new endpoint semantics while keeping path and flags unchanged.

Sources/StreamChat/APIClient/Endpoints/ChannelEndpoints.swift (1)

176-190: addMembers correctly implements hideHistoryBefore precedence without breaking existing calls

The new hideHistoryBefore: Date? = nil parameter is source-compatible, and the body logic properly prefers hide_history_before over hide_history when set while preserving the previous hide_history behavior otherwise.

Sources/StreamChat/Controllers/ChannelController/ChannelController.swift (1)

1143-1201: addMembers API extension with hideHistoryBefore is well-shaped and backward compatible

The added hideHistoryBefore: Date? = nil parameter on both addMembers overloads is additive, keeps call sites source-compatible, and the forwarding into ChannelUpdater.addMembers matches the documented semantics (including the precedence note). No issues from the controller layer side.

Tests/StreamChatTests/Workers/ChannelUpdater_Tests.swift (1)

1408-1458: New hideHistoryBefore tests correctly cover wiring and precedence

Both tests exercise the non-async ChannelUpdater.addMembers path, ensure the Endpoint is built with hideHistoryBefore, and verify that when both flags are present the encoded body only contains hide_history_before. This aligns with the endpoint implementation and provides good coverage of the precedence semantics. No changes needed.

Sources/StreamChat/StateLayer/Chat.swift (1)

256-275: UserId-based addMembers overload stays consistent with MemberInfo overload

This overload mirrors the new hideHistory / hideHistoryBefore parameters and forwards them through to the MemberInfo-based overload, keeping the two entry points in sync and preserving behavior. Looks good as-is.

@Stream-SDK-Bot
Copy link
Collaborator

SDK Performance

target metric benchmark branch performance status
MessageList Hitches total duration 10 ms 3.34 ms 66.6% 🔼 🟢
Duration 2.6 s 2.55 s 1.92% 🔼 🟢
Hitch time ratio 4 ms per s 1.31 ms per s 67.25% 🔼 🟢
Frame rate 75 fps 77.76 fps 3.68% 🔼 🟢
Number of hitches 1 0.4 60.0% 🔼 🟢

@laevandus laevandus added the 🤞 Ready For QA A PR that is Ready for QA label Dec 3, 2025
@testableapple testableapple added 🟢 QAed A PR that was QAed and removed 🤞 Ready For QA A PR that is Ready for QA labels Dec 3, 2025
@laevandus
Copy link
Contributor Author

I'll keep it open until we have discussed some scenarios around thread replies.

@github-actions
Copy link

Public Interface

 public class ChatChannelController: DataController, DelegateCallable, DataStoreProvider  
-   public func addMembers(_ members: [MemberInfo],hideHistory: Bool = false,message: String? = nil,completion: ((Error?) -> Void)? = nil)
+   public func addMembers(_ members: [MemberInfo],hideHistory: Bool = false,hideHistoryBefore: Date? = nil,message: String? = nil,completion: ((Error?) -> Void)? = nil)
-   public func addMembers(userIds: Set<UserId>,hideHistory: Bool = false,message: String? = nil,completion: ((Error?) -> Void)? = nil)
+   public func addMembers(userIds: Set<UserId>,hideHistory: Bool = false,hideHistoryBefore: Date? = nil,message: String? = nil,completion: ((Error?) -> Void)? = nil)

 public class Chat  
-   public func addMembers(_ members: [MemberInfo],systemMessage: String? = nil,hideHistory: Bool = false)async throws 
+   public func addMembers(_ members: [MemberInfo],systemMessage: String? = nil,hideHistory: Bool = false,hideHistoryBefore: Date? = nil)async throws 
-   public func addMembers(_ members: [UserId],systemMessage: String? = nil,hideHistory: Bool = false)async throws 
+   public func addMembers(_ members: [UserId],systemMessage: String? = nil,hideHistory: Bool = false,hideHistoryBefore: Date? = nil)async throws 

@Stream-SDK-Bot
Copy link
Collaborator

SDK Size

title develop branch diff status
StreamChat 7.28 MB 7.28 MB 0 KB 🟢
StreamChatUI 4.89 MB 4.89 MB 0 KB 🟢

@Stream-SDK-Bot
Copy link
Collaborator

StreamChat XCSize

Object Diff (bytes)
ChannelUpdater.o +298

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✅ Feature An issue or PR related to a feature 🟢 QAed A PR that was QAed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants