Skip to content

feat: add section filtering to view options - #806

Merged
leynier merged 8 commits into
mainfrom
feat/filter-by-sections-in-view-options
Sep 17, 2026
Merged

leynier merged 8 commits into
mainfrom
feat/filter-by-sections-in-view-options

Conversation

@leynier

@leynier leynier commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Summary

Adds workspace section filtering to View Options alongside Projects and Tags.

  • Adds selectedSectionIds to WorkbenchViewPrefs and persists it across sessions.
  • Adds section filter helpers in workbench_workspace_filters.dart with positive OR semantics.
  • Updates sidebar listing and collapse targets to respect section filters.
  • Adds _SectionsFilterSection in workbench_view_options_sections.dart for searching, picking, and clearing section filters.
  • Shows the section filter block conditionally when sections are supported by the runtime.

Validation

  • build_runner build --build-filter: regenerated workbench_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 selectedSectionIds is empty or sections are unsupported, previous behavior is preserved.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 selectedSectionIds to WorkbenchViewPrefs with 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 when supportsSections.
  • 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`.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using Grok | 𝕏

Comment thread lib/src/features/workbench/infra/runtime_workbench_view_prefs_repository.dart Outdated

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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_ids to SharedWorkbenchViewPrefs with serde defaults, host backfill, and a desktop merge that keeps the local set when an older host omits the key.
  • Mobile parity. MobileViewPrefs round-trips selectedSectionIds, listing applies the same empty-means-all OR filter, and View Options shows a Sections picker when sections are supported.

Pullfrog  | View workflow run | Using Grok | 𝕏

@leynier
leynier merged commit 91b7b01 into main Sep 17, 2026
23 checks passed
@leynier
leynier deleted the feat/filter-by-sections-in-view-options branch September 17, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant