Skip to content

Add and update filter fields#170

Merged
VelikovPetar merged 5 commits intodevelopfrom
and-919/location-filtering
Dec 18, 2025
Merged

Add and update filter fields#170
VelikovPetar merged 5 commits intodevelopfrom
and-919/location-filtering

Conversation

@gpunto
Copy link
Contributor

@gpunto gpunto commented Dec 17, 2025

Goal

AND-919

We're adding some missing filter fields and updating some existing ones. Notably, we're adding location based filters, now that they're supported in Core (GetStream/stream-core-android#30).

Implementation

Add and update relevant filter fields

Testing

You could try using them to filter objects in the sample and see they're correctly passed to the backend and that local filtering also work where supported.

Checklist

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

Summary by CodeRabbit

  • New Features

    • Added location-based activity filtering (proximity and bounding box)
    • Added feed-based activity filtering
    • Added Team sorting option for moderation configurations
  • Bug Fixes

    • Corrected moderation configuration key sorting behavior
  • Updates

    • Renamed activity type filter field for improved clarity

✏️ Tip: You can customize this high-level summary in your review settings.

@gpunto gpunto added pr:breaking-change Breaking change pr:new-feature New feature labels Dec 17, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 17, 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.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 17, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-feeds-android-client 2.40 MB 2.44 MB 0.04 MB 🟢

Base automatically changed from and-952/bump-core to develop December 18, 2025 09:06
@gpunto gpunto force-pushed the and-919/location-filtering branch from e4a137a to 3aab839 Compare December 18, 2025 09:07
@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

Walkthrough

This PR adds location-based filtering support to the activities query API. New filter fields enable filtering by proximity (near) and bounding box (withinBounds), while a feed filter is introduced. The activity type field is renamed from type to activityType for consistency. Moderation config sorting is updated with a corrected key field and new team sort field.

Changes

Cohort / File(s) Summary
Location-based filtering implementation
stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/query/ActivitiesQuery.kt, stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/model/ActivityOperations.kt
Added near and withinBounds location-based filter fields to ActivitiesFilterField, added feed filter field, renamed type to activityType. Introduced ActivityLocation.toCoordinate() extension function to convert location data to coordinate format.
Moderation config sorting updates
stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/query/ModerationConfigsQuery.kt
Updated ModerationConfigsSortField.Key to use "key" field instead of "id", added new Team sort field for moderation configs.
Test updates for field renames
stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/{ActivityListEventHandlerTest,FeedEventHandlerTest,OnNewActivityDefaultTest}.kt
Updated test fixtures to use ActivitiesFilterField.activityType instead of ActivitiesFilterField.type across three test files.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • Verify location-based filter field definitions (near, withinBounds) and their remote field mappings ("near", "within_bounds")
  • Review ActivityLocation.toCoordinate() conversion logic for correctness
  • Confirm typeactivityType rename is applied consistently across the codebase and doesn't break existing usage
  • Validate test updates properly reflect the new filter field names and exercise the functionality

Poem

🐰 A rabbit hops through feeds with glee,
Finding posts by location's decree,
Near and bounds filter the way,
While activity types have a fresher say,
Hopping closer to perfection today! 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add and update filter fields' is concise and accurately reflects the main change: adding location-based filtering capabilities and updating existing filter fields.
Description check ✅ Passed The PR description follows the template with Goal, Implementation, Testing, and Checklist sections. All required sections are present and sufficiently detailed.
Linked Issues check ✅ Passed The code changes successfully implement the objectives from AND-919: location-based filtering support is added via near and withinBounds fields, filter field naming is updated (type→activityType), and related infrastructure is added.
Out of Scope Changes check ✅ Passed All changes are directly related to the PR objectives. Minor updates to ModerationConfigsSortField and test file updates are supporting changes that align with the location-filtering implementation.
✨ 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 and-919/location-filtering

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear 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 108b156 and 3aab839.

📒 Files selected for processing (6)
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/query/ActivitiesQuery.kt (4 hunks)
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/query/ModerationConfigsQuery.kt (2 hunks)
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/model/ActivityOperations.kt (3 hunks)
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/ActivityListEventHandlerTest.kt (1 hunks)
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/FeedEventHandlerTest.kt (1 hunks)
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/OnNewActivityDefaultTest.kt (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{kt,kts}

📄 CodeRabbit inference engine (AGENTS.md)

Kotlin code targeting JVM 11, using Gradle Kotlin DSL with shared logic in buildSrc/

Files:

  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/ActivityListEventHandlerTest.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/query/ModerationConfigsQuery.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/model/ActivityOperations.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/FeedEventHandlerTest.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/query/ActivitiesQuery.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/OnNewActivityDefaultTest.kt
**/*.kt

📄 CodeRabbit inference engine (AGENTS.md)

**/*.kt: Run Spotless (ktfmt) to enforce Kotlin style with 4 spaces and no wildcard imports
Run Detekt static analysis before committing and fix all findings
Use PascalCase for type names, camelCase for members

Files:

  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/ActivityListEventHandlerTest.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/query/ModerationConfigsQuery.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/model/ActivityOperations.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/FeedEventHandlerTest.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/query/ActivitiesQuery.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/OnNewActivityDefaultTest.kt
stream-feeds-android-client/**/*.kt

📄 CodeRabbit inference engine (AGENTS.md)

stream-feeds-android-client/**/*.kt: Enforce explicit API visibility for public APIs
Provide KDoc documentation for all public APIs
Log via StreamLogger with actionable context and no secrets

Files:

  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/ActivityListEventHandlerTest.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/query/ModerationConfigsQuery.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/model/ActivityOperations.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/FeedEventHandlerTest.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/query/ActivitiesQuery.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/OnNewActivityDefaultTest.kt
**/*.{kt,properties,gradle}

📄 CodeRabbit inference engine (AGENTS.md)

Scrub sensitive data from logs and configs

Files:

  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/ActivityListEventHandlerTest.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/query/ModerationConfigsQuery.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/model/ActivityOperations.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/FeedEventHandlerTest.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/query/ActivitiesQuery.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/OnNewActivityDefaultTest.kt
**/src/test/kotlin/**/*.kt

📄 CodeRabbit inference engine (AGENTS.md)

**/src/test/kotlin/**/*.kt: Place tests under each module's src/test/kotlin, mirroring package names
Cover success, retry, and failure paths for feed mutations, token refresh, and connectivity loss in tests
Use MockWebServer, fakes, Turbine, and coroutines-test for deterministic test assertions
Use backticked test names when helpful for readability

Files:

  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/ActivityListEventHandlerTest.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/FeedEventHandlerTest.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/OnNewActivityDefaultTest.kt
🧠 Learnings (7)
📚 Learning: 2025-12-18T09:06:42.761Z
Learnt from: CR
Repo: GetStream/stream-feeds-android PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-18T09:06:42.761Z
Learning: Applies to **/src/test/kotlin/**/*.kt : Cover success, retry, and failure paths for feed mutations, token refresh, and connectivity loss in tests

Applied to files:

  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/ActivityListEventHandlerTest.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/FeedEventHandlerTest.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/OnNewActivityDefaultTest.kt
📚 Learning: 2025-12-18T09:06:42.761Z
Learnt from: CR
Repo: GetStream/stream-feeds-android PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-18T09:06:42.761Z
Learning: Applies to stream-feeds-android-network/**/*.kt : Keep coroutines structured and thread safe around token refresh, pagination, and realtime updates

Applied to files:

  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/model/ActivityOperations.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/FeedEventHandlerTest.kt
  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/query/ActivitiesQuery.kt
📚 Learning: 2025-12-18T09:06:42.761Z
Learnt from: CR
Repo: GetStream/stream-feeds-android PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-18T09:06:42.761Z
Learning: Applies to stream-feeds-android-client/**/*.kt : Log via `StreamLogger` with actionable context and no secrets

Applied to files:

  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/model/ActivityOperations.kt
📚 Learning: 2025-12-18T09:06:42.761Z
Learnt from: CR
Repo: GetStream/stream-feeds-android PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-18T09:06:42.761Z
Learning: Applies to stream-feeds-android-network/**/*.kt : Use Retrofit, OkHttp, and Moshi (KSP) for networking and serialization

Applied to files:

  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/model/ActivityOperations.kt
📚 Learning: 2025-12-18T09:06:42.761Z
Learnt from: CR
Repo: GetStream/stream-feeds-android PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-18T09:06:42.761Z
Learning: Applies to stream-feeds-android-client/**/*.kt : Provide KDoc documentation for all public APIs

Applied to files:

  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/model/ActivityOperations.kt
📚 Learning: 2025-12-18T09:06:42.761Z
Learnt from: CR
Repo: GetStream/stream-feeds-android PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-18T09:06:42.761Z
Learning: Applies to stream-feeds-android-client/**/*.kt : Enforce explicit API visibility for public APIs

Applied to files:

  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/model/ActivityOperations.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/FeedEventHandlerTest.kt
  • stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/OnNewActivityDefaultTest.kt
📚 Learning: 2025-12-18T09:06:42.761Z
Learnt from: CR
Repo: GetStream/stream-feeds-android PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-18T09:06:42.761Z
Learning: Applies to stream-feeds-android-network/**/*.kt : Reuse shared retry/backoff helpers instead of implementing bespoke networking logic

Applied to files:

  • stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/model/ActivityOperations.kt
⏰ 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: compare-sdk-sizes / Compare SDK sizes
  • GitHub Check: Unit Tests
  • GitHub Check: Lint
  • GitHub Check: Spotless
  • GitHub Check: Compile
🔇 Additional comments (11)
stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/query/ModerationConfigsQuery.kt (2)

130-130: The remote field names "key" and "team" are correct and verified. Both sort and filter fields use identical remote field names, and since the corresponding filter fields already exist in the codebase (lines 65-66, 89-90), the backend already supports these field names. No action needed.

Likely an incorrect or invalid review comment.


143-149: Team sort field implementation is correct.

The code follows the established pattern used by all other sort fields (Key, CreatedAt, UpdatedAt) and properly references the matching team filter field. KDoc is clear, public visibility is explicit, and naming conventions are followed throughout.

stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/ActivityListEventHandlerTest.kt (1)

70-70: LGTM! Field rename aligns with the updated public API.

The test correctly uses ActivitiesFilterField.activityType instead of the previous type field, matching the API changes introduced in this PR.

stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/FeedEventHandlerTest.kt (1)

93-93: LGTM! Field rename aligns with the updated public API.

The query construction correctly uses ActivitiesFilterField.activityType instead of the previous type field, consistent with the API changes.

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/model/ActivityOperations.kt (2)

19-19: LGTM! Imports support the new location-based filtering feature.

The new imports enable the toCoordinate() extension function for location-based filters.

Also applies to: 28-28


273-273: No action required. The lat and lng fields in ActivityLocation are non-nullable kotlin.Float types, and Float.toDouble() is a safe standard conversion that cannot throw runtime exceptions. The type safety of this conversion is guaranteed.

Likely an incorrect or invalid review comment.

stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/event/handler/OnNewActivityDefaultTest.kt (1)

51-51: LGTM! Field rename aligns with the updated public API.

The filter correctly uses ActivitiesFilterField.activityType instead of the previous type field, matching the API changes introduced in this PR.

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/query/ActivitiesQuery.kt (4)

21-22: LGTM! Imports support the new location-based filtering feature.

The new imports enable location-based filtering capabilities (BoundingBox, CircularRegion) and the necessary helper functions (toCoordinate, unsupportedLocalValue).

Also applies to: 27-28


91-97: Verify that local filtering is intentionally unsupported for the feed field.

The feed field uses unsupportedLocalValue as its local mapping, which means client-side filtering by feed ID won't work. Ensure this limitation is intentional and documented if it impacts the feature.


135-136: Verify the remote field name for the breaking change.

The field has been renamed from type to activityType with the remote name activity_type. Since this PR is marked as a breaking change, confirm that the backend API expects activity_type as the remote field name for activity filtering.


162-182: The location-based filters are correctly implemented. The remote field names ("near" and "within_bounds"), documented supported operators ("equal"), and expected data structures (CircularRegion/Map for near, BoundingBox/Map for withinBounds) all match backend API expectations.


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.

@gpunto gpunto marked this pull request as ready for review December 18, 2025 09:07
@sonarqubecloud
Copy link

@VelikovPetar VelikovPetar merged commit 321da2b into develop Dec 18, 2025
9 checks passed
@VelikovPetar VelikovPetar deleted the and-919/location-filtering branch December 18, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:breaking-change Breaking change pr:new-feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants