Skip to content

Migrate app settings response to the generated GetApplicationResponse model - #6615

Merged
gpunto merged 2 commits into
developfrom
migrate/app-settings
Aug 5, 2026
Merged

Migrate app settings response to the generated GetApplicationResponse model#6615
gpunto merged 2 commits into
developfrom
migrate/app-settings

Conversation

@gpunto

@gpunto gpunto commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Goal

Migrate the app-settings response (getAppSettings / ChatClient.appSettings()) from the hand-written AppSettingsResponse to the generated GetApplicationResponse network model.

Part of AND-1291

Implementation

  • Add generated GetApplicationResponse, AppResponseFields, and FileUploadConfig; remove the hand-written AppSettingsResponse.
  • Retype ConfigApi.getAppSettings() to GetApplicationResponse and map it to the domain AppSettings in DomainMapping.

Testing

  • DomainMappingTest covers the GetApplicationResponse -> AppSettings mapping (upload configs, size limits).
  • Device-probed appSettings() on the wire: parses cleanly, fields populated (name, allowed/blocked extensions, size limits).
  • spotlessApply, apiDump (no public-API change), detekt, and the full client testDebugUnitTest suite pass.

Summary by CodeRabbit

  • Bug Fixes

    • Improved application settings handling with updated response formats.
    • Added support for file and image upload configuration limits, allowed types, and blocked types.
    • Ensured invalid or non-positive upload limits fall back to the default value.
  • Tests

    • Updated application settings and mapping coverage for the new response fields and upload limit behavior.

@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.96 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.24 MB 11.25 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 5, 2026 07:29
@gpunto
gpunto requested a review from a team as a code owner August 5, 2026 07:29
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The configuration API now returns GetApplicationResponse. Domain mapping uses internal network models for application and upload settings. Tests and fixtures were updated for camelCase fields and normalized size limits.

Changes

Application response model migration

Layer / File(s) Summary
Network response model contracts
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/api2/model/response/AppSettingsResponse.kt
Added internal Moshi models for application responses and upload configuration. Removed the previous API response DTOs.
API response and domain mapping
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/ConfigApi.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.kt
Updated the configuration endpoint and mapping to use the new models. Size limits are converted to Long and defaulted when non-positive.
Fixtures and mapping validation
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/MoshiChatApiTest*.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt
Updated fixtures and tests for the new response types, camelCase fields, upload settings, and size-limit handling.

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

Possibly related PRs

Suggested labels: released

Suggested reviewers: andremion, velikovpetar

Poem

A rabbit maps the fields just right,
With upload limits set in sight.
Old DTOs hop away,
New models greet the day,
And tests keep every value bright.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the migration from AppSettingsResponse to GetApplicationResponse.
Description check ✅ Passed The description includes the goal, implementation, linked issue, and testing details relevant to the model migration.
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/app-settings

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (4)
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt (1)

236-236: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Rename the test to a backtick-delimited name.

The changed method still uses testAppSettings. Rename it to a readable backtick test name.
As per coding guidelines, test methods in **/*Test.{kt,java} must use backtick names.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt`
at line 236, Rename the test method testAppSettings to a descriptive
backtick-delimited Kotlin test name, preserving its existing parameters, runTest
body, and behavior.

Source: Coding guidelines

stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt (1)

329-348: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the non-positive size-limit branch with explicit inputs.

randomAppSettingsResponse() supplies positive limits, so this test never enters sizeLimit <= 0. The expected value also repeats the production expression. Add explicit 0 and negative cases for both upload configurations and assert AppSettings.DEFAULT_SIZE_LIMIT_IN_BYTES directly.
As per coding guidelines, changed behavior must have refreshed tests.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt`
around lines 329 - 348, Update the `GetApplicationResponse is correctly mapped
to AppSettings` test to use explicit zero and negative `sizeLimit` inputs for
both `fileUploadConfig` and `imageUploadConfig`, rather than relying on
`randomAppSettingsResponse()`. Assert `AppSettings.DEFAULT_SIZE_LIMIT_IN_BYTES`
directly for each non-positive limit, while retaining coverage of normal
positive-limit mapping.

Source: Coding guidelines

stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTestArguments.kt (1)

107-107: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Exercise JSON deserialization for the new response model.

appSettingsInput() supplies a prebuilt GetApplicationResponse to RetroSuccess. This verifies the typed endpoint path, but it cannot detect an incorrect @Json name or generated adapter issue for file_upload_config, image_upload_config, or size_limit. Add a raw JSON case through the parser, or reference an existing wire-level test that covers these fields.
As per coding guidelines, changed behavior must have refreshed tests.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTestArguments.kt`
at line 107, Update appSettingsInput() and its parameterized cases to include a
raw JSON response parsed through the Moshi/API parser, covering
file_upload_config, image_upload_config, and size_limit, rather than only
supplying a prebuilt GetApplicationResponse; alternatively reference an existing
wire-level test that validates these fields and refresh the changed-behavior
coverage.

Source: Coding guidelines

stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/AppResponseFields.kt (1)

17-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the generated-file suppression policy.

The three generated models add the same undocumented file-level suppression block. Add a generator-level rationale or configure a generated-source exemption. Remove the unused kotlin.collections.List import in FileUploadConfig.kt if the generator does not require it.

  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/AppResponseFields.kt#L17-L22: document or remove the file-level suppressions.
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/FileUploadConfig.kt#L17-L22: document or remove the file-level suppressions and remove the unused List import if possible.
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/GetApplicationResponse.kt#L17-L22: document or remove the file-level suppressions.
    As per coding guidelines, suppressions must be documented.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/AppResponseFields.kt`
around lines 17 - 22, The generated model suppression blocks are undocumented
and should be addressed consistently across AppResponseFields.kt:17-22,
FileUploadConfig.kt:17-22, and GetApplicationResponse.kt:17-22 by documenting
their generator-level rationale or configuring an exemption and removing
unnecessary suppressions. In FileUploadConfig.kt:17-22, also remove the unused
kotlin.collections.List import if it is not required by generation.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/AppResponseFields.kt`:
- Around line 17-22: The generated model suppression blocks are undocumented and
should be addressed consistently across AppResponseFields.kt:17-22,
FileUploadConfig.kt:17-22, and GetApplicationResponse.kt:17-22 by documenting
their generator-level rationale or configuring an exemption and removing
unnecessary suppressions. In FileUploadConfig.kt:17-22, also remove the unused
kotlin.collections.List import if it is not required by generation.

In
`@stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt`:
- Around line 329-348: Update the `GetApplicationResponse is correctly mapped to
AppSettings` test to use explicit zero and negative `sizeLimit` inputs for both
`fileUploadConfig` and `imageUploadConfig`, rather than relying on
`randomAppSettingsResponse()`. Assert `AppSettings.DEFAULT_SIZE_LIMIT_IN_BYTES`
directly for each non-positive limit, while retaining coverage of normal
positive-limit mapping.

In
`@stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTest.kt`:
- Line 236: Rename the test method testAppSettings to a descriptive
backtick-delimited Kotlin test name, preserving its existing parameters, runTest
body, and behavior.

In
`@stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/MoshiChatApiTestArguments.kt`:
- Line 107: Update appSettingsInput() and its parameterized cases to include a
raw JSON response parsed through the Moshi/API parser, covering
file_upload_config, image_upload_config, and size_limit, rather than only
supplying a prebuilt GetApplicationResponse; alternatively reference an existing
wire-level test that validates these fields and refresh the changed-behavior
coverage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 59f8c11f-4019-4191-acca-1c74548e9e99

📥 Commits

Reviewing files that changed from the base of the PR and between 710fdf0 and bf1ceae.

📒 Files selected for processing (10)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/endpoint/ConfigApi.kt
  • 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/response/AppSettingsResponse.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/AppResponseFields.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/FileUploadConfig.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/network/models/GetApplicationResponse.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/MoshiChatApiTest.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/response/AppSettingsResponse.kt

@sonarqubecloud

sonarqubecloud Bot commented Aug 5, 2026

Copy link
Copy Markdown

@gpunto
gpunto enabled auto-merge August 5, 2026 10:27
@gpunto
gpunto added this pull request to the merge queue Aug 5, 2026
Merged via the queue into develop with commit 7099bf6 Aug 5, 2026
19 checks passed
@gpunto
gpunto deleted the migrate/app-settings branch August 5, 2026 13:16
@stream-public-bot

Copy link
Copy Markdown
Contributor

🚀 Available in v7.8.0

@stream-public-bot stream-public-bot added the released Included in a release label Aug 13, 2026
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