mirror of
https://github.com/games-on-whales/wolf.git
synced 2026-10-15 13:02:03 +00:00
[PR #492] fix(config): replace serialized state atomically #494
Labels
No labels
🧠 1 - 🤖 999
AMD
bug
bug
cannot reproduce
documentation
duplicate
easy
enhancement
enhancement
enhancement
fixed?
fixed?
good first issue
hard
help wanted
Intel
invalid
LXC
medium
moonlight-protocol
Multi GPU
nixos
not a bug
nvidia
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
games-on-whales/wolf#494
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/games-on-whales/wolf/pull/492
Author: @elibosley
Created: 8/29/2026
Status: 🔄 Open
Base:
beta← Head:fix/atomic-config-persistence📝 Commits (2)
4073febfix(config): replace serialized state atomically6b260a2style(config): apply clang-format📊 Changes
3 files changed (+347 additions, -40 deletions)
View changed files
📝
src/moonlight-server/state/configTOML.cpp(+166 -40)📝
tests/CMakeLists.txt(+1 -0)➕
tests/testConfigPersistence.cpp(+180 -0)📄 Description
Summary
Wolf config updates can leave stale TOML data or lose concurrent mutations; this serializes updates and publishes validated replacement files atomically.
Why This Exists
The current serializer writes to an existing destination without reliably truncating a longer previous document. When a config shrinks, stale array-table data can remain at the tail and make the next startup fail. Independent read-modify-write calls can also race and silently discard a pairing or profile update.
Resolution
Serialize each mutation under one process-local mutex, write to a unique sibling file, parse the completed file before publishing it, preserve permissions, retain a last-known-good copy, and replace the live config with one same-directory rename. Startup recovery is deliberately limited to the known stale-tail signature; unrelated malformed files still fail closed and remain untouched.
Reviewer Considerations
Behavior Changes
Pairing, unpairing, client-setting, and profile updates no longer expose partially written files or lose same-process concurrent mutations. A config damaged by the known stale-tail bug is restored from its last-known-good copy, or regenerated from defaults when no valid backup exists.
Implementation Summary
.last-goodsibling.Verification
[CONFIG]persistence and recovery suite passed in the Linux/amd64 Wolf image build.clang-format --dry-run --Werrorwith clang-format 21.1.8.Risk
Moderate; this changes persistence and recovery behavior, but each write is validated before publication and unrecognized corruption remains fail-closed.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.