Sitelet https://github.com/GetStream/stream-chat-android/pull/6743
Skip to content

Migrate the query channel request to the generated ChannelGetOrCreateRequest - #6743

Merged
gpunto merged 2 commits into
developfrom
migrate/query-channel-request
Sep 29, 2026
Merged

gpunto merged 2 commits into
developfrom
migrate/query-channel-request

Conversation

@gpunto

@gpunto gpunto commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Send the query channel request (query, watch and create channel) with the generated
ChannelGetOrCreateRequest.

Part of AND-1291

Implementation

  • Map the public QueryChannelRequest to ChannelGetOrCreateRequest on both query channel routes, and
    delete the hand-written request.
  • Channel data goes into ChannelInput.custom and a new ChannelInputAdapter flattens it back into
    data, as updateChannel already does. Our routes store undeclared data keys as custom data, so a
    nested custom object would become a custom field named custom.
  • Pagination maps to the typed pagination models. Dates in the maps may be a Date or an ISO string, as
    before.
  • Re-vendor ChannelMemberRequest (user_id optional, user is the new MemberUserRequest), with a
    flattening adapter for MemberUserRequest.
  • ChannelQueryKey keeps the request fields itself instead of the deleted request.

Notes

The messages, members and watchers maps are public, so apps can put any key in them. Keys the typed
pagination models don't declare are no longer sent. The backend ignores all of them except
messages.offset, which it reads but keeps out of the spec; the SDK has no builder that sets it.

Testing

The request on the wire is unchanged for every shape the SDK builds: the old and new models serialize to
the same JSON, key order aside. QueryChannelRequestSerializationTest pins the payload, every pagination
key (dates as Date and as strings) and flat custom data.

On a device: created a channel with a name, an image and nested custom data, read it back flat, paged
messages in each direction and by date, paged members and watchers with an offset, and created a distinct
channel without an id.

🤖 Generated with Claude Code

@gpunto gpunto added the pr:internal Internal changes / housekeeping label Sep 28, 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.

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.11 MB 6.12 MB 0.01 MB 🟢
stream-chat-android-ui-components 11.41 MB 11.42 MB 0.01 MB 🟢
stream-chat-android-compose 13.09 MB 13.11 MB 0.02 MB 🟢

@gpunto
gpunto marked this pull request as ready for review September 29, 2026 07:08
@gpunto
gpunto requested a review from a team as a code owner September 29, 2026 07:08
@coderabbitai

coderabbitai Bot commented Sep 29, 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: abeb3446-2462-4fc9-9762-ba510fdd8b26

📥 Commits

Reviewing files that changed from the base of the PR and between 6cca78b and 699e979.

📒 Files selected for processing (20)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/MoshiChatApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/ChannelApi.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DtoMapping.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/QueryChannelRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/optimisation/hash/ChannelQueryKey.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/MoshiChatParser.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/adapters/ChannelInputAdapter.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/adapters/MemberUserRequestAdapter.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/ChannelConfigOverrides.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/ChannelGetOrCreateRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/ChannelInput.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/ChannelMemberRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/MemberUserRequest.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/MessagePaginationParams.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/PaginationParams.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/CreateChannelMembersSerializationTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/QueryChannelRequestSerializationTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/RequestBodiesTestData.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/testdata/UpdateChannelRequestTestData.kt
💤 Files with no reviewable changes (1)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/requests/QueryChannelRequest.kt

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


Walkthrough

Channel queries now map through DtoMapping to a network request model with channel data and pagination fields. The API endpoints accept that model. New request models and Moshi adapters support serialization, and tests cover mapping, JSON output, and API request bodies.

Changes

Channel query request mapping

Layer / File(s) Summary
Request models and serialization
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/*, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/parser2/...
Adds channel, member, and pagination request models. Adds Moshi adapters for custom fields and channel configuration override values.
Query mapping and API wiring
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/...
Maps client query flags, data, and pagination to ChannelGetOrCreateRequest. Updates the API endpoint request types and query key to use the client query model.
Serialization and API tests
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/...
Adds serialization checks for mapped request fields and pagination. Updates API tests and fixtures for the new request model and member field order.

Priority: ➖ Normal

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

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant QueryChannelRequest
  participant DtoMapping
  participant MoshiChatApi
  participant ChannelApi
  QueryChannelRequest->>DtoMapping: convert to ChannelGetOrCreateRequest
  DtoMapping->>MoshiChatApi: provide mapped request
  MoshiChatApi->>ChannelApi: send mapped request
Loading

Suggested reviewers: velikovpetar, andremion

Merge Risk: ⚪ Minimal · up to 699e9

No actionable issue remains in the channel-query request migration; it is ready to merge after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 699e9

The existing channel routes and connection handling remain in place, with no demonstrated expansion of access. One previously transmissible message-pagination field is now omitted for callers who set it directly, creating a limited compatibility risk.

Retained concerns

  • Low · architecture · inferred: Callers that put offset directly into the public messages map previously sent it to the channel-query API; the generated message-pagination mapping silently omits it. The resulting pagination behavior may differ if the backend consumes that field.
Security review details

Security Blast Radius

  • inferred — The changed client path addresses a channel by the existing type and optional ID routes. The request conversion does not add a route or an identity selector; effective server-side authorization scope was not independently verified.

Trust Boundaries and Controls

  • observed — The client still supplies connection ID outside the request body and defers watch or presence calls until a required connection is available. The generated body is constructed by the mapping layer rather than supplied directly to these routes by the public query API.

Resilience and Maintainability Implications

  • observed — The create-channel caller retains its precondition, retry, result and error hooks, and request sharing around the channel query. The changed request mapping sits inside that existing flow.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 34 functions across 19 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 the query channel request to the generated ChannelGetOrCreateRequest.
Description check ✅ Passed The description includes a clear goal, implementation details, notes about compatibility, and comprehensive testing information. UI sections, checklists, and the GIF are omitted, but they are not cent…
  • 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 checks the fields in line,
And maps the dates to timestamps fine.
The channel data joins the flow,
Pagination fields are set to go.
Moshi packs the request with care,
Then hops away through JSON air.

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 question inline, not blocking.

@gpunto
gpunto enabled auto-merge September 29, 2026 08:34
@sonarqubecloud

Copy link
Copy Markdown

@gpunto
gpunto added this pull request to the merge queue Sep 29, 2026
Merged via the queue into develop with commit a28b1c1 Sep 29, 2026
20 checks passed
@gpunto
gpunto deleted the migrate/query-channel-request branch September 29, 2026 11:00
@stream-public-bot stream-public-bot added the released Included in a release label Sep 30, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

🚀 Available in v7.13.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