Skip to content

Move to stream-android-core 5.0.2 and handle aggregated socket events - #213

Merged
aleksandar-apostolov merged 1 commit into
developfrom
chore/update-core-5.0.2
Sep 10, 2026
Merged

aleksandar-apostolov merged 1 commit into
developfrom
chore/update-core-5.0.2

Conversation

@aleksandar-apostolov

@aleksandar-apostolov aleksandar-apostolov commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Goal

Closes AND-1506 — feeds was pinned to core 4.0.0 while core shipped 5.0.2.

Implementation

  • streamAndroidCore 4.0.0 → 5.0.2.
  • Core 5.0.0 replaced the socket session's StreamBatcher with StreamEventAggregator, so StreamComponentProvider no longer takes a batcher. eventAggregator is left unset: core builds one from the event parser it already holds, at the aggregation defaults on socketConfig (threshold 50, 500 ms window). The old batcher's batchSize=10 / 100 ms / 1000 ms was deliberately not mapped across — batching and spike-aggregation are different mechanisms, so the constants don't carry meaning between them. Aggregation stays at core's defaults: the goal here is preserving the dispatch contract, and how feeds wants to handle spikes is a separate decision it can take later.
  • The aggregator also changes the dispatch contract: under a spike core delivers one StreamAggregatedEvent wrapping N events rather than N separate calls. FeedsClientImpl.onEvent accepted only WSEvent, so on 5.x every event in a spike would have gone down the error branch and been dropped. It now unwraps the batch and replays it in arrival order, leaving the single-event path untouched.
  • StreamBatcher itself is unchanged in 5.0.2, so FeedOwnValuesRepositoryImpl's own use of it is unaffected.

Testing

  • Three new FeedsClientImplTest cases: an aggregated batch dispatches every event it holds, a foreign payload mid-batch doesn't stop the rest, and single events still dispatch once. All three were confirmed to fail with the unwrap removed.
  • spotlessCheck, apiCheck, testDebugUnitTest, lint and assembleDebug pass locally. apiCheck is clean — the change is entirely internal, no public API surface moved.
  • Not covered: aggregation only triggers under real socket load, so the batch path isn't exercised against a live backend here.

Checklist

  • Issue linked (if any)
  • Tests/docs updated
  • I have signed the Stream CLA (required for external contributors)

Summary by CodeRabbit

  • Bug Fixes

    • Improved event processing to correctly handle aggregated events and dispatch each contained event.
    • Preserved valid WebSocket events when aggregated payloads include unsupported event types.
    • Added error handling for unexpected event types.
  • Maintenance

    • Updated the Android core dependency to version 5.0.2.
    • Simplified client event configuration to use the core’s standard socket settings.

Core 5.0.0 replaced the socket session's StreamBatcher with
StreamEventAggregator, so StreamComponentProvider no longer takes a
`batcher`. Leave `eventAggregator` unset: core builds one from the event
parser it already holds, tuned by the aggregation values on socketConfig.

The aggregator changes the dispatch contract. Under a traffic spike core
delivers one StreamAggregatedEvent wrapping N events instead of N
separate calls, and FeedsClientImpl only accepted WSEvent — every event
in a spike would have been logged as an error and dropped. Unwrap the
batch and replay it in arrival order.
@aleksandar-apostolov aleksandar-apostolov added the pr:dependencies Dependency updates label Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 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 Sep 9, 2026

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-feeds-android-client 2.53 MB 2.55 MB 0.02 MB 🟢

@sonarqubecloud

sonarqubecloud Bot commented Sep 9, 2026

Copy link
Copy Markdown

@aleksandar-apostolov
aleksandar-apostolov marked this pull request as ready for review September 9, 2026 09:34
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 867c93e3-9607-4d96-891e-8306f91be8fd

📥 Commits

Reviewing files that changed from the base of the PR and between 8aa4dad and 34959d2.

📒 Files selected for processing (4)
  • gradle/libs.versions.toml
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/client/Create.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/client/FeedsClientImpl.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/client/FeedsClientImplTest.kt

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The Android core version changes to 5.0.2. Client creation uses core event aggregation defaults. FeedsClientImpl replays aggregated events individually and preserves existing WSEvent dispatch behavior. Tests cover aggregated and single events.

Changes

Event dispatch flow

Layer / File(s) Summary
Core aggregation configuration
gradle/libs.versions.toml, stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/client/Create.kt
The Android core version changes to 5.0.2. Client creation removes explicit StreamBatcher configuration and leaves event aggregation unset.
Aggregated event replay
stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/client/FeedsClientImpl.kt, stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/client/FeedsClientImplTest.kt
FeedsClientImpl replays events from StreamAggregatedEvent through existing handling. Tests cover multiple events, mixed payloads, and single events.

Priority: ⬇️ Low

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

Merge Risk: ⚪ Minimal · up to 34959

This updates core event aggregation and replays each aggregated socket event through the existing feed dispatch path. The covered event cases preserve normal dispatch behavior, with no current merge-blocking risk identified.

Sequence Diagram(s)

sequenceDiagram
  participant StreamClientListener
  participant FeedsClientImpl
  participant feedsEventsSubscriptionManager
  StreamClientListener->>FeedsClientImpl: Deliver StreamAggregatedEvent
  FeedsClientImpl->>FeedsClientImpl: Replay contained events in arrival order
  FeedsClientImpl->>feedsEventsSubscriptionManager: Dispatch each WSEvent
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description check ✅ Passed The description includes all required sections and clearly explains the goal, implementation, testing, and checklist status. The CLA confirmation remains unchecked, but this is a non-critical completi…
Title check ✅ Passed The title clearly summarizes the two main changes: upgrading to stream-android-core 5.0.2 and handling aggregated socket events.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 3 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/update-core-5.0.2

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

A rabbit sees events arrive
Each hops through the client alive
Aggregates split in a row
WebSocket listeners glow
Core five points two makes streams thrive

Comment @coderabbitai help to get the list of available commands.

@aleksandar-apostolov
aleksandar-apostolov merged commit a1ca89f into develop Sep 10, 2026
13 of 14 checks passed
@aleksandar-apostolov
aleksandar-apostolov deleted the chore/update-core-5.0.2 branch September 10, 2026 08:20
@stream-public-bot stream-public-bot added the released Included in a release label Sep 10, 2026
@stream-public-bot

Copy link
Copy Markdown
Collaborator

🚀 Available in v0.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:dependencies Dependency updates released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants