The OPFS recovery snapshot (apps/filmcraft-web) had two problems:
- #197: opfs::write never reported failures, and Autosave recorded the
revision as snapshotted before the write ran. A failed write was only
retried after the next edit.
- #193: the first tick of a clean session wrote {"dirty": false} to the
meta. Starting with ?norecover or ?fresh therefore discarded a
snapshot that was never reopened.
The decision of when to snapshot or mark clean moves to a pure module,
recovery_policy, tested natively in tests/recovery_policy.rs. Failed
writes (snapshot or clean meta) are retried after the 5 s interval
without another edit, and the meta is only marked clean to retire a
snapshot this session wrote. opfs::write_then reports whether a queued
write landed (coalesced writes report the newest one's result).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012HrAqZmrrDLRpxBJatxvaJ