Own presence: a settings patch answer for another module drops the pending status write #569

Open
opened 2026-11-14 19:57:40 +00:00 by charles · 0 comments
Owner

Follow-up from the review of PR #566 (Task 14, #499).

ApiResult::UserSettingsPatched carries no request id, so presence::reduce_own drops the oldest pending status write on any patch answer, including the answers to the PATCH /users/@me/settings sent by chat::expressions (synced preferences) and chat::settings (synced display settings). A stale answer can then show the old status for a moment and send an extra op 3 for it before the status write's own answer lands. It converges.

Not fixed in #566: matching answers to writes by content would leave a write pending forever whenever the server normalises a value (timestamp precision, custom status text or emoji), which is worse than the flap.

Proposed fix: let the runtime say which request an answer is for (for example CoreEvent::Api carrying the EffectId, or an ApiResult::UserSettingsPatched { id, settings }), so each reducer clears only its own pending write. This touches fluxer-core (event type and every ApiResult consumer) and apps/fluxer (runtime), so it is its own task.

Steps to reproduce (core test): set a status (DND), then before its answer, deliver a UserSettingsPatched with the old settings (as an expressions write's answer would be): app.presence.me.chosen goes back to online and an op 3 for online is sent; the status write's answer then brings DND back.

Seen on branch dailyuse-14-core-status-idle-presence (88b2d2c).

Follow-up from the review of PR #566 (Task 14, #499). `ApiResult::UserSettingsPatched` carries no request id, so `presence::reduce_own` drops the oldest pending status write on any patch answer, including the answers to the `PATCH /users/@me/settings` sent by `chat::expressions` (synced preferences) and `chat::settings` (synced display settings). A stale answer can then show the old status for a moment and send an extra op 3 for it before the status write's own answer lands. It converges. Not fixed in #566: matching answers to writes by content would leave a write pending forever whenever the server normalises a value (timestamp precision, custom status text or emoji), which is worse than the flap. Proposed fix: let the runtime say which request an answer is for (for example `CoreEvent::Api` carrying the `EffectId`, or an `ApiResult::UserSettingsPatched { id, settings }`), so each reducer clears only its own pending write. This touches `fluxer-core` (event type and every `ApiResult` consumer) and `apps/fluxer` (runtime), so it is its own task. Steps to reproduce (core test): set a status (DND), then before its answer, deliver a `UserSettingsPatched` with the old settings (as an expressions write's answer would be): `app.presence.me.chosen` goes back to online and an op 3 for online is sent; the status write's answer then brings DND back. Seen on branch `dailyuse-14-core-status-idle-presence` (88b2d2c).
charles added this to the Daily use milestone 2026-11-14 19:57:40 +00:00
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#569
No description provided.