Synchronize Terminology Configuration from Backend on App Start
The TerminologySyncService is responsible for pulling the current organization's label configuration from the Supabase backend and storing it locally via the TerminologyCacheAdapter. This sync runs at app startup, after login, and periodically in the background. The TerminologyRepository abstracts the data layer, supporting both remote fetch and local cache reads. The Riverpod providers expose the resolved state reactively so that any screen depending on terminology automatically rebuilds when the configuration changes.
User Story
Acceptance Criteria
- Given I open the app with network connectivity, When the app initializes, Then the TerminologySyncService fetches the latest label configuration for my organization from Supabase
- Given a successful sync has completed, When the app is used offline afterward, Then the TerminologyCacheAdapter serves the previously fetched labels without any visible degradation
- Given the terminology configuration on the backend has changed since my last sync, When I open the app, Then the updated labels are fetched and the UI rebuilds to reflect the changes
- Given a sync fails due to network error, When I use the app, Then the previously cached terminology is used and no error is surfaced to the user
- Given I switch organizations (multi-org scenario), When I complete the org switch, Then the terminology sync immediately fetches the new organization's configuration and all labels update accordingly
Business Value
Organizations periodically revise their terminology as roles evolve and new volunteer categories are introduced. A reliable background sync ensures all users always operate with the most current labels, preventing confusion caused by outdated terminology, and allowing organizations to update their language without coordinating app release cycles.
Components
- Terminology Sync Service service
- Terminology Repository data
- Terminology Local Cache Adapter data
- Label Key Registry infrastructure
- Terminology Riverpod Providers infrastructure
- Organization Labels Notifier service
- Tenant Context Service service
- Supabase RLS Tenant Scope Configurator infrastructure