Generic relation/cache cleanup must never silently discard durable draft sync
intent. Strip drafts from every generic cascade and remove clean reply drafts
only at the confirmed-server-post-deletion origin.
- prepareDeletePost: drop post.drafts from the cascade.
- prepareDeleteChannel: drop channel.drafts from the cascade (channel
delete/leave/purge now preserves Draft + DraftOutbox).
- deletePosts: drop the DELETE FROM Draft SQL (data-retention eviction preserves
drafts + outbox).
- Add prepareDeleteCleanReplyDrafts(database, rootIds): removes only CLEAN reply
drafts (no DraftOutbox row) for confirmed-deleted roots, never enqueues a
DELETE; preserves reply drafts with pending local intent (local-wins); never
touches channel drafts.
- Wire it into preparePostDeletion (the removePost/removePosts confirmed path).
Checks: npm run tsc clean; eslint --quiet clean; 241 Jest tests pass across the
post/channel/drafts query + post/draft action suites.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>