feat(diagnostics): active connect-failure triage + Sentry + in-app share (#2)

* feat(diagnostics): active connect-failure triage + Sentry + in-app share

Replaces the opaque "Connection Failed" / "Network request failed" dead-end
with on-device diagnostics that classify *why* a connect attempt failed.

On failure (quick connect and edit-connection test), the app now:
- runs parallel probes: target /global/health, target root, and a public
  204 endpoint (internet reachability check)
- classifies the cause: malformed-url, no-internet, server-unreachable,
  health-failed, tls-error, timeout
- shows a plain-English summary + a "Share report" button that copies a
  full report (target URL, per-probe results w/ error.cause, device/app
  info, recent log ring-buffer) to the clipboard and opens the share sheet
- captures the same structured context to Sentry (auto-upload), gated on
  EXPO_PUBLIC_SENTRY_DSN so dev/CI builds work without secrets

New: src/lib/logbuffer.ts (ring buffer + logger), src/lib/diagnostics.ts
(regex URL parse — Hermes URL is incomplete — probe + report + share),
src/lib/sentry.ts (no-op-without-DSN wrapper, scrubs basic-auth from URLs).

Wired Sentry.wrap around RootLayout and initSentry() at module load.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ci(sentry): wire Sentry DSN + source-map upload env into build; bump to 0.2.2

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Den
2026-05-22 17:07:44 -07:00
committed by GitHub
parent e9991cb61b
commit 30be6636c2
11 changed files with 796 additions and 11 deletions

View File

@@ -61,6 +61,22 @@
3. **Add accessibility labels** — add `content-desc="Send"` to the send button in the app for better CUA reliability
4. **More scenarios** — settings toggle, reconnect after server restart, slash commands
## Connection Diagnostics (added in feat/connection-diagnostics-sentry)
When a connect attempt fails, the app now runs an **active triage probe** instead of
showing a generic error. It classifies the cause: `malformed-url`, `no-internet`,
`server-unreachable`, `health-failed`, `tls-error`, `timeout`. The dialog shows a
plain-English summary plus a **Share report** button (copies a full report —
target URL, per-probe results, device/app info, recent logs — to clipboard + share sheet).
- Code: `src/lib/diagnostics.ts` (probe + report), `src/lib/logbuffer.ts` (ring buffer),
`src/lib/sentry.ts` (auto-upload wrapper).
- **Sentry auto-upload** is opt-in via env var: set `EXPO_PUBLIC_SENTRY_DSN` at build time.
Without it, Sentry is a no-op and only the in-app Share report works (fully offline).
For source-map upload at build, also set `SENTRY_AUTH_TOKEN` / `SENTRY_ORG` / `SENTRY_PROJECT`.
- The probe runs on-device, so it reports the *phone's* real network reality —
unlike the co-located emulator, it can distinguish a true remote-peer tailnet failure.
## Repo & Auth
- Repo: `dzianisv/opencode-mobile`
- GitHub auth: `source ~/.env.d/github-dzianisv.env`