Fix fold persistence corruption from external file changes (#46011)

## Summary

Fixes #33633 - folds corrupting after external file modifications.

The existing fold persistence stored raw byte offsets, which become
stale when files are modified externally (git operations, other editors,
sync tools). This caused folds to capture wrong content on restore -
users reported "wrong lines getting folded" with systematic offsets.

**Solution: Content fingerprinting**
- Store 32-byte content samples at fold boundaries
- On restore, validate fingerprints match; if not, search buffer for new
positions
- Handles edge cases: short folds (< 32 bytes), duplicate content,
boundary positioning

**Bonus fix: Ungraceful exit survival**
- Entity IDs change between sessions, but workspace cleanup's CASCADE
DELETE was wiping folds before new editors could save
- Now migrates folds to new entity_id immediately after restore

## Test plan

- [x] Unit test for fingerprint storage/retrieval
(`test_save_and_get_editor_folds_with_fingerprints`)
- [x] Manual test: fold sections, add content at file start externally,
reopen → folds restore at correct positions
- [x] Manual test: fold sections, Ctrl+C, reopen → folds survive
- [x] Existing fold tests pass (`cargo test -p editor`)

## Release Notes

- N/A

---------

Co-authored-by: Hector <hector@cyberneticwilderness.com>
e04d044271Brandt Weary committed on 1/10/2026, 8:36:33 AM· committed by GitHubparent93e3a39
2 files changedLine totals unavailable