medium priority low complexity testing pending testing specialist Tier 1

Acceptance Criteria

ExpectedReturnDatePicker renders a date selection UI; test verifies initial value is null when no date passed
ExpectedReturnDatePicker onDateSelected callback fires with the correct DateTime when user selects a date in the test
ExpectedReturnDatePicker rejects dates in the past — verify date picker either disables past dates or shows validation error
ExpectedReturnDatePicker boundary test: selecting today's date is accepted; selecting yesterday is rejected
CertificationExpiryWarningBanner renders the warning message when expiry date is within 30 days
CertificationExpiryWarningBanner does not render (returns SizedBox.shrink or is absent from tree) when expiry is more than 30 days away
CertificationExpiryWarningBanner renders an expired variant when expiry date is in the past
CertificationExpiryWarningBanner with null expiry date renders a 'no certification on file' fallback, not a crash
PauseStatusIndicator renders correct icon and label for active, paused, and suspended states (covered in task-011 tests — this task extends to color token assertions)
PauseStatusIndicator design token color test: the rendered color of the status chip matches the expected token value resolved from the test theme
All three widgets have Semantics nodes with correct labels verified via tester.getSemantics()
All widget tests pass with flutter test with zero flaky failures across 3 runs

Technical Requirements

frameworks
Flutter
flutter_test
data models
PeerMentorStatus
CertificationStatus
DateTime
performance requirements
Full widget test suite for these three widgets must complete in under 15 seconds
ui components
ExpectedReturnDatePicker
CertificationExpiryWarningBanner
PauseStatusIndicator

Execution Context

Execution Tier
Tier 1

Tier 1 - 540 tasks

Can start after Tier 0 completes

Implementation Notes

Structure test files as: test/features/peer_mentor/widgets/expected_return_date_picker_test.dart, certification_expiry_warning_banner_test.dart, pause_status_indicator_test.dart. For CertificationExpiryWarningBanner null expiry test, ensure the widget implementation guards against null before computing days until expiry — the test will expose any unguarded null dereference. For date boundary tests, inject a clock abstraction (or use a testable 'now' parameter) so tests don't depend on the system clock — this prevents flakiness. For color token tests, avoid asserting against hardcoded hex values; instead resolve via Theme.of(context).appColors in both the widget and the test to keep tests resilient to token value changes.

Testing Requirements

All tests use flutter_test's WidgetTester. Wrap widgets in a MaterialApp with the app's ThemeData to correctly resolve design tokens. For date picker tests, use tester.tap + tester.pump sequence or provide a testable date-selection callback. For color token assertions, resolve the expected color from the theme in the test and compare against the rendered widget's decoration or icon color using tester.widget(find.byType(Icon)).color.

For semantics tests, use tester.getSemantics(find.byType(WidgetType)) and assert label contains the expected string. Organize tests into three describe groups, one per widget. Aim for ≥95% line coverage across the three widget files.

Component
Pause Status Indicator
ui low
Epic Risks (3)
high impact medium prob security

Supabase RLS policies for coordinator-scoped status queries may be difficult to express correctly, especially for peer mentors assigned to multiple coordinators or chapters, leading to data leakage or overly restrictive access blocking valid queries.

Mitigation & Contingency

Mitigation: Design RLS policies using security-definer RPCs rather than table-level policies for complex multi-coordinator scenarios. Write a comprehensive RLS test matrix covering all role and assignment permutations before marking complete.

Contingency: Fall back to application-level filtering in the repository layer with explicit coordinator_id parameter checks if RLS proves intractable, and document the trade-off for security review.

high impact medium prob dependency

The HLF Dynamics portal API contract may be undocumented or subject to change, causing the DynamicsPortalClient to break during development or production rollout.

Mitigation & Contingency

Mitigation: Obtain the full Dynamics portal API specification and credentials early in the sprint. Build the client behind a well-defined interface so the HLF-specific implementation can be swapped without affecting upstream services.

Contingency: If the Dynamics API is unavailable or unstable, stub the client with a feature-flag-guarded no-op implementation so all other epics can proceed to completion independently.

medium impact low prob technical

Supabase Edge Functions used as the nightly scheduler host may have cold-start latency or execution time limits that prevent reliable nightly certification checks on large mentor rosters.

Mitigation & Contingency

Mitigation: Benchmark Edge Function execution time against the expected roster size. Design the expiry check to process in paginated batches to stay within execution limits. Use pg_cron with a direct database function as an alternative trigger if Edge Functions prove unreliable.

Contingency: Migrate the scheduler trigger to pg_cron invoking a Postgres function directly, removing the Edge Function dependency entirely for the scheduling layer.