iOS: add in-app share diagnostics

Closed
AU
22d ago
+1773-105

Fixes #5515

Summary

  • Adds a release-safe mobile diagnostics report builder with secret scrubbing, app/device metadata, auth/connection state, event logs, debug log, and recent OSLog lines.
  • Wires Share Diagnostics into the iOS workspace detail menu with Copy and ShareLink actions.
  • Injects diagnostics logs in Release/TestFlight and records redacted auth/connection transitions.

Validation

  • git diff --check
  • python3 -m json.tool ios/cmux/Resources/Localizable.xcstrings >/dev/null
  • python3 scripts/check-workspace-package-groups.py --check
  • Localization audit: added en/ja entries for mobile.diagnostics.close/copy/share/shareAction and checked both locales are present.

Local dev builds and xcodebuild were intentionally not run per issue instructions.


Summary by cubic

Adds in‑app Share Diagnostics on iOS so users can copy or share a redacted report from the Workspace menu. Tightens privacy and improves support/triage for #5515.

  • New Features

    • Introduces CmuxMobileDiagnostics: secret scrubber, report builder, store‑scoped in‑app event log, and a current‑process OSLog reader that omits message bodies and preserves an “OSLog unavailable” status.
    • Adds a “Share Diagnostics” sheet with selectable text, Copy, and Share; shows app/device info, auth (with last display‑safe error), connection (host/last error), in‑app events, debug‑log line count, and OSLog count/status; omits the process‑wide structured log for account‑scoped privacy; adds en/ja strings.
    • Builds a structured DiagnosticLog for all builds to stamp feedback; it remains private in Release and is exportable only on DEBUG.
  • Bug Fixes

    • Records display‑safe auth failures via AuthCoordinator.lastAuthError across send/verify code, OAuth, password sign‑in, token read/refresh, and offline checks; clears on successful sign‑in.
    • Protects shared‑device privacy and stability: blanks host before disconnect, scrubs and retains lastConnectionError, scopes the diagnostics event log to the shell store and swaps in a fresh instance on sign‑out to avoid races and cross‑account leakage, and cancels report work if the sheet is dismissed; gates structured diagnostic‑log export to DEBUG in privileged feedback.
    • Improves Xcode 16 compatibility with nonisolated loggers, a Sendable notification‑status read, and compiler‑guarded iOS 26 glass APIs.

Summary by CodeRabbit

  • New Features
    • Added an in-app iOS “Share Diagnostics” sheet with a selectable, copy/shareable report and automatic secret redaction.
    • The report now includes app metadata, auth/connection status, in-app events, structured diagnostics events, and recent OS log entries.
    • Added diagnostics event logging for sign-in/out and connection error changes.
  • Bug Fixes
    • Improved authentication error tracking so the most recent display-safe auth failure is consistently captured.
    • Hardened chat UI keyboard handling and iOS 26-related scrolling/glass styling across compiler versions.
  • Tests
    • Added/updated unit tests for diagnostics report formatting/redaction and auth offline/unauthorized error assertions.