high priority low complexity frontend pending frontend specialist Tier 0

Acceptance Criteria

ExpectedReturnDatePicker is a stateless Flutter widget that accepts an onDateSelected callback (void Function(DateTime?)), an optional initialDate, and an optional labelText parameter.
Tapping the widget opens Flutter's showDatePicker with firstDate set to DateTime.now() (today, no past dates) and lastDate set to DateTime.now().add(const Duration(days: 365 * 2)).
Selected date is displayed in a human-readable locale-aware format (e.g., 'dd. MMMM yyyy' for Norwegian locale) in an AppTextField-styled read-only display field.
Widget applies design tokens for border color, label color, text style, and spacing — no hardcoded color or font values.
Clearing the date (via an optional clear icon) calls onDateSelected(null).
Semantics widget wraps the tap target with a descriptive label ('Select expected return date') and a value reflecting the currently selected date or 'Not set'.
Widget passes flutter_test golden tests for empty state, date-selected state, and focused/tapped state.
Widget works correctly under large font scale (up to 2.0x) without overflow or clipping.
No direct BLoC dependency inside the widget — it is purely presentational; the parent screen connects onDateSelected to the BLoC event.

Technical Requirements

frameworks
Flutter
BLoC (event consumption by parent)
flutter_localizations (for locale-aware date formatting)
apis
showDatePicker (Flutter material library)
performance requirements
Widget must rebuild only when its own state changes — use const constructor where possible.
Date picker dialog must open within one frame of the tap gesture.
security requirements
No date values are sent to any external API from within this widget — purely local UI state.
Input validation (no past dates) is enforced at the picker level (firstDate constraint), not just in display logic.
ui components
AppTextField (read-only display variant)
Flutter showDatePicker (material date picker dialog)
Clear icon button (optional, uses design token icon size)

Execution Context

Execution Tier
Tier 0

Tier 0 - 440 tasks

Implementation Notes

Use a GestureDetector or InkWell wrapping a read-only AppTextField — set the field's enabled: false and use a suffix icon for the calendar icon and optional clear icon. Do NOT use TextFormField's onTap for the date picker trigger as it has focus-related quirks on iOS; prefer a separate GestureDetector layer. Format the date using intl package's DateFormat('dd. MMMM yyyy', 'nb') to match the Norwegian locale used throughout the app.

Wrap the entire widget in Semantics with label and value properties — set excludeSemantics: true on child widgets to avoid duplicate announcements for screen readers (critical for Blindeforbundet users). Keep the widget stateless by requiring the parent to manage the selected date value — this aligns with the BLoC pattern used in the rest of the app. Export the widget from a barrel file in the shared widgets directory.

Testing Requirements

Write flutter_test widget tests covering: (1) widget renders with placeholder text when no date is selected, (2) tapping the field opens the date picker dialog, (3) selecting a valid date calls onDateSelected with correct DateTime, (4) past dates are not selectable (firstDate constraint verified), (5) tapping clear icon calls onDateSelected(null), (6) Semantics tree contains expected label and value strings, (7) widget renders without overflow at 2.0x font scale. Add golden tests for visual regression of empty and selected states. No integration or e2e tests required for this isolated widget.

Component
Expected Return Date Picker
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.