feat(llc, core, persistence): Add support for PredefinedFilters on QueryChannels(v9)#2775
feat(llc, core, persistence): Add support for PredefinedFilters on QueryChannels(v9)#2775VelikovPetar wants to merge 2 commits into
PredefinedFilters on QueryChannels(v9)#2775Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## v9 #2775 +/- ##
=====================================
Coverage ? 66.30%
=====================================
Files ? 429
Lines ? 27096
Branches ? 0
=====================================
Hits ? 17965
Misses ? 9131
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Submit a pull request
Linear: FLU-357
CLA
Description of the pull request
v9 back-port of #2709. Adds support for server-defined predefined filters on
queryChannelsacross the LLC, persistence, and core layers.A predefined filter is a named filter/sort preset that lives on the server. The client sends
predefined_filter(plus optionalfilter_values/sort_valuesto interpolate placeholders) instead of an inline filter, and the server echoes back the materializedfilterandsortit applied.stream_chat(LLC)ChannelApi.queryChannelsandStreamChatClient.queryChannelsacceptpredefinedFilter,filterValues,sortValues.StreamChatClient.queryChannelsWithResultreturns aQueryChannelsResultexposing both the live channels and the server-resolvedPredefinedFilter(name + materialized filter + sort).PredefinedFiltermodel andpredefined_filterfield onQueryChannelsResponse.ChatPersistenceClient.queryChannelStatesandChatPersistenceClient.saveChannelQueriesas the unified read/write methods for channel-query persistence (both accept standard and predefined-filter parameters and internally dispatch). Default implementations route through the legacy methods so existing custom persistence clients keep compiling.ChatPersistenceClient.getChannelStatesandChatPersistenceClient.updateChannelQueriesin favor of the unified methods. The deprecated methods stay overridable so downstream subclasses keep working unchanged.stream_chat_persistencechannel_query_metadatatable that stores the server-resolvedfilter+sortkeyed by the predefined-filter query hash, so offline reads reconstruct the exact resolved spec the server applied. Drift schema version bumped 29 → 30.FilterConverterandChannelStateSortOrderConverterDrift converters.StreamChatPersistenceClientoverrides the newqueryChannelStates/saveChannelQueriesmethods;ChannelQueryDaogainsupdateChannelQueriesByPredefinedFilterandgetChannelsAndSpecByPredefinedFilter.stream_chat_flutter_coreStreamChannelListControlleracceptspredefinedFilter,filterValues,sortValues. When set, they take precedence overfilter/channelStateSort._resolvedChannelStateSortthat is overwritten with the server-resolved sort on every successful query, so event-driven inserts keep matching the server's ordering even when the caller only specifies apredefinedFilter.Sample app
ChannelListnow uses thestream_chat_flutter_sample_app_v9predefined filter (interpolated with the currentuser_id) to demonstrate the flow end-to-end.How to test
Test coverage
predefined_filter_test.dart— model +effectiveSortfallback selection.client_test.dart— online/offlinequeryChannelspaths andqueryChannelsWithResult. ExistinggetChannelStates/updateChannelQueriesverifications updated to target the newqueryChannelStates/saveChannelQueriesmethods.channel_api_test.dart— request payload assertions forpredefined_filter/filter_values/sort_values.filter_converter_test.dart/sort_order_converter_test.dart— Drift converters.channel_query_dao_test.dart— DAO read/write of cids + metadata.stream_chat_persistence_client_test.dart— persistence client integration for both standard and predefined-filter modes ofqueryChannelStates/saveChannelQueries.stream_channel_list_controller_test.dart— controller path including resolved-sort tracking.