Browse and restore Trash in the TUI

WH
11h ago
+574-25

The TUI can send mail to Trash but cannot browse it or restore a thread. Add a 0 Trash tab, with paginated browsing, thread reading, and i to restore through HEY's normal topic restore operation.

Trash returns topics rather than posting IDs. The adapter preserves that distinction, blocks posting mutations in Trash, and avoids marking a trashed topic as a seen posting. A restored row leaves the list only after success; earlier page reads cannot bring it back, and late responses cannot remove an unrelated row after switching sources.

Depends on https://github.com/basecamp/hey-sdk/pull/314 or an equivalent SDK change that preserves Trash’s pagination cursor. This PR temporarily pins the exact helper commit in my public fork so it can be built and reviewed now. Before merging, that replacement needs to be removed and a published SDK release pinned. Feedback on the Trash UI and restore behavior is welcome while the SDK dependency is reviewed.

Tests cover navigation, opaque pagination, opening without a posting observation, restore success and failure, blocked mutations, stale reads, and topic/posting ID collisions.

Validation after rebasing onto f6244d7: TUI tests, make lint, and make build passed. make test failed only TestFindBareLinksPastRejectedPrefixesIsLinear; the same five-second assertion fails on unchanged upstream on this machine. Focused live checks on combined build 9da3f57 passed in a real HEY account: trashing, browsing, reading, refusal of Move while trashed, and restoring the owned fixture with independent server readback.


Summary by cubic

Adds a Trash tab (shortcut 0) to the TUI so trashed threads can be browsed, read, and restored with i. Previously Trash was write-only: mail could be sent there, but there was no way to browse or restore it.

Trash serves topics rather than posting IDs. The adapter keeps that distinction — posting mutations are blocked in Trash, and a trashed topic is never observed as a seen posting. A successful restore removes the row and closes any open reader; a failed restore leaves the thread in place to retry. A restore also invalidates any read begun earlier, so a stale page or live response cannot resurrect the restored row even after the reader switches sources and back. Trash is excluded as a move destination. Tests cover navigation, opaque pagination, restore success and failure, blocked mutations, stale reads, and topic/posting ID collisions.

Dependencies

  • Depends on a published HEY SDK release containing Topics.GetTrashPage; until it lands, go.mod carries a temporary replace to a fork commit that must be removed before merging.