Skip to content

Snapshots created within one second share a file and deleting one breaks the other #285

Description

@smith-and-web

Problem

Two snapshots of the same project and trigger type created within one second use the same backing filename. Their metadata rows have distinct IDs, but the second write overwrites the first file. Deleting either snapshot then removes the file used by the other.

Reproduction

  1. Open a disposable project.
  2. Call create_snapshot twice in rapid succession, with different names and trigger_type: "manual" (the same collision also applies to repeated export-triggered snapshots).
  3. Compare the returned metadata: the IDs differ but file_path matches.
  4. Delete the first snapshot, then preview or restore the second.

Expected: independent backing files; removing one snapshot leaves the other restorable.

Actual: preview/restore of the surviving entry fails because its shared file has been deleted. If prose changes between creation calls, the earlier entry also restores the later content.

Evidence

Reproduced through the running Tauri app during #242 validation using a disposable imported project:

  • Snapshot A created at 2026-09-07T21:07:11.694642+00:00.
  • Snapshot B created at 2026-09-07T21:07:11.713800+00:00.
  • Both returned basename 2026-09-07_210711_manual.json.gz, despite separate snapshot IDs.

This predates #242: base commit 4882480141e8e9d75ac8821c46d16e8c6bda7eef, src-tauri/src/commands/snapshot.rs:38–42, uses %Y-%m-%d_%H%M%S plus trigger type. serialize_and_compress uses File::create, which truncates that existing path. delete_snapshot removes the shared file.

Affected version: 1.2.0 / base commit above. Keep this fix separate from the scene revisions feature. Use a unique snapshot identifier (or collision-proof creation) in the filename.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: databaseSQLite databasebugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions