store: one admin's settings change no longer overwrites another's !231

merged merged by cmc on 2026-09-04 15:58 UTC · krz/gitbay:settings-json-set into main

Discussion

cmc

Stacked on !230.

Every repo settings * command read the whole settings_json blob off a Repo loaded earlier, changed one field and wrote it all back. A test against that path loses an update in 39 of 40 races.

UpdateRepoSettings(repoID, func(*RepoSettings)) does the read and the write itself inside one transaction, with BEGIN IMMEDIATE so a second updater waits at the start instead of reading a stale blob.

json_set, the issue's other suggestion, cannot express turning a flag off — the JSON tags are omitempty, so false is an absent key and a merge patch built from the struct is empty exactly when the change is "set this to its zero value".

Note: SetForkOf, which #123 names alongside this, has no callers at all — #108's CreateFork replaced it. I left it rather than folding an unrelated deletion into this.

Closes #123

retargeted from dashboard-indexes to main: !230 merged

2026-09-04 15:58 UTC