User area: clients overwrite each other's settings (last writer wins) #332

Closed
opened 2026-10-24 22:21:28 +00:00 by littlefox · 2 comments
Owner

Interop audit, 2026-10-24.

The user area is last-writer-wins between clients, and a client can undo another's changes. The whole user area is one text, rewritten on every save.

  • NeoKOM (Kom::save_settings, kom.rs) writes the copy it read at login: our neokom block, plus the common block (Settings: read-depth-first, created-texts-are-read, presence-messages, language) and the elisp block (mute filters go into elisp's kom-filter-list when it has one). Anything changed elsewhere since login (in Emacs, or NeoKOM on another device) is lost on NeoKOM's next save. A save can be as small as following a thread or choosing a channel view.
  • Emacs client (lyskom-save-options, flags.el) keeps other clients' blocks, but from lyskom-other-clients-user-areas, read when its session started. "Spara inställningar" in Emacs writes back NeoKOM's block as it was then: followed threads, channel views and mute filters added since are lost.

Options:

  1. NeoKOM re-reads before writing (recommended; NeoKOM-side only). Fetch the current user area, apply only the change being made, write. It removes NeoKOM-caused losses; the Emacs side stays as it is.
  2. Don't write other clients' blocks: keep mute filters only in our block. Emacs then no longer applies them, but NeoKOM can't clobber Emacs's filters either.
  3. Accept last-writer-wins, and say so in Settings.
Interop audit, 2026-10-24. **The user area is last-writer-wins between clients, and a client can undo another's changes.** The whole user area is one text, rewritten on every save. - **NeoKOM** (`Kom::save_settings`, `kom.rs`) writes the copy it read at login: our `neokom` block, plus the `common` block (Settings: read-depth-first, created-texts-are-read, presence-messages, language) and the `elisp` block (mute filters go into elisp's `kom-filter-list` when it has one). Anything changed elsewhere since login (in Emacs, or NeoKOM on another device) is lost on NeoKOM's next save. A save can be as small as following a thread or choosing a channel view. - **Emacs client** (`lyskom-save-options`, `flags.el`) keeps other clients' blocks, but from `lyskom-other-clients-user-areas`, read when its session started. "Spara inställningar" in Emacs writes back NeoKOM's block as it was then: followed threads, channel views and mute filters added since are lost. Options: 1. **NeoKOM re-reads before writing** (recommended; NeoKOM-side only). Fetch the current user area, apply only the change being made, write. It removes NeoKOM-caused losses; the Emacs side stays as it is. 2. **Don't write other clients' blocks:** keep mute filters only in our block. Emacs then no longer applies them, but NeoKOM can't clobber Emacs's filters either. 3. Accept last-writer-wins, and say so in Settings.
Author
Owner

Do option 1. People switching clients is not very common, but when they do we should show good etiquette.

Do option 1. People switching clients is not very common, but when they do we should show good etiquette.
Author
Owner

Merged in #383; main run #725 green. Every settings change now re-reads the user area and applies only that change (Kom::update_settings); saves from one session take turns. Verified by the devserver test user_area_changes_meet: two NeoKOM sessions with stale copies plus an Emacs-style write of elisp/common in between, and all changes survive. All 33 devserver tests pass. settings, mute and lock specs pass on all profiles.

Merged in #383; main run #725 green. Every settings change now re-reads the user area and applies only that change (`Kom::update_settings`); saves from one session take turns. Verified by the devserver test `user_area_changes_meet`: two NeoKOM sessions with stale copies plus an Emacs-style write of `elisp`/`common` in between, and all changes survive. All 33 devserver tests pass. settings, mute and lock specs pass on all profiles.
Sign in to join this conversation.
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
littlefox/neokom#332
No description provided.