Implement label key listing with resolved values
epic-dynamic-terminology-and-labels-ui-and-accessibility-task-009 — Populate the TerminologyAdminPreviewScreen with a scrollable list of all label keys registered in the LabelKeyRegistry for the active organization. Each row must show the label key, its resolved value for the current organization, and the default fallback value side-by-side. Support search/filter functionality so coordinators can locate specific keys quickly when verifying their configuration.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 1 - 540 tasks
Can start after Tier 0 completes
Implementation Notes
Extract a LabelKeyListViewModel (or equivalent Riverpod derived provider) that combines LabelKeyRegistry enumeration with TerminologyRepository resolution into a flat List
The three-column row layout should use a Row with Expanded widgets; avoid Table widget for accessibility reasons. The default fallback column should use a de-emphasized text style (design token: text-tertiary equivalent) to visually separate it from the resolved value.
Testing Requirements
Write flutter_test widget tests for: (1) list renders correct number of rows from mock LabelKeyRegistry, (2) each row displays key/resolved/fallback correctly, (3) search filter reduces visible rows matching the query, (4) clearing search restores full list, (5) no-results state renders when filter matches nothing. Write a unit test for the view model projection function that converts raw LabelKeyRegistry + OrganizationLabelMap into ResolvedLabelRow list. Test with both empty map and fully populated map. Target 90%+ line coverage on filter logic.
WcagSemanticsLabelResolver's Semantics wrappers may conflict with Semantics nodes already defined by existing accessible widgets (e.g., accessible-bottom-navigation, activity-wizard-semantics), causing duplicate or contradictory screen reader announcements that fail WCAG 2.2 AA criteria.
Mitigation & Contingency
Mitigation: Audit all existing Semantics-annotated widgets in the accessibility feature before implementing WcagSemanticsLabelResolver. Define a clear hierarchy rule: WcagSemanticsLabelResolver always merges with, never replaces, existing Semantics nodes. Use Flutter's debugSemantics output in CI to detect conflicts automatically.
Contingency: If conflicts are discovered in testing, introduce a resolverMode parameter to WcagSemanticsLabelResolver allowing it to operate in 'override' or 'merge' mode per call site; coordinate with the Screen Reader Support feature team to align Semantics strategies.
If TerminologyAwareTextWidget subscribes to the full terminology map provider rather than the per-key labelProvider family, a single label update will trigger a full widget-tree rebuild across all screens simultaneously, causing jank on devices used by older peer mentors.
Mitigation & Contingency
Mitigation: Implement TerminologyAwareTextWidget using ref.watch(labelProvider(key)) on the per-key family provider from TerminologyRiverpodProviders so that only widgets bound to the changed key rebuild. Verify with Flutter DevTools 'rebuild tracking' in widget tests.
Contingency: If full-map subscriptions slip through code review, add a Riverpod lint rule that flags direct organizationLabelsNotifierProvider subscriptions inside widget build methods and enforces the per-key family pattern.
The TerminologyAdminPreviewScreen requires coordinator-level access, but if role checks rely solely on client-side guard logic without matching Supabase RLS policies, a peer mentor could potentially access the admin preview by manipulating navigation state.
Mitigation & Contingency
Mitigation: Protect the admin preview route with a server-validated role guard that re-fetches the user's role from Supabase on screen initialization, not just from local state. Add a Supabase RLS policy that restricts label map read access for the admin preview endpoint to coordinator and admin roles only.
Contingency: If unauthorized access is discovered in testing, immediately add a middleware role assertion that redirects non-coordinators to the no-access screen and logs the unauthorized navigation attempt for audit.