You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(settings): prevent refresh from overwriting migrated or pending values #151
Current main copies legacy and renamed settings into DataStore, but it does not establish those recovered values on the server before a canonical refresh applies effective values:
migrateRenamedKeys copies the renamed slots locally only: AndroidPlayerSettingsStore.kt:154-167
refreshFromServer immediately reads effective values without coordinating with pending writes: AndroidPlayerSettingsStore.kt:530-538
applyEffectiveLocally then writes returned contract defaults over local slots: AndroidPlayerSettingsStore.kt:610-627
The deterministic upgrade case is a pre-rename player.next_up_prompt_seconds value when the server has no canonical override: migration copies it, the effective GET returns the default 30, and the refresh overwrites the recovered value. The same ordering problem applies to legacy-cache imports and to a recent local edit still behind the flusher debounce.
PR #101 identified and tested this race, but its implementation targets the pre-#119 settings architecture and must not be cherry-picked as-is.
Expected behavior
Recovered values for canonical remote keys are enqueued with the correct type and server origin.
Renamed keys cover both current entries in PlaybackSettingsKeys.RenamedLocalKeys.
Granular local subtitle fields are not sent as unknown canonical keys; preserve the composite projection behavior.
A refresh cannot overwrite a newer pending/retryable local operation with an older server value or a contract default.
Transient flush failures do not silently discard or overwrite the local value.
Reset flows still intentionally hydrate contract defaults after successful deletes.
Tests cover the production scoped-key prefix, rename migration, legacy-cache import, pending-write ordering, and failure behavior.
Activity