Synced preferences: send base hash and handle SYNCED_PREFERENCES_CONFLICT #348

Open
opened 2026-11-12 18:59:20 +00:00 by charles · 0 comments
Owner

Found in the review of #312 (Text chat 14, finding 2).

The original client sends synced_preferences_base_hash (sha256 of the snapshot the write is built on) with every synced-preferences PATCH and, on SYNCED_PREFERENCES_CONFLICT, refetches the settings, merges and retries (UserSettings.ts:990-1060 in the fork). The native client writes without the hash, so a write from another client that lands between our last snapshot and our PATCH (about one gateway round trip) is overwritten last-writer-wins, non-picker fields included.

fluxer-proto (UserSettingsPatch.synced_preferences_base_hash) and fluxer-api (the conflict error) already support it. fluxer-core cannot hash without a new dependency, so the runtime or fluxer-api should compute the hash from the base snapshot, and the core should handle the conflict answer by adopting the refetched snapshot and re-applying its pending parts (the per-part merge from #312 already does that for a newer snapshot).

Seen on branch textchat-14-core-expressions.

Found in the review of #312 (Text chat 14, finding 2). The original client sends `synced_preferences_base_hash` (sha256 of the snapshot the write is built on) with every synced-preferences PATCH and, on `SYNCED_PREFERENCES_CONFLICT`, refetches the settings, merges and retries (`UserSettings.ts:990-1060` in the fork). The native client writes without the hash, so a write from another client that lands between our last snapshot and our PATCH (about one gateway round trip) is overwritten last-writer-wins, non-picker fields included. `fluxer-proto` (`UserSettingsPatch.synced_preferences_base_hash`) and `fluxer-api` (the conflict error) already support it. `fluxer-core` cannot hash without a new dependency, so the runtime or `fluxer-api` should compute the hash from the base snapshot, and the core should handle the conflict answer by adopting the refetched snapshot and re-applying its pending parts (the per-part merge from #312 already does that for a newer snapshot). Seen on branch textchat-14-core-expressions.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#348
No description provided.