Repository navigation
feat: add section filtering to view options - #806
Conversation
There was a problem hiding this comment.
Important
Section filters never reach the runtime store, so the selection is cleared on the next shared-prefs echo.
Reviewed changes
This PR adds workspace section filtering to desktop View Options, matching the existing project and tag filters.
- View prefs field. Adds
selectedSectionIdstoWorkbenchViewPrefswith mapper defaults so older local JSON still decodes. - Listing. Sidebar visibility and empty-project hiding honor the section filter with empty-means-all OR semantics.
- Controller. Add, remove, clear, and toggle helpers, plus in-memory pruning of stale ids when the sections snapshot updates.
- View Options UI. New
_SectionsFilterSection(cloned from the tags picker) shown whensupportsSections. - Tests. Listing, prefs round-trip, and widget coverage for pick, search, remove, and clear.
⚠️ Mobile listing and view options never learned the new filter
Desktop now writes selectedSectionIds into shared view prefs. Mobile MobileViewPrefs does not parse or emit that key, _matchesFilters does not apply it, and the view-options sheet has no Sections picker. After the runtime field exists, a phone that saves any other view option would store the serde default (empty) unless the key is backfilled, and the phone would keep showing workspaces the desktop hid.
Technical details
# Mobile section filter parity
## Affected sites
- `mobile/lib/src/features/workbench/domain/mobile_view_prefs.dart` — `fromJson` / `toJson` / `copyWith` omit `selectedSectionIds`
- `mobile/lib/src/features/workbench/application/mobile_workspace_rows.dart` (`_matchesFilters`) — filters by project and tag only; `WorkspaceSummary.sectionId` is already on the row
- `mobile/lib/src/features/workbench/presentation/workspace_view_options_sheet.dart` — Projects and Tags pickers, no Sections block
- `mobile/lib/src/features/workbench/application/mobile_view_prefs_controller.dart` — no setter equivalent to `setTagFilter`
- `rust/alera-cli/src/terminal_host/server/workspace_sidebar_requests.rs` (`BACKFILLED_SHARED_PREF_KEYS`) — older phones that omit the new key would still wipe stored ids without backfill
## Required outcome
- Mobile round-trips `selectedSectionIds` on the shared prefs wire.
- Mobile listing hides workspaces the same way desktop does (empty set shows all; otherwise `sectionId` must be selected; unassigned workspaces hidden).
- View Options exposes a Sections picker when `supportsSections`, parallel to Projects and Tags.
- Older mobile clients that omit the key must not reset a desktop-set filter.
## Suggested approach
Mirror the tag filter: field + JSON, `_matchesFilters` check, checkbox (or equivalent) list gated on `data.supportsSections`, and add `selectedSectionIds` to `BACKFILLED_SHARED_PREF_KEYS`.Grok | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Changes since the prior review persist the section filter through the runtime store and give mobile the same listing and View Options behavior.
- Runtime store. Added
selected_section_idstoSharedWorkbenchViewPrefswith serde defaults, host backfill, and a desktop merge that keeps the local set when an older host omits the key. - Mobile parity.
MobileViewPrefsround-tripsselectedSectionIds, listing applies the same empty-means-all OR filter, and View Options shows a Sections picker when sections are supported.
Grok | 𝕏

Summary
Adds workspace section filtering to View Options alongside Projects and Tags.
selectedSectionIdstoWorkbenchViewPrefsand persists it across sessions.workbench_workspace_filters.dartwith positive OR semantics._SectionsFilterSectioninworkbench_view_options_sections.dartfor searching, picking, and clearing section filters.Validation
build_runner build --build-filter: regeneratedworkbench_view_prefs.mapper.dart.flutter analyze: 0 issues found.flutter test test/widget/workbench_view_options_menu_test.dart test/unit/workbench_view_prefs_test.dart test/unit/workbench_section_listing_test.dart test/unit/runtime_workbench_view_prefs_repository_test.dart test/unit/drift_workbench_view_prefs_repository_test.dart: all 42 tests passed.flutter test test/unit/workbench_controller_test.dart: all 187 tests passed.Risks
None identified. When
selectedSectionIdsis empty or sections are unsupported, previous behavior is preserved.