Skip to content

fix(native): prevent root topology changes during admitted writers - #16

Open
Seagulls wants to merge 45 commits into
dev-publicfrom
fix/upstream-root-topology
Open

Seagulls wants to merge 45 commits into
dev-publicfrom
fix/upstream-root-topology

Conversation

@Seagulls

@Seagulls Seagulls commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Fixes #13.

Ordinary root removal could acknowledge a mapping change while an already-admitted native writer still held the old filesystem path. A separate OpenSave CLI process could also bypass the daemon's admission when its published address file was absent.

This change makes those topology transitions refuse while the native writer is active, without deleting root files or introducing a new transfer mode.

Contract

Scenario Required behaviour
RemoveRoot while native work owns the game's path Return HTTP 409; preserve the mapping and physical files
Add/remap while native writer or queued work can still use the old path Reject the competing topology edit; retain queued work
Independent CLI locations add/remove or primary-path change Respect the running daemon; no direct-SQLite bypass if daemon.addr is missing
Writer finishes and the user retries root removal Succeed normally, leaving on-disk files untouched
Unrelated games Continue ordinary sync and root operations

Review map

  • internal/p2p/syncengine/settle.go and engine.go: nonblocking per-game topology reservation and native reader/writer/queue admission.
  • internal/api/routes_roots.go, routes.go: hold that admission through the Store mutation and subsequent watcher notifications.
  • internal/daemon/daemon.go, registry_setup.go: reserve other native topology-changing producer paths.
  • internal/api/server.go, internal/cliapp/client.go, commands_locations.go, commands_games.go: a cross-process per-home daemon presence lock and fail-closed offline CLI root edits; lock is released on server shutdown.
  • Three focused native tests: root_topology_admission_test.go, topology_mutation_test.go, server_presence_test.go.

Reproduction and validation

  • Independent public RED regression against unmodified dev-public: native RemoveRoot writer test, with instructions.
  • The original synthetic native HTTP/SQLite regression passes after the change.
  • A separate real CLI subprocess was tested with both present and missing daemon.addr; attempts to change roots while the daemon's writer is admitted are refused in each case (twice under Go's race detector).
  • On matching source content: Linux amd64 CLI build, Windows amd64 CLI cross-build, affected API/CLI/syncengine Go race suite and go vet passed. The published branch is a clean public port of that reviewed fix; normal upstream CI remains authoritative after later updates.

Tests use isolated temporary homes, SQLite files and synthetic save bytes only; no live user save data was involved.

Failure semantics and limits

The reservation is scoped to native per-process transfer admission; the daemon-presence lock closes ordinary cooperating new-version CLI fallback against a running daemon, even without its address file. A process that bypasses OpenSave's API/CLI or a daemon running an older version without the lock is not made safe by this patch. Linux race tests and Windows cross-build are not Windows-native runtime acceptance.

No new schema, third-party integration, management state or background worker is introduced.

Omar-VF and others added 17 commits October 20, 2026 08:06
…daemon

The panel synced a game when Steam reported it running, alongside the
game starting, so the game could open its old save while the newer one
was still arriving, and playing on it led to a conflict at the next
sync. Now, when a tracked Steam game is launched, the launch is held
(Steam's game action is cancelled), the save is synced - waiting for a
sync already under way if there is one - and the game is started again.
At most 30 seconds: a slower sync carries on alongside the game, and
the toast says so. The game is started again whatever the sync did. A
toggle, "Wait for the save before starting", on by default, turns the
hold off and goes back to syncing alongside.

The daemon is also told when the game starts and stops
(/api/games/{id}/session). It otherwise has to spot the game among
running programs every ten seconds, which under Proton it may not; a
session ended from here takes the "After playing" snapshot and syncs it
before the exit sync runs.

Which games to hold is decided from a list of tracked games by App ID,
refreshed every minute and with the panel, because the hold has to be
decided the moment Steam reports the launch.
A session the plugin begins is only ended by the plugin, when Steam says
the game stopped. A reload of the plugin, or of Steam, while a game ran
lost the session, and its stop was missed: the session stayed open in
the daemon until it restarted, and with a game's save held back from
syncing while it is played, that is a save that does not sync.

The sessions begun here are kept in localStorage. When the plugin loads,
one whose game is not running is ended; one still running is kept, and
its stop ends it as usual. A session is forgotten only once the daemon
has taken its end, so an end the daemon did not get is tried again at
the next load.

Copy link
Copy Markdown
Owner Author

Upstream exact-head CI correction — PASS (30 October 2026)

The upstream PR Liquid-co/OpenSave#139 now points to the updated public commit bded2668455f1c974c971d93090d32b13704d4c7.

The two Linux E2E regressions were immediate AddRoot calls while the initial paired sync still held native admission. The E2E helper now accepts only the expected temporary 409, verifies a rejected operation did not apply its requested mapping, and retries until the original in-flight native sync drains. Production safety checks remain unchanged.

GitHub Actions CI run — all 10/10 jobs GREEN: Linux+Windows Go race suites, all six Linux+Windows E2E shards, frontend and Decky plugin. The Vercel authorization check is unrelated to source correctness.

No merges or deployments.

Seagulls and others added 17 commits October 31, 2026 17:42
…p transactions

Use immutable path evidence gathered outside the single-connection database writer, compare actual claims read inside the writer transaction, and fail closed if a new claim was not prepared. Cover primary registration, peer auto-track, relocation and named roots, plus deterministic slow-resolver and changed-claim regressions.
Since the index cache came in with dev (Liquid-co#135), a call that does not wait
can still get the newly built index when the rebuild ends first, as it
does at once for a test's tiny manifest. The tests asked for the old
index (or none) and failed whenever the rebuild won: once on Linux CI in
Liquid-co#131. They now hold the rebuild (slowBuilds), as a real one of the whole
manifest takes about a minute, and check that the call answers without
waiting for it; then let it go and check the index it builds.
Index no-wait tests: the rebuild is held while they check
…ail-closed

fix(daemon): fail-closed game ownership checks and transactional path admission
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants