Skip to content

Migrate CommandDto to the generated Command network model - #6593

Merged
gpunto merged 2 commits into
developfrom
migrate/command
Jul 28, 2026
Merged

Migrate CommandDto to the generated Command network model#6593
gpunto merged 2 commits into
developfrom
migrate/command

Conversation

@gpunto

@gpunto gpunto commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Goal

Migrate the downstream CommandDto (channel config.commands) to the generated Command network model. Part of the incremental OpenAPI model migration.

Part of AND-1291

Implementation

  • Add generated internal Command in network.models (patch-free; adds optional created_at/updated_at the hand-written DTO lacked, ignored by the mapper). Delete the hand-written api2.model.dto.CommandDto.
  • The generated type's name collides with the domain io.getstream.chat.android.models.Command, so it's imported aliased as CommandDto (consistent with the codebase's *Dto wire-type convention) in the files that reference it: ConfigDto (commands: List<CommandDto>), DomainMapping (CommandDto.toDomain()), and two test fixtures. This is genuine domain-vs-network disambiguation, not a migration-reminder alias. No wire-shape change; construction sites use named args so the generated field reorder is irrelevant.

Testing

  • spotlessApply, apiCheck (no API drift), detekt, and the full client testDebugUnitTest suite pass.
  • Verified on device via a MIGRATE_PROBE FAB (queried channels, logged parsed config.commands): commands deserialized correctly through the generated model into domain Command — e.g. giphy/[text]/fun_set, mute/[@username]/moderation_set, etc. — confirming the read-path parse.

Summary by CodeRabbit

  • Refactor
    • Consolidated custom chat command handling around a shared network model.
    • Preserved existing command fields and mappings, including optional creation and update timestamps.
    • Removed a redundant internal command data model without changing public APIs.

@gpunto
gpunto requested a review from a team as a code owner July 28, 2026 11:30
@gpunto gpunto added the pr:internal Internal changes / housekeeping label Jul 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.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 90482eb6-1d7e-41a8-bde6-26a5c2ec70f2

📥 Commits

Reviewing files that changed from the base of the PR and between 46a2b7f and 1c2768e.

📒 Files selected for processing (6)
  • 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/CommandDto.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/ConfigDto.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/Command.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/parser2/testdata/ChannelDtoTestData.kt
💤 Files with no reviewable changes (1)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/CommandDto.kt

Walkthrough

The API2 command DTO is replaced by a Moshi-serializable network Command model. Configuration, domain mapping, and test fixtures now import the network model under the existing CommandDto alias.

Changes

Command model consolidation

Layer / File(s) Summary
Network command model and configuration contract
stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/Command.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/ConfigDto.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/CommandDto.kt
Adds the internal Moshi-serializable network Command model, updates ConfigDto.commands to use it, and removes the former API2 CommandDto.
Command mapping and fixture migration
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/parser2/testdata/ChannelDtoTestData.kt
Updates domain mapping and test fixtures to resolve CommandDto as the network Command type.
Estimated code review effort: 2 (Simple) ~10 minutes

Suggested reviewers: andremion, velikovpetar

Poem

I’m a bunny with a model to share,
Commands hop through network air.
Old DTO burrows out of sight,
Mappings now point to the right.
Tests nibble happily—what a delight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: migrating CommandDto to the generated Command network model.
Description check ✅ Passed The description includes the required Goal, Implementation, and Testing sections and is detailed enough despite missing UI, checklist, and GIF content.
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.
✨ 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/command

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.

@github-actions

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.22 MB 11.22 MB 0.00 MB 🟢
stream-chat-android-compose 12.70 MB 12.70 MB 0.00 MB 🟢

@gpunto
gpunto enabled auto-merge (squash) July 28, 2026 12:06
@sonarqubecloud

Copy link
Copy Markdown

@gpunto
gpunto merged commit 610f17b into develop Jul 28, 2026
19 checks passed
@gpunto
gpunto deleted the migrate/command branch July 28, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:internal Internal changes / housekeeping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants