Files
wordcraft/crates/engine
MichaelandClaude Sonnet 5 a1d83853ec finish(): guard against a stale document identity and a prior job's error
Two real issues CodeRabbit caught in the first commit, both in
Recovery::finish:

- It didn't repeat tick's own guard against a stale self.id: if the
  session switched documents with no regular tick in between to
  notice and reset that identity, finish would discard the *previous*
  document's still-live recovery copy under the *new*, clean
  document's state. Added the same self.document == document_id()
  check tick already uses, and a test reproducing it (confirmed it
  fails without the guard).

- An in-flight job failing (e.g. a stray autosave) returned
  immediately via `?`, skipping the clean-document discard below it
  entirely — so a save that really did land cleanly right before exit
  could still leave a stale copy, for an unrelated reason. Keeps that
  error to return at the end instead, after still attempting the
  discard.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-20 11:40:54 +08:00
..