Skip to content

feat: Flutter SDK update for version 23.2.0#308

Open
ArnabChatterjee20k wants to merge 13 commits intomainfrom
dev
Open

feat: Flutter SDK update for version 23.2.0#308
ArnabChatterjee20k wants to merge 13 commits intomainfrom
dev

Conversation

@ArnabChatterjee20k
Copy link
Copy Markdown
Member

@ArnabChatterjee20k ArnabChatterjee20k commented Apr 20, 2026

This PR contains updates to the Flutter SDK for version 23.2.0.

@ArnabChatterjee20k ArnabChatterjee20k changed the title feat: Flutter SDK update for version 23.2.0 feat: Flutter SDK update for version 23.3.0 Apr 20, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 20, 2026

Greptile Summary

This PR bumps the Flutter SDK to version 23.2.0 and refactors the realtime subscription protocol from URL-encoded query parameters to WebSocket messages via a new _sendSubscribeMessage() method. Version headers, pubspec.yaml, and the README dependency pin are all updated consistently.

Two concerns flagged in prior review rounds remain unaddressed in lib/src/realtime_mixin.dart: the slot+1 collision in the connected handler that can silence events for one of two concurrent subscriptions on reconnect, and the _pendingSubscribeSlots list being cleared and rebuilt on every _sendSubscribeMessage() call which can mis-route responses when multiple subscribe messages are in-flight. The unused import '../models.dart' as models; in service.dart also remains.

Confidence Score: 4/5

Safe to merge for single-subscription use cases; multi-subscription reconnect correctness bugs from prior review remain open.

Two P1 findings from previous review rounds (connected-handler slot collision, _pendingSubscribeSlots race) are still present and unaddressed. No new critical issues found beyond a P2 README vagueness nit.

lib/src/realtime_mixin.dart — connected-handler slot+1 collision and _pendingSubscribeSlots race condition remain unresolved.

Important Files Changed

Filename Overview
lib/src/realtime_mixin.dart Major refactor: subscriptions are now sent via WebSocket messages instead of URL query params; introduces _sendSubscribeMessage() and _pendingSubscribeSlots, but the connected-handler slot+1 collision and _pendingSubscribeSlots race (flagged in prior review) remain unresolved.
lib/src/service.dart Adds unused import '../models.dart' as models; — will trigger a Dart unused_import lint warning (flagged in prior review).
README.md Version dependency updated to ^23.2.0; compatibility note changed from specific '1.9.x' to vague 'latest'.
lib/src/client_browser.dart Routine version bump of x-sdk-version header from 23.1.0 to 23.2.0.
lib/src/client_io.dart Routine version bump of x-sdk-version header from 23.1.0 to 23.2.0.
pubspec.yaml Package version bumped from 23.1.0 to 23.2.0 — matches SDK headers and README.
CHANGELOG.md Added 23.2.0 changelog entry describing SDK regeneration and README update.
test/services/account_test.dart Added isA<models.Session> and isA<models.Token> type assertions to OAuth2 tests — improves test coverage for return types.

Reviews (3): Last reviewed commit: "Commit from GitHub Actions (Format and p..." | Re-trigger Greptile

Comment thread lib/src/service.dart
@@ -1,3 +1,4 @@
import '../models.dart' as models;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Unused import

models is imported but never referenced anywhere in the Service class body. This will trigger a Dart unused_import lint warning.

Suggested change
import '../models.dart' as models;
import 'client.dart';

Comment on lines +148 to +161
for (var index = 0; index < subscriptions.length; index++) {
final slot = index < _pendingSubscribeSlots.length
? _pendingSubscribeSlots[index]
: null;
final item = subscriptions[index] as Map<String, dynamic>?;
final subscriptionId = item?['subscriptionId']?.toString();
if (slot == null ||
subscriptionId == null ||
subscriptionId.isEmpty) {
continue;
}
_slotToSubscriptionId[slot] = subscriptionId;
_subscriptionIdToSlot[subscriptionId] = slot;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 _pendingSubscribeSlots race between multiple in-flight subscribe messages

_pendingSubscribeSlots is cleared and rebuilt every time _sendSubscribeMessage is called. Because responses arrive in order but the list is mutated before earlier responses land, a slot can be mapped to the wrong subscriptionId.

Concrete scenario:

  1. Subscribe slot A → _sendSubscribeMessage_pendingSubscribeSlots = [A]
  2. Subscribe slot D arrives while (1) is in-flight → _sendSubscribeMessage_pendingSubscribeSlots = [A, D]
  3. Slot A is closed → _sendSubscribeMessage_pendingSubscribeSlots = [D]
  4. Response to (1) arrives: subscriptions[0].subscriptionId = "s_A" — but _pendingSubscribeSlots[0] is now D, so _slotToSubscriptionId[D] = "s_A". Events for channel A will be incorrectly dispatched to slot D's callback until the response to (3) overwrites the entry.

Consider versioning each batch (e.g., a monotonic sequence tag included in the subscribe message and echoed in the response), so stale responses can be discarded.

Comment on lines +106 to 121
rawSubscriptions.forEach((slotStr, subscriptionId) {
final slot = int.tryParse(slotStr.toString());
if (slot != null) {
_slotToSubscriptionId[slot] = subscriptionId.toString();
_subscriptionIdToSlot[subscriptionId.toString()] = slot;
final directSlotExists = _subscriptions.containsKey(slot);
final shiftedSlot = slot + 1;
final shiftedSlotExists =
_subscriptions.containsKey(shiftedSlot);
final targetSlot = directSlotExists
? slot
: shiftedSlotExists
? shiftedSlot
: slot;
_slotToSubscriptionId[targetSlot] = subscriptionId.toString();
_subscriptionIdToSlot[subscriptionId.toString()] = targetSlot;
}
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Slot+1 shifting collides on multi-subscription reconnect

When the server sends a 0-based connected subscriptions map and there are ≥2 client subscriptions (client slots start at 1), both server slot N and server slot N+1 resolve to the same client slot N+1, overwriting the first mapping and leaving the higher-indexed slot with no subscriptionId.

Concrete example — client has slots 1 and 2, server returns {"0":"s_a","1":"s_b"}:

  • Server "0" → direct slot 0 missing → shifted slot 1 found → _slotToSubscriptionId[1] = "s_a"
  • Server "1" → direct slot 1 found → _slotToSubscriptionId[1] = "s_b" (overwrites "s_a")
  • Result: slot 2 has no subscriptionId; all events for that subscription are silently dropped.

Consider using _pendingSubscribeSlots (populated by _sendSubscribeMessage) as the authoritative index → slot mapping for connected payloads too, the same way the response case does at lines 148–161.

@ArnabChatterjee20k ArnabChatterjee20k changed the title feat: Flutter SDK update for version 23.3.0 feat: Flutter SDK update for version 23.2.0 Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants