Skip to content

Settings: two saves at once lose an edit #817

Description

@harenome

Priority

P3

Components

app/nullius/settings.py (save, save_many)

Evidence

On main f9f076a11, settings.save_many reads settings.json, changes lines and rewrites the whole file with no lock (settings.py:622-664, _write_lines 534-543). The write is atomic, so the file is never half written, but two writers at once lose the edit that was read before the other's write.

Writers: the Settings page (web/settings.py:305,321,540,634) and nullius migrate --providers --apply (migrate.py:265). Two Settings requests to one server race the same way.

Other profile files written from both the page and the CLI already take a lock: leaderboard weights (leaderboard/weighting.py:103), access tokens (access.py:78).

Reproduction

  1. Pause one save_many after it reads settings.json.
  2. Save another setting through a second request.
  3. Resume the first.
  4. Read settings.json.

Expected

Both edits are kept.

Acceptance

  • save/save_many read, change and write settings.json under one lock, as weights and tokens do
  • Test with the forced ordering above

Dependencies and related

#770, #810

Activity

  1. added
    bug
    P3
    on Dec 3, 2026
  2. added theissue type on Dec 3, 2026
  3. self-assigned this
    on Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3bug

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions