Skip to content

Dirty-note autosave can recreate deleted or renamed files #375

@kwannoel

Description

@kwannoel

Summary

  • src/lib/NotesEditor.svelte cancels the debounce when activeNote changes, then fires command("write_note", ...) for the previous note with .catch(() => {}).
  • That write is not awaited, and the editor immediately advances to the next note.
  • If write_note rejects during that handoff, the old note's dirty buffer is dropped silently: there is no retry, no error surface, and no way to recover the unsaved text from UI state.
  • src/lib/NotesEditor.test.ts does not cover a rejected write_note during note switching.

This is a silent data-loss path in note editing. Remediation: keep the previous note dirty until the flush succeeds, or block/restore the switch on failure, and add a regression test for rejected flushes during note switching.

Maintainer Metadata

  • Fingerprint: autosave|data|loss|note|notes|noteseditor|silent|state|test|ts|write
  • Symptom Type: silent data loss
  • Affected Files: src/lib/NotesEditor.svelte, src/lib/NotesEditor.test.ts
  • Keywords: notes, autosave, write_note, state_loss

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions