Skip to content

Write project.json atomically to avoid metadata corruption on interruption #378

Description

@kwannoel

Summary

  • src-tauri/src/storage.rs:135 overwrites project.json directly with fs::write(...).
  • src-tauri/src/storage.rs:152 already contains corrupt-entry recovery because malformed project.json files are expected in the wild.

A crash or forced quit during save can leave truncated JSON on disk and make a project disappear behind the corrupt-entry path on the next load. Remediation: write to a temp file in the same directory, flush/fsync it, and rename it into place atomically so readers see either the old or new valid document, never a torn file.

Maintainer Metadata

  • Fingerprint: atomic|corruption|data|filesystem|integrity|json|metadata|storage|write
  • Symptom Type: metadata corruption
  • Affected Files: src-tauri/src/storage.rs
  • Keywords: storage, project_json, atomic_write, data_integrity, filesystem

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions