TF-4645 SSOT Part 4 — Migrate mobile search to the central executor#4686
TF-4645 SSOT Part 4 — Migrate mobile search to the central executor#4686dab246 wants to merge 4 commits into
Conversation
…tor and searchFilterProvider SSOT
…fresh + filter updates
…Provider directly and drop dead getters/view-state handlers
WalkthroughThis PR migrates mobile email search from GetX-owned filter mirrors and direct interactor calls to Riverpod-backed committed filter state and executor intents. Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/features/search/email/presentation/search_email_controller.dart`:
- Around line 749-751: The doc comment on searchEmailController’s filter routing
is stale because it still references the removed GetX mirror and onInit syncing
back to `.obs` fields. Update the comment near the searchFilterProvider-related
getter/method to describe the current flow only: the view reads directly from
`searchFilterProvider` and there is no mirror or back-sync through GetX state
anymore.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9875c516-1bc3-42f2-ba15-72231de34249
📒 Files selected for processing (7)
integration_test/scenarios/search/search_email_sort_order_date_filter_not_leak_scenario.dartintegration_test/tests/search/search_email_sort_order_date_filter_not_leak_test.dartlib/features/search/email/presentation/riverpod_widgets/clear_search_filter_button.dartlib/features/search/email/presentation/search_email_bindings.dartlib/features/search/email/presentation/search_email_controller.dartlib/features/search/email/presentation/search_email_view.darttest/features/search/email/presentation/search_email_controller_test.dart
💤 Files with no reviewable changes (3)
- integration_test/tests/search/search_email_sort_order_date_filter_not_leak_test.dart
- integration_test/scenarios/search/search_email_sort_order_date_filter_not_leak_scenario.dart
- lib/features/search/email/presentation/search_email_bindings.dart
|
This PR has been deployed to https://linagora.github.io/tmail-flutter/4686. |
…terProvider, no GetX mirror
There was a problem hiding this comment.
Code Health Improved
(2 files improve in Code Health)
Our agent can fix these. Install it.
Gates Passed
3 Quality Gates Passed
View Improvements
| File | Code Health Impact | Categories Improved |
|---|---|---|
| search_email_controller.dart | 8.62 → 8.82 | Complex Method |
| search_email_view.dart | 8.81 → 9.23 | Large Method |
Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
|
Docker image published for this PR: linagora/tmail-web-pr:4686 |
Closes #4645
What
Mobile search (
SearchEmailController) now delegates execution to the centralSearchEmailNotifier(searchEmailProvider) and reads its filter directly from the committed SSOT (searchFilterProvider) — no local filter copy. New search, load-more and the websocket refresh all run through the executor; pagination cursors leave the controller entirely.Why
SearchEmailControllerowned its ownsearchEmailFilter.obsand ran interactors inline, duplicating the cursor branching that also lived inThreadController. Delegating to the executor removes that duplication so pagination rules live only in its strategies..obscopy had to be written on every edit and could diverge from the filter.Behaviour changes to flag
_searchEmailByQueryString/clearAllSearchFilterAppliedreset the receive-time/sort display to defaults while leaving the filter untouched — a divergence the single-source refactor removes.combine-merging it.Mobile search flow
Tests
search_email_controller_test(9 cases): new search delegates to the executor and bridges the first page; load-more delegatesLoadMoreIntentwith thelastEmailIdanchor and appends; new-search failure clears the list and surfacesLeft; load-more failure keeps the current page and completessearchMoreState; controller filter getters read the committedsearchFilterProvider(single source);clearAllResultSearchresets the committed filter vianotifier.set; a websocket message drivesRefreshChangesIntentand replaces the rendered list; a websocket refresh failure keeps the rendered list (non-destructive);updateSimpleSearchFilterroutes receive-time + date-range edits tosearchFilterProvider. Executor pagination/cursor rules stay covered bysearch_email_notifier_testandsearch_pagination_strategy_test.dart analyzeclean.search_email_sort_order_date_filter_not_leakscenario + runner are removed. They set up the leak by injecting cursors into the SSOT through the controller — the exact path this refactor deletes — so the check is no longer expressible and its assertions would be vacuous. The invariant it guarded (cursors never leak into the next query) is now structural and directly unit-tested:search_pagination_strategy_test("stale cursors on the committed filter are never carried into a request"),search_email_notifier_test("NewSearchIntent clears load-more cursors regardless of prior SSOT values"),search_filter_notifier_test("set strips pagination cursors").Summary by CodeRabbit