Skip to content

[ECO-5606] fix: enforce Locale.ROOT for string formatting in StreamsChannel#581

Merged
ttypic merged 1 commit intomainfrom
fix-locale-problem
Oct 27, 2025
Merged

[ECO-5606] fix: enforce Locale.ROOT for string formatting in StreamsChannel#581
ttypic merged 1 commit intomainfrom
fix-locale-problem

Conversation

@ttypic
Copy link
Contributor

@ttypic ttypic commented Oct 16, 2025

Resolves #580

  • Updated String.format calls to use Locale.ROOT to ensure consistent formatting regardless of device locale configuration.
  • Removed unnecessary @SuppressLint annotation.

Summary by CodeRabbit

  • Bug Fixes

    • Made text formatting for error messages and event names locale-independent so they display consistently across devices.
  • Chores

    • Updated iOS integration CI to use Flutter 3.29 and removed the previous device matrix strategy.
    • Removed an unused lint annotation to streamline code hygiene.

@ttypic ttypic requested a review from sacOO7 October 16, 2025 13:27
@coderabbitai
Copy link

coderabbitai bot commented Oct 16, 2025

Walkthrough

Replaced locale-sensitive String.format calls in StreamsChannel.java to explicitly use Locale.ROOT and removed an unused SuppressLint import/annotation. Updated CI iOS integration: removed device-matrix strategy and bumped the Flutter version from 3.24 to 3.29.

Changes

Cohort / File(s) Summary
Locale-independent formatting
android/src/main/java/io/ably/flutter/plugin/StreamsChannel.java
Added java.util.Locale import; replaced default-locale String.format(...) calls with String.format(Locale.ROOT, ...) across logging and EventSinkInstantiation; removed @SuppressLint("DefaultLocale") and the unused SuppressLint import.
CI configuration (iOS integration)
.github/workflows/flutter_integration.yaml
Removed the device matrix strategy block in the iOS job and bumped the Flutter version in the iOS integration step from 3.24 to 3.29; android job unchanged in this diff.

Sequence Diagram(s)

sequenceDiagram
  participant Android as Android (system locale)
  participant Streams as StreamsChannel
  participant Flutter as Flutter EventSink

  Android->>Streams: emit event name/payload (may contain locale-specific digits)
  rect rgb(235,245,255)
    Note right of Streams: Formatting now uses Locale.ROOT (explicit)
  end
  Streams->>Streams: String.format(Locale.ROOT, ...)
  Streams->>Flutter: deliver formatted event via EventSink
  Flutter->>Flutter: listeners receive callbacks
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped through code with careful cheer,

Replaced the locales so digits read clear.
No lint to chase, just Root in sight,
Events now bound and hopping right. ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The flutter_integration.yaml changes introduce modifications that appear to be out-of-scope for the stated objective of fixing Locale.ROOT string formatting. Specifically, removing the device matrix strategy from the ios job and bumping the Flutter version from 3.24 to 3.29 are not directly related to resolving the locale-dependent callback delivery issue in StreamsChannel. While the Flutter version bump aligns with the environment mentioned in the issue, these CI/CD changes are not justified in the PR description and should either be explained as necessary for the fix or moved to a separate pull request.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "ECO-5606 fix: enforce Locale.ROOT for string formatting in StreamsChannel" is a clear and concise summary that directly corresponds to the primary code change in the changeset. The title accurately reflects the main modification: updating String.format calls in StreamsChannel to use Locale.ROOT instead of the default locale. This change is specifically targeted at resolving the locale-dependent behavior issue described in the linked issues, making the title both descriptive and specific enough for a developer scanning the repository history to understand the primary intent of the change.
Linked Issues Check ✅ Passed The StreamsChannel.java changes directly address the primary objective from the linked issues (#580 and ECO-5606) by enforcing Locale.ROOT for all String.format calls. This change resolves the root cause of the callback delivery problem where Arabic devices with non-Western numerals were experiencing locale-dependent string formatting issues. By using Locale.ROOT consistently, the callbacks should now function correctly regardless of the device's locale settings, meeting the core requirement to restore connection and channel callback delivery on Arabic-numeral systems.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-locale-problem

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 45ad9ee and 45412f8.

📒 Files selected for processing (2)
  • .github/workflows/flutter_integration.yaml (1 hunks)
  • android/src/main/java/io/ably/flutter/plugin/StreamsChannel.java (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • android/src/main/java/io/ably/flutter/plugin/StreamsChannel.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: ios
  • GitHub Check: android
  • GitHub Check: android (29)
  • GitHub Check: android (24)
  • GitHub Check: ios
🔇 Additional comments (1)
.github/workflows/flutter_integration.yaml (1)

20-20: Verify Flutter version discrepancy.

The iOS job uses Flutter 3.29 (line 20), while the Android job uses Flutter 3.24 (line 56). If this difference is intentional, it should be documented or reconciled. Otherwise, consider standardizing the versions or adding a comment explaining the rationale.

Also applies to: 56-56


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 and usage tips.

@github-actions github-actions bot temporarily deployed to staging/pull/581/features October 16, 2025 13:28 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/581/dartdoc October 16, 2025 13:28 Inactive
@ttypic ttypic force-pushed the fix-locale-problem branch from 307ecf0 to 78f2465 Compare October 16, 2025 13:31
@github-actions github-actions bot temporarily deployed to staging/pull/581/dartdoc October 16, 2025 13:32 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/581/features October 16, 2025 13:32 Inactive
@ttypic ttypic force-pushed the fix-locale-problem branch from 78f2465 to d8d86af Compare October 21, 2025 13:41
@github-actions github-actions bot temporarily deployed to staging/pull/581/features October 21, 2025 13:41 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/581/dartdoc October 21, 2025 13:41 Inactive
@ttypic ttypic force-pushed the fix-locale-problem branch from d8d86af to 45ad9ee Compare October 21, 2025 14:48
@github-actions github-actions bot temporarily deployed to staging/pull/581/features October 21, 2025 14:49 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/581/dartdoc October 21, 2025 14:49 Inactive
- Updated `String.format` calls to use `Locale.ROOT` to ensure consistent formatting regardless of device locale configuration.
- Removed unnecessary `@SuppressLint` annotation.
Copy link
Collaborator

@sacOO7 sacOO7 left a comment

Choose a reason for hiding this comment

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

lgtm

@sacOO7 sacOO7 requested a review from Copilot October 27, 2025 14:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes locale-dependent string formatting in the StreamsChannel class to ensure consistent behavior across different device configurations. The change enforces Locale.ROOT for all String.format calls, preventing potential issues where formatting could vary based on the user's device locale settings.

Key Changes:

  • Updated two String.format calls in StreamsChannel.java to explicitly use Locale.ROOT
  • Removed unnecessary @SuppressLint("DefaultLocale") annotation now that locale is explicitly specified
  • Updated CI configuration to use Flutter 3.29

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
android/src/main/java/io/ably/flutter/plugin/StreamsChannel.java Added Locale.ROOT parameter to String.format calls and removed suppresslint annotation
.github/workflows/flutter_integration.yaml Updated Flutter version to 3.29 and removed device matrix strategy

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ttypic ttypic merged commit 720d5cb into main Oct 27, 2025
9 checks passed
@ttypic ttypic deleted the fix-locale-problem branch October 27, 2025 14:34
@ttypic ttypic mentioned this pull request Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

connection.on().listen callbacks not triggered when system language is Arabic with Arabic numerals

3 participants