Build CoordinatorPauseRosterScreen mentor list
epic-peer-mentor-pause-management-core-workflows-task-009 — Implement the coordinator-facing pause roster screen that displays all assigned peer mentors with inline pause status and certification expiry data. Render mentors in a scrollable list using card widgets showing mentor name, PauseStatusIndicator, expected return date (if set), and certification expiry date. Support filtering by status (all / paused / active / expired_cert). Load data via PauseManagementService and handle empty states and loading indicators.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 4 - 323 tasks
Can start after Tier 3 completes
Implementation Notes
Use a dedicated RosterBloc with states: RosterLoading, RosterLoaded(mentors, activeFilter), RosterError. Store the full unfiltered mentor list in the BLoC state and apply filter as a derived getter to avoid unnecessary API calls on filter change. Use ListView.builder with a fixed itemExtent where possible for scroll performance. The mentor card should be a separate stateless widget to simplify testing and reuse on other coordinator screens.
Certification expiry date formatting should use the app's shared date formatting utility — do not inline DateFormat calls. Ensure the filter bar chips use the existing design token colour system for selected/unselected states.
Testing Requirements
Write widget tests using flutter_test covering: (1) list renders correct number of mentor cards from mocked service data, (2) each filter chip correctly filters the visible list, (3) empty state renders when filter returns no results, (4) loading indicator is shown while data is fetching, (5) error banner appears and retry re-calls the service, (6) pull-to-refresh triggers data reload. Write a golden test for the mentor card widget to catch visual regressions. Test role-based access by asserting the screen redirects non-coordinator users.
Concurrent status transitions (e.g., coordinator and automated scheduler both attempting to update the same mentor's status simultaneously) may produce race conditions or inconsistent state in the database, leading to audit log gaps or incorrect notifications.
Mitigation & Contingency
Mitigation: Implement all status transitions as atomic Postgres RPC functions with optimistic locking (version column or updated_at check). Use database-level constraints rather than application-level guards as the final enforcement point.
Contingency: Add a compensation job that reconciles status and log table consistency on each nightly scheduler run, surfacing any discrepancies to coordinator dashboards.
The coordinator-to-mentor assignment relationship may not always be 1:1 or may be stale (coordinator reassigned after a pause was set), causing notifications to be sent to the wrong coordinator or not sent at all.
Mitigation & Contingency
Mitigation: Query the assignment relationship at notification dispatch time rather than caching it at pause creation time. Add a fallback to notify the chapter administrator if no active coordinator assignment exists.
Contingency: Log all undeliverable notification attempts with the originating mentor ID so administrators can manually follow up, and surface undelivered notification counts on the coordinator dashboard.
The CoordinatorPauseRosterScreen may load slowly for coordinators managing large rosters with many concurrent certification expiry queries, degrading usability on low-bandwidth mobile connections.
Mitigation & Contingency
Mitigation: Use a single Supabase RPC that joins mentor status, certification expiry, and assignment data in one query rather than N+1 individual calls. Implement pagination with a configurable page size and skeleton loading states.
Contingency: Add an offline cache of the last-fetched roster state using Riverpod with SharedPreferences, ensuring coordinators can at minimum view stale data when connectivity is poor.