v3.25.2

dstotijn/hettyv3.25.2Jul 6, 2026by ruvnet

AI Summary

This release improves AgentDB durability by implementing atomic file writes and automatic backup restoration to handle malformed database images.

Key Highlights

  • Implemented atomic DB writes using temp file -> fsync -> rename strategy
  • Added automatic backup restore on malformed database images
  • Validated integrity checks before salvaging corrupted data

Full Release Notes

## ruflo 3.25.2 — AgentDB durability: atomic flushes + backup auto-restore

Fixes [#2584](https://github.com/ruvnet/ruflo/issues/2584) — AgentDB (sql.js) `database disk image is malformed` under torn/concurrent full-image flushes.

- **Atomic DB writes.** Every full-image flush now goes temp → `fsync` → `rename` (new `writeFileAtomic`, and `writeFileRestricted` routed through it), plus the decay-path flush and `metrics-db.mjs`. A kill/OOM mid-write or a concurrent writer can no longer leave a half-written, malformed image.
- **Backup auto-restore.** On a malformed open, when the in-place rebuild can't salvage the image (the reported case where `sqlite3 .recover` recovered 0 rows), recovery now **restores the newest `integrity_check=ok` snapshot** from `.swarm/backups/` and parks the corrupt original — turning total loss into automatic recovery. (Rotating periodic backups already existed.)
- **Test:** a synthesized torn image (integrity_check fails, rebuild salvages nothing) that must recover via backup-restore — 6/6 pass.

Additive · fail-closed · zero-regression. `npx ruflo@latest`.

🤖 Generated with [RuFlo](https://github.com/ruvnet/ruflo)