Skip to content

Conversation

gpunto
Copy link
Contributor

@gpunto gpunto commented Oct 3, 2025

Goal

The current logic to add/update members into MemberListState has two flaws:

  • It's not enforcing sorting
  • It's not processing added members on batch updates
    Thi PR fixes that.

Implementation

Handle added members for batch updates & enforce sorting

Testing

Testing manually it's not trivial, but there are now unit tests exercising that behavior.

Checklist

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

@gpunto gpunto requested a review from Copilot October 3, 2025 11:30
@gpunto gpunto added the pr:bug Bug fix label Oct 3, 2025
Copy link
Contributor

github-actions bot commented Oct 3, 2025

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.

🎉 Great job! This PR is ready for review.

Copy link

@Copilot 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

Fixes MemberListState update logic to enforce sorting and to process added members during batch updates, ensuring member lists remain correctly ordered after add/update operations.

  • Enforces sorted insertion/repositioning using upsertSorted and explicit sorting with CompositeComparator
  • Processes added members in ModelUpdates (previously ignored) and updates tests to validate ordering and repositioning
  • Refactors tests to use deterministic createdAt values and a helper for initial state setup

Reviewed Changes

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

File Description
MemberListStateImpl.kt Adds sorted upsert logic for single and batch updates; processes added members and re-sorts list
MemberListStateImplTest.kt Updates/extends tests to cover sorting, added members in batch updates, and repositioning logic; adds helper

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

github-actions bot commented Oct 3, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-feeds-android-client 2.47 MB 2.47 MB 0.00 MB 🟢

@gpunto gpunto force-pushed the fix/memberliststate-batch-updates branch from 39ebb32 to 26e47a0 Compare October 3, 2025 12:29
Copy link

sonarqubecloud bot commented Oct 3, 2025

@gpunto gpunto marked this pull request as ready for review October 3, 2025 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:bug Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant