critical priority low complexity infrastructure pending infrastructure specialist Tier 0

Acceptance Criteria

A single Dart file (e.g., org_selection_storage_keys.dart) exists containing all SharedPreferences keys for the Organization Selection feature
All keys follow the namespace convention 'org_selection.<key_name>' with no deviations
The file defines at minimum: org_selection.selected_org_id (String), org_selection.last_active_org_id (String), org_selection.onboarding_completed (bool)
All constants are declared as static const String within a sealed class or abstract final class to prevent instantiation
Dart doc comments on each constant describe: the stored value type, expected format (e.g., UUID string), and which service reads/writes it
No other feature's keys are defined in this file — scope is strictly Organization Selection
The file compiles without warnings under dart analyze with no lint suppressions
A corresponding test file verifies that all key strings are unique (no duplicate values) and follow the naming convention

Technical Requirements

frameworks
Flutter
shared_preferences
data models
Organization
UserOrganizationContext
performance requirements
Constants are compile-time values (const) — zero runtime cost
security requirements
Key names must not contain personally identifiable information — keys are visible in device storage inspection tools
Do not store sensitive values (tokens, passwords) using SharedPreferences keys defined here — document this constraint in a file-level comment

Execution Context

Execution Tier
Tier 0

Tier 0 - 440 tasks

Implementation Notes

Use an abstract final class (Dart 3+) or a class with a private constructor to hold the constants — this prevents accidental instantiation. Example pattern: `abstract final class OrgSelectionStorageKeys { static const String selectedOrgId = 'org_selection.selected_org_id'; }`. Align the namespace prefix with whatever convention is already used elsewhere in the codebase — check existing SharedPreferences usage before deciding on 'org_selection' as the prefix. If the codebase uses a different separator (underscore vs dot), match it.

Keep this file minimal: its only job is key definitions. Do not put serialization logic, default values, or adapter code here — those belong in the LocalStorageAdapter (task-002). The file-level doc comment should list all keys in a table for quick reference.

Testing Requirements

Write a single unit test file that: (1) collects all static const String values from the constants class using reflection or a manually maintained list; (2) asserts that every value starts with 'org_selection.'; (3) asserts that no two constants share the same string value (uniqueness check). This test acts as a regression guard — if a developer adds a key that violates the naming convention or duplicates an existing key, CI fails immediately.

Component
Local Storage Adapter
infrastructure low
Epic Risks (2)
medium impact medium prob technical

SharedPreferences behaves differently on iOS (NSUserDefaults) vs Android (SharedPreferences) for edge cases such as first-launch cold reads, storage quota exceeded, or process kill mid-write. If the adapter does not account for these differences, the persistence layer can silently return null on one platform while returning a stale value on the other, causing incorrect routing decisions downstream.

Mitigation & Contingency

Mitigation: Write platform-specific integration tests using flutter_test device runners for both iOS and Android. Document known platform delta in the adapter's inline comments and encode defensive fallback for null returns at the repository boundary.

Contingency: If platform delta causes persistent issues, replace SharedPreferences with flutter_secure_storage for this key — the LocalStorageAdapter abstraction makes this a single-file swap with no impact on the repository or service layer.

high impact low prob dependency

The shared_preferences Flutter plugin may have a version conflict with other plugins already in the project pubspec.yaml. A conflict discovered late in the epic blocks all downstream epics.

Mitigation & Contingency

Mitigation: Resolve and pin the shared_preferences version in pubspec.yaml as the very first task of this epic before writing any implementation code. Run flutter pub get and resolve any version conflicts immediately.

Contingency: If version pinning is impossible due to transitive conflicts, implement LocalStorageAdapter using path_provider + dart:io for JSON file storage as an alternative — the interface contract remains unchanged.