Skip to content

Migrate the search results warning to the generated model - #6719

Merged
gpunto merged 3 commits into
developfrom
migrate/search-warning
Sep 23, 2026
Merged

gpunto merged 3 commits into
developfrom
migrate/search-warning

Conversation

@gpunto

@gpunto gpunto commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Parse the search results warning with the generated SearchWarning, retiring SearchWarningDto.

Part of AND-1291

Implementation

  • Point SearchMessagesResponse.resultsWarning at the generated model and migrate its mapper. Vendors
    SearchWarning, the only model in the closure. Imported under an alias, since the domain type has the
    same name.
  • Default channel_search_cids and channel_search_count at the mapper, which is where the shape change
    lands.

Notes

Both scoping fields carry omitempty on the payload struct, and the generated model has them nullable:

ChannelSearchCount int      `json:"channel_search_count,omitempty"`
ChannelSearchCIDs  []string `json:"channel_search_cids,omitempty"`

In practice both are always sent. The backend only builds the warning when the channel query hits its
500-channel limit, so the CID list is full and the count non-zero whenever a warning exists. The domain
keeps its non-null fields, so the mapper defaults to an empty list and zero, which only matters if that
ever changes.

The other two fields, warning_description and warning_code, are plain tags and stay required.

Testing

Mutation sweep over SearchWarning.toDomain: zero survivors, all four fields compile-guaranteed.

Added a mapper test for the case where the optional fields are absent.

Device-probed searchMessages, which returned the probe message and parsed the response with the swapped
field. results_warning itself is not reachable from a probe: the backend only emits it when channel
filters match more than 500 channels, so it came back null as expected, and the populated shape is covered
by the mapper tests instead.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of search warnings returned with message searches.
    • Search results now remain consistent when channel-specific warning details are missing, using an empty channel list and a count of zero.
    • Warning codes and descriptions continue to be displayed correctly.

@gpunto gpunto added the pr:internal Internal changes / housekeeping label Sep 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@gpunto
gpunto marked this pull request as ready for review September 22, 2026 16:26
@gpunto
gpunto requested a review from a team as a code owner September 22, 2026 16:26
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.08 MB 6.08 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.39 MB 11.39 MB 0.00 MB 🟢
stream-chat-android-compose 13.06 MB 13.06 MB 0.00 MB 🟢

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 208c206c-18a0-4f4f-9e66-f437001eb2ef

📥 Commits

Reviewing files that changed from the base of the PR and between e0cf35b and 58e4d85.

📒 Files selected for processing (7)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/SearchWarningDto.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/response/SearchMessagesResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/SearchWarning.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/Mother.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTestArguments.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt
💤 Files with no reviewable changes (1)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/SearchWarningDto.kt

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


Walkthrough

Changes

Search warning model migration

Layer / File(s) Summary
Warning model and response wiring
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/SearchWarning.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/response/SearchMessagesResponse.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/SearchWarningDto.kt
Added the network SearchWarning model, changed SearchMessagesResponse.resultsWarning to use it, and removed SearchWarningDto.
Mapping defaults and test fixtures
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/Mother.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/*
Updated mapping and fixtures to use camelCase response fields. Missing channel IDs map to an empty list, and missing counts map to 0. Tests cover both populated and absent channel search fields.

Priority: ⬇️ Low

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

Change: Bug fix

Suggested reviewers: velikovpetar

Merge Risk: ⚪ Minimal · up to 58e4d

The search warning model migration preserves warning data and safely defaults omitted channel-scoping fields, with focused mapper coverage. The change is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly and concisely describes the main change: migrating search result warnings to the generated model.
Description check ✅ Passed The description includes the goal, implementation details, testing results, issue reference, mapping behavior, and rationale for nullable fields. It omits the UI, contributor checklist, reviewer check…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

A rabbit hops through models bright
New warning fields align just right
Empty paths become lists anew
Counts settle softly into two
Tests tap their paws: the mapping’s true

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

@andremion andremion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. One small nit inline.

@gpunto
gpunto enabled auto-merge September 23, 2026 11:24
@gpunto
gpunto added this pull request to the merge queue Sep 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 23, 2026
@gpunto
gpunto added this pull request to the merge queue Sep 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 23, 2026
@sonarqubecloud

Copy link
Copy Markdown

@gpunto
gpunto enabled auto-merge September 23, 2026 13:25
@gpunto
gpunto added this pull request to the merge queue Sep 23, 2026
Merged via the queue into develop with commit 8abc5f6 Sep 23, 2026
19 checks passed
@gpunto
gpunto deleted the migrate/search-warning branch September 23, 2026 14:51
@stream-public-bot stream-public-bot added the released Included in a release label Sep 24, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

🚀 Available in v7.12.0

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

Labels

pr:internal Internal changes / housekeeping released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants