Files
buzz/desktop/tests
Matt Toohey 053b1ef343 fix(desktop): keep agent prefills durable across in-app navigation
Address three review findings on the draft entryKind classification:

- Keep isValidDraftState a pure structural predicate; move the
  migration-era defaulting (mentionRefs, status, entryKind) into
  normalizeStoredDraft, applied in readStore's single read funnel.
- Skip the implicit agent-mention prefix strip in the unmount persist
  cleanup when the entry is an agent-prefill: a pure prefill IS the
  prefix, so stripping persisted "" and cleared the record on every
  in-app SPA navigation. Storage-boundary normalization still demotes
  anything that is not mention-only, and agent-prefill records remain
  excluded from Inbox draft rows and counts.
- Bind the fix in tests: unit coverage now exercises the cleanup with a
  real getImplicitAgentMentionPrefix getter (durable pure prefill,
  authored drafts still stripped, no Inbox pollution), and the e2e spec
  adds an in-app navigation leg so the composer-unmount persist path is
  exercised and the stored classification is asserted to survive it.

Collateral fixes surfaced by verification:

- Migrate the two prefill e2e tests to thread scope: since #7144 made
  automatic mentions thread-only, the channel-composer variants were
  broken on rebase (they fail on the unmodified base commit too).
- Preserve trailing spaces in useRichTextEditor's setContent: the
  markdown re-parse drops them, but a restored prefill's separator
  ("@Name ") must survive so the caret lands past it and the next
  keystroke does not fuse into the mention.

Verified with the full desktop unit suite (6067 passing) and the
persistent-agent-audience Playwright suite (37 passing); both new
guards were falsified against the reverted fix.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
2026-09-04 15:35:21 +10:00
..