Skip to content

snapshots: never of a save a sync is writing, never incomplete - #54

Merged
Omar-VF merged 2 commits into
Liquid-co:dev-publicfrom
ChakraFusion:pr/snapshot-safety
Oct 19, 2026
Merged

Omar-VF merged 2 commits into
Liquid-co:dev-publicfrom
ChakraFusion:pr/snapshot-safety

Conversation

@ChakraFusion

Copy link
Copy Markdown

As offered in #21. Builds on #23 (own writes), which it needs for the watcher's own/other classification.

  • A pull of a save of many files overflowed the watcher's event queue again and again, and each overflow was taken for the game saving: up to 76 automatic snapshots of a half-pulled save for one pull. An overflow while a sync is writing the game, or was a moment ago (BeingWritten), is now taken for the sync's. A burst is looked at only once no sync is writing the game at that moment (WritingNow), so a change the game makes right after a pull is still snapshotted at once.
  • A snapshot that couldn't read every file is discarded rather than kept as a save that never existed.
  • *.opensave.tmp files are never archived.

(The fork version also limits #26's "mirror the peer's snapshot when already in sync" to games without history. That part will follow #26.)

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 14, 2026

Copy link
Copy Markdown

@ChakraFusion is attempting to deploy a commit to the sivadaboi's projects Team on Vercel.

A member of the Team first needs to authorize it.

@ChakraFusion

Copy link
Copy Markdown
Author

Rebased onto today's dev-public as you asked: with #23 merged, this is now the one commit of its own. The watcher conflict resolved itself in the rebase. Watcher, snapshot, syncengine and daemon tests, TestConflictNeverLosesPeerData and the watch e2e tests pass locally.

@Omar-VF

Omar-VF commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Thanks. The first half (an event overflow during a sync taken for the sync's) is good. One concern with discarding incomplete snapshots: a game that holds a file open the whole time it runs (a log or lock file) would then have every snapshot discarded while it runs, and since the safety copy before a sync fails too, the sync stops replacing files, all quietly. Could incomplete snapshots be discarded only for automatic ones, keeping the safety copy before a sync even if a file couldn't be read (as it was before)? And if a game's automatic snapshots keep failing, say so plainly rather than only in the log.

ChakraFusion added a commit to ChakraFusion/OpenSave that referenced this pull request Oct 16, 2026
… screen

Asked in review: discarding every snapshot that could not read a file also
discarded the copy kept before a sync replaces the save, and the sync then
did not replace anything, quietly, for as long as a game held a file open
(a log, a lock file).

- Only the watcher's automatic snapshot (snapshot.CreateAutomatic) is
  discarded when it misses files; the watcher takes the change again at its
  next pass. Every other snapshot, the copy before a sync, restore or
  conflict above all, and one taken by hand, is kept with what could be
  read and a warning in the log, as before Liquid-co#54.
- When a game's automatic snapshots come out incomplete three passes in a
  row, it is said on screen once, until one succeeds again: the files the
  game holds open, and that its changes are not backed up or synced until
  they can be read, usually once the game is closed. The text is in the
  catalogs (en, zh-CN), with a "common.open" key for the toast's button.

Tests: an incomplete automatic snapshot is discarded, while one before
replacing and one by hand are kept (a seam on the archive's file open makes
a file unreadable on any system); the notice comes once per run of
incomplete passes, again after a good snapshot, and never for other
failures; the notice's wording, with the files beyond the first three
counted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ChakraFusion

Copy link
Copy Markdown
Author

Good catch, thank you. Done (618d0cd):

  • Only the watcher's automatic snapshot is discarded when it misses files (snapshot.CreateAutomatic). The copy before a sync, restore or conflict, and snapshots taken by hand, are kept with what could be read and a warning, as before snapshots: never of a save a sync is writing, never incomplete #54.
  • When a game's automatic snapshots come out incomplete three passes in a row, a toast says so once, until one succeeds again: which files the game holds open, and that its changes aren't backed up or synced until they can be read, usually once the game closes. The text is in the catalogs (en, zh-CN).

Tests: discarded vs kept, per kind of snapshot (a seam on the archive's file open makes a file unreadable on any OS); the notice once per run, again after a good snapshot, never for other failures; its wording.

@Omar-VF

Omar-VF commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

Thanks, the changes look good and it's approved. Merging #55 just now conflicts with this in en.json and zh-CN.json. Could you rebase onto dev-public? We'll merge it as soon as it's green.

ChakraFusion and others added 2 commits October 17, 2026 16:35
A pull of a save of many files overflowed the watcher's event queue again
and again, and each overflow was taken for the game saving: an automatic
snapshot of a half-pulled save every few seconds - 76 on one device for one
pull - which pushed the complete ones out of retention.

- The watcher asks whether a sync is writing the game (BeingWritten). If
  so, an overflow is taken for the sync's, and the burst is looked at only
  once the sync has finished.
- A snapshot that could not read every file is discarded, not kept: it
  would stand in the history as a save that never existed. The watcher
  leaves the change unrecorded and takes it again at its next pass; a sync
  that needed the copy before replacing files does not replace them.
- OpenSave's own temporary files (*.opensave.tmp) are never archived.

Builds on the own-writes change (Liquid-co#23).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… screen

Asked in review: discarding every snapshot that could not read a file also
discarded the copy kept before a sync replaces the save, and the sync then
did not replace anything, quietly, for as long as a game held a file open
(a log, a lock file).

- Only the watcher's automatic snapshot (snapshot.CreateAutomatic) is
  discarded when it misses files; the watcher takes the change again at its
  next pass. Every other snapshot, the copy before a sync, restore or
  conflict above all, and one taken by hand, is kept with what could be
  read and a warning in the log, as before Liquid-co#54.
- When a game's automatic snapshots come out incomplete three passes in a
  row, it is said on screen once, until one succeeds again: the files the
  game holds open, and that its changes are not backed up or synced until
  they can be read, usually once the game is closed. The text is in the
  catalogs (en, zh-CN), with a "common.open" key for the toast's button.

Tests: an incomplete automatic snapshot is discarded, while one before
replacing and one by hand are kept (a seam on the archive's file open makes
a file unreadable on any system); the notice comes once per run of
incomplete passes, again after a good snapshot, and never for other
failures; the notice's wording, with the files beyond the first three
counted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ChakraFusion added a commit to ChakraFusion/OpenSave that referenced this pull request Oct 17, 2026
A game that keeps its settings beside its saves had one PC's graphics
settings handed to every other: Crimson Desert's
save/user_engine_option_save.xml, among others.

The game database (Ludusavi manifest) already says which files are a
game's settings: it tags them "config", as opposed to "save" - 16,700
entries. The index now keeps those (indexedGame.Config, index format v3,
rebuilt once), and for each tracked game the ones inside its save folder
become exclusion patterns relative to it (presets.DeviceSettings), matched
component by component so a template's <storeUserId> wildcard meets the
folder actually tracked. An entry tagged both is a save. A pattern that
would cover the whole folder is never applied: a wrong exclusion loses
saves, a missed one only syncs a setting.

They are applied as the game's exclusion rules are, through one function
everything that applies rules now takes them from
(syncengine.Engine.IgnoreText), exactly like Liquid-co#52's launcher files: never
synced in either direction, never deleted on another device, still in
every snapshot, and kept on this device by a restore. The game's own rules
come after them, so a "!" line brings one back; a per-game switch
(games.sync_device_settings, migration 0040, "Sync these settings between
devices too" in the configuration tab, with the files listed) syncs them
all. The tab's new text is in the catalogs (en, zh-CN).

The list changes without anyone writing a rule, at the first start with
this build, so at start a game's last-snapshot hash is re-taken under the
new list where the save is the one it was recorded for
(daemon.adoptExclusionView); otherwise the watcher would snapshot and sync
a game nobody played. The base agreed with each device needs nothing: the
sync engine already translates a base recorded under other exclusions
(Liquid-co#52). Toggling the switch goes through the same path as editing the rules.

On top of Liquid-co#54, so the two merge one after the other (Liquid-co#52 is merged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ChakraFusion

Copy link
Copy Markdown
Author

Rebased onto dev-public (4dfe3f2). The only conflict was the two catalogs, where #55's restore-progress keys and this PR's keys met at the end; both are kept. Unit, frontend and the related e2e tests pass locally.

@Omar-VF
Omar-VF merged commit dee773d into Liquid-co:dev-public Oct 19, 2026
10 of 11 checks passed
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