Skip to content

Expose missing operations on existing entities#190

Merged
VelikovPetar merged 2 commits intodevelopfrom
expose-missing-operations
Apr 28, 2026
Merged

Expose missing operations on existing entities#190
VelikovPetar merged 2 commits intodevelopfrom
expose-missing-operations

Conversation

@gpunto
Copy link
Copy Markdown
Collaborator

@gpunto gpunto commented Apr 24, 2026

Goal

Expose missing operations on existing entities: restore activity, update follow, update/delete bookmark folder.

Implementation

  • Add restoreActivity(id) to Feed for restoring soft-deleted activities
  • Add updateFollow(targetFid, custom, pushPreference) to Feed for updating follow relationships
  • Add updateBookmarkFolder(folderId, request) and deleteBookmarkFolder(folderId) to FeedsClient

Testing

Added unit tests for all new operations across repository and state layers.

For testing manually, you'd need to add some code to the sample to exercise the new operations (e.g. in FeedViewModel), as none are currently implemented in the sample.

Checklist

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

Summary by CodeRabbit

  • New Features
    • Bookmark folder management: update existing bookmark folders with new details and delete folders as needed
    • Activity restoration: recover and restore previously soft-deleted activities back to your feed
    • Enhanced follow relationships: update follows with support for custom data and granular push notification preferences

@gpunto gpunto added the pr:new-feature New feature label Apr 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 24, 2026

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.

@gpunto
Copy link
Copy Markdown
Collaborator Author

gpunto commented Apr 24, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

Walkthrough

The PR introduces three new operations across the Android SDK: bookmark folder management (update and delete), activity restoration for soft-deleted items, and follow relationship updates with push notification preferences. These operations are implemented consistently across the API client, repository, and state management layers with unit test coverage.

Changes

Cohort / File(s) Summary
Bookmark Folder Management
FeedsClient.kt, FeedsClientImpl.kt, BookmarksRepository.kt, BookmarksRepositoryImpl.kt, BookmarksRepositoryImplTest.kt
Added updateBookmarkFolder and deleteBookmarkFolder suspend operations. Implementations delegate to the repository layer and dispatch bookmark-folder-updated and bookmark-folder-deleted state events on success.
Activity Restoration
Feed.kt, FeedImpl.kt, ActivitiesRepository.kt, ActivitiesRepositoryImpl.kt, ActivitiesRepositoryImplTest.kt
Introduces restoreActivity suspend operation to restore soft-deleted activities. Delegates through the repository layer with network call mapping and emits ActivityAdded state events.
Follow Relationship Updates
Feed.kt, FeedImpl.kt, FeedsRepository.kt, FeedsRepositoryImpl.kt, FeedsRepositoryImplTest.kt, FeedImplTest.kt
Adds updateFollow method supporting custom metadata and push notification preferences via UpdateFollowRequest.PushPreference. Constructs requests from parameters and dispatches FollowUpdated state events.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Folders update, activities restore,
Follows flow with pushes galore,
Through repositories neat,
The features complete,
Stream feeds now has so much more! 📱✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 19.15% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: exposing missing operations on existing entities in the Stream Feeds Android client.
Description check ✅ Passed The description follows the template structure with complete Goal, Implementation, and Testing sections; the Testing section acknowledges manual testing requirements with clarity.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 expose-missing-operations

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/FeedImplTest.kt (1)

420-437: Consider asserting the constructed UpdateFollowRequest payload.

This test passes any() to feedsRepository.updateFollow and thus won't catch regressions in how FeedImpl.updateFollow maps targetFid, custom, and pushPreference into the request (e.g., swapping source/target, dropping custom, etc.). Consider asserting the exact request, similar to how createPoll uses a match<...> block.

💡 Example
-        coEvery { feedsRepository.updateFollow(any()) } returns Result.success(follow)
+        coEvery { feedsRepository.updateFollow(any()) } returns Result.success(follow)
...
-        verify { stateEventListener.onEvent(StateUpdateEvent.FollowUpdated(follow)) }
+        coVerify {
+            feedsRepository.updateFollow(
+                match {
+                    it.source == "group:id" &&
+                        it.target == "user:target" &&
+                        it.custom == custom &&
+                        it.pushPreference == pushPreference
+                }
+            )
+        }
+        verify { stateEventListener.onEvent(StateUpdateEvent.FollowUpdated(follow)) }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/FeedImplTest.kt`
around lines 420 - 437, The test currently uses any() for
feedsRepository.updateFollow so it won't catch wrong mappings; change the stub
to capture/assert the exact UpdateFollowRequest constructed by
FeedImpl.updateFollow by using coEvery { feedsRepository.updateFollow(match {
it.source == /* expected source */ && it.target == /* expected target */ &&
it.custom == custom && it.push == pushPreference }) } returns
Result.success(follow) (or equivalent match/assert block), ensuring you
reference UpdateFollowRequest, FeedImpl.updateFollow and
feedsRepository.updateFollow; keep the final assertions (result and
StateUpdateEvent.FollowUpdated) as-is.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/state/FeedImpl.kt`:
- Around line 222-224: restoreActivity currently returns
activitiesRepository.restoreActivity(id) directly without emitting an
ActivityAdded state event; update FeedImpl.restoreActivity to call
activitiesRepository.restoreActivity(id), inspect the Result, and when
successful extract the restored ActivityData and invoke
subscriptionManager.onEvent(ActivityAdded(...)) (using the same FidScope used
elsewhere, e.g., FidScope.unknown in tests) before returning the successful
Result; ensure you do not emit the event on failure and return the original
Result unchanged.

---

Nitpick comments:
In
`@stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/FeedImplTest.kt`:
- Around line 420-437: The test currently uses any() for
feedsRepository.updateFollow so it won't catch wrong mappings; change the stub
to capture/assert the exact UpdateFollowRequest constructed by
FeedImpl.updateFollow by using coEvery { feedsRepository.updateFollow(match {
it.source == /* expected source */ && it.target == /* expected target */ &&
it.custom == custom && it.push == pushPreference }) } returns
Result.success(follow) (or equivalent match/assert block), ensuring you
reference UpdateFollowRequest, FeedImpl.updateFollow and
feedsRepository.updateFollow; keep the final assertions (result and
StateUpdateEvent.FollowUpdated) as-is.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4103dd9e-9d16-4eb0-8672-e1f23ec806a1

📥 Commits

Reviewing files that changed from the base of the PR and between 3246bca and b42afcd.

📒 Files selected for processing (14)
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/FeedsClient.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/Feed.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/client/FeedsClientImpl.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/repository/ActivitiesRepository.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/repository/ActivitiesRepositoryImpl.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/repository/BookmarksRepository.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/repository/BookmarksRepositoryImpl.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/repository/FeedsRepository.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/repository/FeedsRepositoryImpl.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/state/FeedImpl.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/repository/ActivitiesRepositoryImplTest.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/repository/BookmarksRepositoryImplTest.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/repository/FeedsRepositoryImplTest.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/FeedImplTest.kt

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 24, 2026

SDK Size Comparison 📏

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

@gpunto gpunto force-pushed the expose-missing-operations branch from b42afcd to e816840 Compare April 24, 2026 09:15
@gpunto gpunto marked this pull request as ready for review April 24, 2026 09:24
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
53.1% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@VelikovPetar VelikovPetar merged commit 8577ab8 into develop Apr 28, 2026
7 of 8 checks passed
@VelikovPetar VelikovPetar deleted the expose-missing-operations branch April 28, 2026 10:44
@stream-public-bot stream-public-bot added the released Included in a release label Apr 28, 2026
@stream-public-bot
Copy link
Copy Markdown
Collaborator

🚀 Available in v0.9.0

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

Labels

pr:new-feature New feature released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants