Autosave & recovery

Every edit is written to a command log beside the project, and a rotating autosave is written on a timer. Nothing in the app reads either one back, so recovery is still a manual job.

The command log

Each edit you make is appended to project.dna.log, written beside the project file and flushed to disk every 16 commands. That log is the only thing on disk holding work done since your last manual save, so a crash costs at most those last few commands.

Save often anyway. The log is written reliably; what happens to it afterwards is where this breaks down.

Autosave

A rotating backup is written on a timer, every 2 minutes by default, into a numbered file beside your .dna rather than over it:

project.dna              your last manual save
project.dna.autosave.1   newest autosave
project.dna.autosave.2   next newest
project.dna.autosave.3   oldest kept

A tick writes a tab only when that project has changed since its last save, so an idle project does not accumulate duplicates. Slot 1 is written atomically, through a temporary file renamed into place, so a crash mid-write leaves the previous backup intact rather than a half file. Edits made inside a floating subgraph editor are folded back into the project first, so they are in the backup too.

Two things bound what it covers. A tab that has never been saved has no path to write beside, so an untitled project is not backed up at all: save once and the timer starts covering it. And the flag the timer reads only ever goes up until you save, so undoing your way back to what is on disk still counts as changed and still writes a backup.

There is no interface for the interval or the backup count. Both live in the preferences file on disk, clamped to 1 to 60 minutes and 1 to 10 backups, with autosave on by default.

Nothing in the app opens an autosave for you. The backup is a complete project file, but no route inside DNA loads one: the recovery prompt below names the file and does not read it. To get the work back, quit, copy project.dna.autosave.1 beside your project and rename it to end in .dna, then open it normally. The Open dialog offers .dna files only, so the rename is not optional.

Crash recovery

At the next launch after a power cut, a forced quit or a crash, a prompt headed Restore unsaved changes? appears for the project that was open at the time, naming the autosave it found. It offers Yes, restore and No, discard, and closing it counts as discard.

Neither button loads anything. Yes, restore clears the prompt and leaves the command log on disk. No, discard deletes the log. Both then mark the session as having shut down cleanly, and that flag is exactly what the replay checks when a project is opened, so answering the prompt at all is what stops the log from being replayed.

The practical consequence: after a crash, the autosave beside your project is the newest thing you have, and the manual rename above is how you get at it. Answer the prompt either way and the command log stops being a route back.

For the prompt in detail see Crash recovery, and note that that page describes the restore path as replaying the log, which is what the code intends rather than what it does.

See also