Skip to content

Migrate slow mode cooldown request to the generated UpdateChannelPartialRequest model - #6614

Merged
gpunto merged 3 commits into
developfrom
migrate/slow-mode-cooldown
Aug 5, 2026
Merged

Migrate slow mode cooldown request to the generated UpdateChannelPartialRequest model#6614
gpunto merged 3 commits into
developfrom
migrate/slow-mode-cooldown

Conversation

@gpunto

@gpunto gpunto commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Goal

Migrate the slow-mode cooldown request body (enableSlowMode/disableSlowMode, via the private updateCooldown) to the generated UpdateChannelPartialRequest network model.

Part of AND-1291

Implementation

  • updateCooldown now builds UpdateChannelPartialRequest(set = mapOf("cooldown" to N)); ChannelApi.updateCooldown's @Body type is retyped accordingly.
  • Remove the hand-written UpdateCooldownRequest (was internal, so no public-API change).

Testing

  • New UpdateChannelPartialRequestAdapterTest locks the wire shape ({"unset":[],"set":{"cooldown":N}}).
  • Device-probed enable/disable slow mode on the wire: request body byte-exact and backend-accepted.
  • spotlessApply, apiDump (no public-API change), detekt, and the full client testDebugUnitTest suite pass.

Summary by CodeRabbit

  • Bug Fixes

    • Improved slow-mode updates by sending cooldown settings through the standard partial channel update flow.
    • Preserved reliable enabling and disabling of channel slow mode.
  • Tests

    • Added coverage for serializing partial channel updates, including populated, default, set, and unset fields.
    • Updated slow-mode request tests to reflect the unified update format.

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

github-actions Bot commented Aug 4, 2026

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 Aug 4, 2026

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.95 MB 5.95 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.24 MB 11.24 MB 0.00 MB 🟢
stream-chat-android-compose 12.73 MB 12.73 MB 0.00 MB 🟢

@gpunto
gpunto marked this pull request as ready for review August 4, 2026 12:24
@gpunto
gpunto requested a review from a team as a code owner August 4, 2026 12:24
@gpunto
gpunto enabled auto-merge August 4, 2026 12:24
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Cooldown updates now use UpdateChannelPartialRequest instead of the removed UpdateCooldownRequest. API wiring, slow-mode tests, and Moshi serialization fixtures were updated.

Changes

Cooldown request migration

Layer / File(s) Summary
API request migration
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/model/requests/UpdateCooldownRequest.kt
Cooldown updates now submit UpdateChannelPartialRequest. The legacy request model and unused imports were removed.
Request serialization validation
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/*
Slow-mode tests verify cooldown values, including zero. New adapter tests verify populated and default request serialization.

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

Possibly related PRs

Suggested labels: released

Suggested reviewers: andremion, velikovpetar

Poem

A rabbit packed the cooldown light,
Into a partial update tight.
Zero hops when slow mode ends,
Moshi checks what JSON sends.
“Clean requests!” the bunny sings.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 directly and clearly describes the main change: migrating slow-mode cooldown requests from UpdateCooldownRequest to UpdateChannelPartialRequest.
Description check ✅ Passed The description includes Goal, Implementation, and Testing sections that match the template structure. However, it lacks UI Changes, Contributor Checklist, Reviewer Checklist, and GIF sections specified in the template.
✨ 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 migrate/slow-mode-cooldown

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.

@sonarqubecloud

sonarqubecloud Bot commented Aug 5, 2026

Copy link
Copy Markdown

@gpunto
gpunto added this pull request to the merge queue Aug 5, 2026
Merged via the queue into develop with commit a9fc64c Aug 5, 2026
19 checks passed
@gpunto
gpunto deleted the migrate/slow-mode-cooldown branch August 5, 2026 10:35
@stream-public-bot stream-public-bot added the released Included in a release label Aug 13, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

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