Repository navigation
ProviderContract.Filter > shared filter params - #337
Conversation
|
/gemini review |
Qodana for JVMIt seems all right 👌 No new problems were found according to the checks applied ☁️ View the detailed Qodana report Contact Qodana teamContact us at [email protected]
|
There was a problem hiding this comment.
Code Review
This pull request refactors the data loading mechanism by introducing DataSourceRequestManager to handle service updates, status, and news retrieval, replacing direct calls to DataSourceManager and removing Context and KeysManager dependencies from ServiceUpdateLoader and StatusLoader. It also updates several news-related filter methods and properties to use explicit UUID terminology. The review feedback highlights critical race conditions in DataSourceRequestManager.kt where shared filter instances (serviceUpdateFilter, statusFilter, and newsFilter) are mutated concurrently using apply { appendProvidedKeys(...) } during parallel execution, which could lead to ConcurrentModificationException or corrupted API keys.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors data loading and request management across several managers and loaders, migrating direct DataSourceManager calls to DataSourceRequestManager and updating news filter methods to use UUID-based naming. The review feedback highlights critical thread-safety issues in DataSourceRequestManager.kt, where mutating shared filter instances (serviceUpdateFilter, statusFilter, and newsFilter) concurrently across multiple threads can cause race conditions and overwrite provider-specific keys. It is highly recommended to clone or copy these filters before applying provider-specific keys. Additionally, a minor style improvement was suggested in NewsRepository.kt to consistently use Kotlin property syntax instead of Java setter methods.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Code Review
This pull request refactors the data source querying mechanism by serializing filter objects (such as service updates, news, status, and vehicle locations) into JSON strings before passing them to DataSourceManager. It also centralizes the injection of provider keys into these filters within DataSourceRequestManager. The review feedback highlights several critical thread-safety issues where shared filter objects are mutated concurrently across background threads when setting provider keys. To prevent race conditions and concurrent modification exceptions, it is recommended to clone the filter instances before mutating and serializing them.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the data source, status, and news filtering mechanisms across the application. Key changes include migrating filter builders to use Kotlin-friendly copy/factory methods, replacing direct DataSourceManager calls in loaders with DataSourceRequestManager, converting Java-style getters to Kotlin properties in PlaceProvider, and cleaning up imports and variable declarations. A critical issue was identified in POIManager.java where the refactored getFilter method incorrectly passes the POI's UUID instead of the package name (getPkg()) for Module instances, which would break package installation checks.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the data loading and provider layers to streamline filter creation, leverage Kotlin properties, and migrate context-heavy operations to DataSourceRequestManager. Key changes include replacing manual filter configurations with factory methods, updating ServiceUpdateLoader and StatusLoader to use DataSourceRequestManager instead of direct Context and KeysManager dependencies, and standardizing on Kotlin's copy method for data classes. Feedback is provided regarding PlaceProvider.kt, where omitting explicit types for overridden members returning null can lead to implicit Nothing? type inference, potentially causing compilation or signature issues.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
Aligns the app’s provider-contract filter usage with the updated “shared filter params” API (per commons-android PR #164), shifting call sites toward immutable copy(...)/factory helpers and centralizing “provided keys” attachment in DataSourceRequestManager.
Changes:
- Migrates multiple
*ProviderContract.Filterusages from mutable setters/apply { ... }tocopy(...)and newfrom(...)/new*Filter(...)helpers. - Routes status/service-update fetching through
DataSourceRequestManager(incl. new sync methods) so provided-encryption keys are attached in one place. - Updates
PlaceProvider.getTextSearchRequestto acceptIterable<String?>?and adjusts tests accordingly.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| app-android/src/test/java/org/mtransit/android/provider/PlaceProviderTest.java | Updates tests for Iterable search keywords input. |
| app-android/src/main/java/org/mtransit/android/ui/schedule/ScheduleViewModel.kt | Switches to poim.getFilter(...) and updated findStatus signature. |
| app-android/src/main/java/org/mtransit/android/ui/rds/route/direction/RDSDirectionStopsViewModel.kt | Uses immutable filter copy(inFocus = true) for vehicle locations. |
| app-android/src/main/java/org/mtransit/android/ui/poi/POIViewModel.kt | Adjusts commented import to new ScheduleStatusFilter type name/location. |
| app-android/src/main/java/org/mtransit/android/ui/news/NewsListViewModel.kt | Renames news filter params to UUID-specific names. |
| app-android/src/main/java/org/mtransit/android/ui/fragment/POIViewModel.kt | Uses immutable filter copy(inFocus = true) for vehicle locations. |
| app-android/src/main/java/org/mtransit/android/ui/fragment/POIFragment.java | Updates schedule filter import + news target UUID helper usage. |
| app-android/src/main/java/org/mtransit/android/task/StatusLoader.java | Fetches status via DataSourceRequestManager (keys added there). |
| app-android/src/main/java/org/mtransit/android/task/ServiceUpdateLoader.java | Fetches service updates via DataSourceRequestManager (keys added there). |
| app-android/src/main/java/org/mtransit/android/provider/PlaceProvider.kt | Migrates to property-based overrides + Iterable keywords + contract projection constant. |
| app-android/src/main/java/org/mtransit/android/provider/ModuleProvider.java | Updates provider-contract APIs (projection/validity/status filter type). |
| app-android/src/main/java/org/mtransit/android/datasource/NewsRepository.kt | Renames filter params + uses immutable filter copy(...) for cacheOnly/inFocus, etc. |
| app-android/src/main/java/org/mtransit/android/datasource/DataSourceRequestManager.kt | Centralizes “provided keys” injection; adds service-update/status sync helpers. |
| app-android/src/main/java/org/mtransit/android/data/RouteManager.kt | Uses immutable service-update filter copy(inFocus = ...). |
| app-android/src/main/java/org/mtransit/android/data/RouteDirectionManager.kt | Uses immutable service-update filter copy(inFocus = ...). |
| app-android/src/main/java/org/mtransit/android/data/POIManager.java | Builds filters via StatusProviderContract.Filter.from(...) and ServiceUpdateProviderContract.Filter.from(...). |
| app-android/src/main/java/org/mtransit/android/data/DataSourceManager.java | Minor readability tweaks; makes internal query helper private. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the data source filtering and loading mechanisms across the application. Key changes include migrating from mutable filter builders to immutable Kotlin data class copies (.copy()), introducing new factory methods for NewsProviderContract.Filter, and decoupling ServiceUpdateLoader and StatusLoader from Android Context by delegating fetching operations to DataSourceRequestManager. Additionally, several getter methods in PlaceProvider and ModuleProvider have been converted to properties or renamed for consistency, and PlaceProvider now accepts Iterable instead of Array for search keywords. There are no review comments provided, and I have no additional feedback to offer on these changes.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
ProviderContract.Filter> shared filter params commons-android#164