Skip to content

feat(threads): sync drafts automatically and take over on receipt - #699

Merged
nixuuu merged 3 commits into
devfrom
feat/threads-pull-drafts
Nov 14, 2026
Merged

nixuuu merged 3 commits into
devfrom
feat/threads-pull-drafts

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Unsent composer drafts now sync after 1.5 seconds of idle typing and on blur, backgrounding, or navigation. The receiving device chooses Take over, including attachments and citations. The source clears only an unchanged saved revision; later edits fork into a new draft and remain editable.

The incoming indicator replaces the computer label in the existing composer metadata slot. Open drafts moves to an icon in the sidebar footer, removing the permanent action row on web and mobile. Sidebar markers include drafts from other devices across every page. Nonempty composers offer Append draft or explicit Replace local draft.

Related: #664

The additive protocol returns content-free take-over receipts and thread IDs for sidebar markers. Migration 0142 stores receipts for 30 days, scoped to owner and source device, so source reconciliation still works after the receiver saves or sends. Existing CAS, fork-on-conflict, send fencing, recovery, and short delivery transactions remain intact. Cross-tab adoption retires stale composers; mobile refreshes again if an invalidation arrives during an outstanding read.

Validation:

  • bun install, bun run gen:check, full workspace typecheck, lint, formatting check, and the production web build passed. Focused runs use nice and private disk-backed temporary storage.
  • 47 focused gateway/schema tests plus 4 local draft-store tests passed through check:tmp, with no leftover test directories. Coverage includes one save per typing burst, blur flush, delete, durable source receipts, owner scoping, edit/send races, and invalidation during a page read.
  • Browser review used an isolated synthetic gateway and database: light/dark, 1280 px desktop and 390 px phone, short and long prompts and device names. Appending preserves local text. Two actual composers confirmed that an unchanged source clears, later edits survive a delayed-save race, and the source remains editable. No horizontal overflow or page errors. The removed push action is absent.
  • iOS and Android exports and mobile typecheck passed. Fingerprints match the dev baseline: iOS 138e0c6b171c82b4933e86808cdfef56da73b8c6; Android 906dc944f94eb8333fa384ed9f198834fdd30d13. Native configuration and dependencies are unchanged. Device checks remain blocked as specified.

Copy audit (§8): “Continue on another device” → automatic sync removes an unnecessary decision. “Continue” / “Continue here” → “Take over” makes the move explicit. “Append draft” / “Replace local draft” name the nonempty-composer choices. “Draft taken over on …” and “Your edits are kept here” explain the source outcome. Actions start with verbs, use sentence case, and convey meaning without color. Long device names truncate within one existing line; append/replace labels remain readable at phone width. No new glossary term or decorative copy.

Review follow-up:

  • Composer hints match the full thread/project/workspace/parent target; take-over also rejects a mismatched target before claiming it.
  • Source notices clear on the next edit, send or new incoming hint. Mobile adds Dismiss within the same single line.
  • Listing uses ordinary reads without row locks. Both clients cap source receipt IDs at 100, newest first, and the gateway truncates oversized requests.
  • The threads documentation now states automatic sync, 30-day retention and visibility restricted to the owner's devices.

Follow-up validation: 33 focused gateway/linked-draft/domain tests passed through check:tmp, including full target isolation, input-change detection, bounded receipt requests and sending while a list transaction remains open. Workspace typecheck, lint, formatting, web build, and iOS/Android exports passed. Both native fingerprints still match the dev baseline recorded above. No new browser or device review was performed for this follow-up; the browser evidence above is from the original implementation. Device checks remain blocked.

Copy audit follow-up (§8): mobile source notice without an action → source notice with Dismiss, matching web. The action uses a verb and sentence case, has a visible text label and adds no explanatory copy or extra row.

@nixuuu
nixuuu marked this pull request as ready for review November 14, 2026 10:35
@nixuuu
nixuuu merged commit 4397875 into dev Nov 14, 2026
10 checks passed
@nixuuu
nixuuu deleted the feat/threads-pull-drafts branch November 14, 2026 11:04
nixuuu added a commit that referenced this pull request Nov 14, 2026
nixuuu added a commit that referenced this pull request Nov 14, 2026
Drafts now appear as a counted tab attached to the composer's top edge,
expanding into a compact dropdown. The tab exists only when another
device has an unfinished draft for this composer's full target. Clicking
a row takes it over; a nonempty composer offers **Append draft** or
**Replace local draft** inline. Each row includes its preview,
attachment count, source device, age and **Discard draft** action.

The modal, sidebar **Open drafts** entry, manual refresh actions and
separate incoming-draft indicator are removed on web/desktop and mobile.
Cross-thread discovery stays with sidebar draft markers, keeping this
panel focused and avoiding navigation from a composer dropdown. Source
move notices and pending-send recovery remain available.

Both clients reserve a fixed 32 px/point slot so arriving drafts never
move the composer. Web uses the existing nonmodal top-layer popover;
mobile anchors a nonmodal portal to the same edge. Both use existing
motion tokens and respect reduced motion. The shared live cache finishes
pagination up to the existing 100-draft limit so counts include later
pages.

Related: #699

Validation:

- `bun install`, `gen:check`, workspace typecheck, lint and format
checks passed. Web typecheck and production build passed after the final
popover adjustment.
- 35 focused domain/gateway/linked-draft tests passed through
`check:tmp` (172 assertions), with no leftover test directories.
- Browser review passed at 1280 and 390 px in light and dark: empty tab
hidden, 22 drafts across pages, stable composer position, joined
borders, append/replace, attachment/citation preservation, discard and
live disappearance. No page errors.
- iOS and Android exports passed; both native fingerprints are unchanged
from dev. Device checks remain blocked by scope.

Copy audit (§8): **Open drafts**, the explanatory modal sentence, empty
state and **Refresh drafts** → **Drafts** with a count. Row previews
replace the repeated take-over call to action; accessible row labels say
**Take over draft: …**. **Append draft** and **Replace local draft**
retain their explicit meaning; **Delete draft** → **Discard draft**
matches the requested × action. Buttons use verbs and sentence case; the
noun-only **Drafts** labels a disclosure. Errors explain the failure and
retry action. No new glossary terms or decorative copy. Short and long
drafts, attachment labels and device names were reviewed at desktop and
phone widths in both themes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant