feat(mobile): diff review surface — inline comments, native review toolbar, rebuilt diff renderer

Merged
SA
4mo ago
+2737-388

Summary

Second wave of the mobile workspace UX work (follow-up to #5635), centered on turning the files-changed screen into a full review surface:

  • Review flow — long-press a diff line or file to draft comments; drafts persist per workspace, show as counts in the jump-to-file sheet, and "Send to chat" packages the review into an ACP session via the finish-review sheet. Native bottom toolbar (prominent green CTA + jump-to-file bar button).
  • Diff renderer rebuilt — hunk-segment text blobs on FlashList v2 with exact fixed row heights and a per-file item cache; syntax highlighting via the code-block tokenizer; eager pipelined diff loading; horizontal panning with edge-only back gesture so scrolling left doesn't pop the screen.
  • Files-changed chrome — native pinned header, per-file bars and tap menus, animated section collapse, viewed-file tracking, GitHub-style file status badges matching the desktop changes-view language (shared FileStatusBadge).
  • Commits sheet — native pinned sheet header, continuous opaque timeline rail (TimelineRow), author avatars (org member → GitHub noreply → monogram), vertical commit glyph.
  • Composer polish — whole-pill tap-to-focus, glass "View changes" chip that glides on a layout spring with proper clearance, tighter SwiftUI edge padding.
  • Navigation — stable human route titles for back-button menus (Home / Workspace / Chat), file viewer route, jump-to-file sheet.
  • Fixes along the way: zustand unstable-snapshot render loops (two sites), diff query cache-shape collision, large-changeset fetch stampede, sticky-header reanimated crash, dev-client worklets pan fallback.

Test plan

  • Full review loop in sim against local host: draft line + file comments → jump sheet counts → send to chat → lands in ACP thread
  • Large changeset (100+ files) opens without relay stampede; sections collapse/expand smoothly
  • Horizontal diff scroll both directions; back only from the left edge on diff screens
  • Commits sheet cold-opened post-relaunch (formSheet cold-mount check)
  • bun run lint and turbo typecheck green (mobile, host-client, host-service)
  • CI full suite + Maestro E2E on this PR

Summary by cubic

Turns the mobile files‑changed view into a full review surface with inline comments, a native finish‑review toolbar, and a rebuilt FlashList‑based diff renderer. Also adds a consolidated workspace screen, ACP‑backed chat lists, a commits sheet, and native per‑file headers and menus.

  • New Features

    • Review flow: long‑press a line or file to draft comments; drafts persist per workspace and show counts in Jump‑to‑file; Finish Review sends the package to an ACP thread via a native bottom toolbar.
    • Rebuilt diff renderer: @shopify/flash-list v2 with exact row heights and per‑file item cache; syntax‑highlighted lines, context expansion, and pipelined loading; horizontal pan with edge‑only back gesture.
    • Files‑changed UI: solid native header; per‑file bars with viewed state, tap menus (SwiftUI UIMenu), animated collapse/expand, GitHub‑style file status badges; Jump‑to‑file sheet; file viewer with highlight and share/copy.
    • Commits sheet: pinned header, continuous timeline rail with avatars, and a vertical commit glyph.
    • Workspace & navigation: new workspace landing (chat list + diff); chat threads live in the root stack with human route titles (Home / Workspace / Chat); home lists ACP sessions via useHostAcpSessions; host‑client listSessions input is now optional. Dependencies: added @shopify/flash-list and diff.
  • Bug Fixes

    • Fixed diff cache correctness and pull‑to‑refresh invalidation; collapsed large changesets by default; stabilized sticky headers and list animations.
    • Corrected monospace char width and scroll clamping; wide characters (CJK/emoji) no longer wrap; drafts persist line type/tokens for accurate styling.
    • Edge‑only back gesture on diff screens; stable zustand selectors; PressableScale now respects caller styles so fixed row heights apply; reset collapse when viewed baselines flip; Jump‑to‑file force‑expands unviewed targets.

Summary by CodeRabbit

  • New Features
    • Added a redesigned mobile workspace diff viewer with syntax highlighting, expandable sections, file status indicators, viewed-file tracking, inline comments, and review actions.
    • Added sheets for line comments, finishing reviews, and jumping directly to changed files.
    • Added file sharing and expanded copy options in the file viewer.
  • Bug Fixes
    • Improved navigation headers, titles, gestures, and presentation behavior across workspace screens.
  • Style
    • Added smoother widget transitions and more consistent pressable component styling.