Skip to content

feat(020): rip out Cloud V1 from the mobile app#3389

Merged
aisraelov merged 3 commits into
devfrom
cloud-v1-mobile-ripout
Jul 11, 2026
Merged

feat(020): rip out Cloud V1 from the mobile app#3389
aisraelov merged 3 commits into
devfrom
cloud-v1-mobile-ripout

Conversation

@isaiahb

@isaiahb isaiahb commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

020: Rip out Cloud V1 from the mobile app

Follow-up to #3382 (stacked on mentra-account-auth; GitHub retargets to dev when that merges). Removes the V1 wiring the login cutover left dormant.

Deleted

  • SocketComms + WebSocketManager (+ tests + jest.setup mocks) — the V1 glasses websocket that could no longer authenticate post-cutover
  • supabaseClient.ts + @supabase/supabase-js — zero Supabase SDK in the app now (bun.lock updated)
  • LogoutUtils V1 coreToken plumbing — logout verification now checks the V2 MMKV token pair; the legacy Supabase storage-key wipe is kept as upgrade hygiene

Migrated

  • Boot version gate → Cloud V2 core GET /api/client/min-version (same retry semantics, new utils/cloudVersion.ts)
  • CloudConnection banner + WebsocketStatus pill → cloud-v2 runtime connection via toolkit.session.status()/onStatus() (the old status store loses its only writer with WSM gone)

Removed with tracking (silently failing since the cutover; V2 endpoints don't exist yet)

  • V1 settings server pull/push (boot load, timezone sync, devModeAllowlist write) — settings are local-first until a V2 sync lands. Also kills the boot-time "MANTLE: Failed to sync timezone" toast.
  • Phone-notification + calendar uploads to V1 (local miniapp forwarding unchanged) — a V2 channel for cloud miniapps is the real product gap here

Out of scope (island-side, to coordinate with the island workstream)

Verification

53 jest suites / 424 tests pass; tsc clean outside island's in-progress files. Device e2e (login → home → cloud connect on cloud-isaiah) to be re-run on this branch before merge.


Summary by cubic

Removes all Cloud V1 code from the host app and engine module, and moves the boot version gate and connection UI to Cloud V2. Logout now uses the V2 auth flow; settings and phone/calendar/location uploads are local‑first until V2 sync lands.

  • Refactors

    • Deleted V1 websocket path: SocketComms and WebSocketManager (tests and jest.setup mocks removed).
    • Boot version gate now calls Cloud V2 GET /api/client/min-version via utils/cloudVersion.ts (with retry); connection reset targets SETTINGS.cloud_core_url.
    • Connection UI (CloudConnection, WebsocketStatus) now uses engine.session.status() / onStatus() (Cloud V2 runtime).
    • Simplified logout: provider sign-out + legacy Supabase key wipe; verification checks both MMKV tokens.
    • Removed V1 settings sync and server fallback writes; settings are local-first.
    • Removed engine RestComms and its callers; dropped backend_url/saved-URL settings, related dev/session facades, V1 URL builders; cleaned diagnosticContext.
    • Removed V1 phone-notification, calendar, and phone-location uploads; local miniapp forwarding stays.
    • Cleaned dev/debug UI: removed BackendUrl and NonProdWarning; VersionInfo shows cloud_core_url.
    • Aligned imports and names to @mentra/engine (was @mentra/island) after merge from dev.
  • Dependencies

    • Removed @supabase/supabase-js and its patch; deleted supabaseClient.ts.
    • Dropped the postinstall patch-package step that applied the Supabase patch.

Written for commit 057f852. Summary will update on new commits.

Review in cubic


Note

High Risk
Large cutover touching boot version gating, connection UI, auth/logout, and removal of settings sync and cloud uploads; misconfigured Cloud V2 endpoints or missing V2 replacements could block login or silently stop cloud-side phone/calendar/location data until follow-up work lands.

Overview
Removes the dormant Cloud V1 stack from the mobile app and engine: SocketComms, WebSocketManager, island RestComms, @supabase/supabase-js / supabaseClient.ts, V1 backend_url settings and dev BackendUrl / NonProdWarning UI, plus related tests and jest mocks.

Boot and connectivity now use Cloud V2: the splash minimum-client-version check calls fetchMinimumClientVersion against the resolved cloud core URL (custom URL detection/reset uses cloud_core_url). CloudConnection and WebsocketStatus subscribe to engine.session.status() instead of the legacy V1 websocket store.

Runtime behavior is local-first where V1 uploads are gone: Mantle no longer pulls/pushes user settings, syncs timezone, or uploads phone notifications/calendar/background location to V1; local miniapp forwarding is unchanged. Engine settings drops per-change server sync and getRestUrl/getWsUrl; session.account.* and dev backend URL helpers are removed from facades. Logout signs out via the auth client and verifies V2 MMKV tokens, with legacy Supabase key cleanup only for upgrades.

Reviewed by Cursor Bugbot for commit 057f852. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

📋 PR Review Helper

📱 Mobile App Build

Ready to test! (commit 057f852)

📥 Download APK

🕶️ ASG Client Build

Waiting for build...


🔀 Test Locally

gh pr checkout 3389

@isaiahb isaiahb force-pushed the cloud-v1-mobile-ripout branch 2 times, most recently from 651b193 to 77599d4 Compare July 9, 2026 22:48
@isaiahb isaiahb changed the base branch from mentra-account-auth to dev July 10, 2026 00:44
@isaiahb isaiahb force-pushed the cloud-v1-mobile-ripout branch 2 times, most recently from 11110a0 to d8bc631 Compare July 10, 2026 00:46
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

PR Agent Orchestrator State

{
  "cycle": 8,
  "fixRound": 0,
  "totalReviewerRuns": 8,
  "consecutiveNoNewReviews": 8,
  "openFindings": [],
  "resolvedFindings": [],
  "nitFindings": [],
  "phase": "discovery",
  "status": "in_progress",
  "lastPair": [],
  "stagnationFixRounds": 0,
  "lastOpenCount": 0,
  "fingerprintReopenCounts": {},
  "mutedFingerprints": []
}

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

🤖 PR Agent Review — cycle 8

✅ No blocking findings · 0 blocking · 0 nits
Reviewers this cycle: none

No model reviews ran this cycle.

Updated automatically by the PR Agent Orchestrator each review cycle. Nits do not block merge.

@isaiahb

isaiahb commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Device e2e green (emulator against cloud-isaiah)

Ran the ripout build (Metro on this branch, pointed at cloud-isaiah). Verified the three things the removals put at risk:

  • Boot version gate on V2: INDEX: Version check: local=2.11.0, required=0.0.0, recommended=0.0.0 — that's cloud-isaiah's /api/client/min-version response, so the new utils/cloudVersion.ts replaces the retired V1 RestComms path cleanly.
  • Connection banner on V2 status: login to home with the full miniapp grid, no red "Connection Error" banner. The banner now reads toolkit.session.status() (cloud-v2 runtime), which reported connected, so it correctly stays hidden. The old store it used to read lost its only writer when WSM was deleted.
  • No dead-socket noise: cloudClient: runtime connected / connect() resolved, and zero WSM: / glasses-ws lines across the whole session (login and post-login). The per-boot "MANTLE: Failed to sync timezone" error toast is also gone with the V1 settings sync.

Full flow observed: version check (V2) → login → handleTokenExchange()cloudClient: endpoints {cloud-isaiah} → runtime connected → home. 53 jest suites / 424 tests pass, tsc clean.

@isaiahb isaiahb marked this pull request as ready for review July 10, 2026 00:51
@isaiahb isaiahb force-pushed the cloud-v1-mobile-ripout branch from d8bc631 to ed7ff3b Compare July 10, 2026 00:52
Comment thread mobile/src/app/index.tsx

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d8bc63180d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread mobile/src/app/index.tsx

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f1b72a6. Configure here.

Comment thread mobile/src/components/error/WebsocketStatus.tsx
Removes all Cloud V1 wiring from the mobile app, host and island, following
the login cutover (#3382).

Host (src/):
- Delete SocketComms + WebSocketManager (the V1 glasses websocket) + tests +
  jest mocks, and ws-types.
- Delete the Supabase provider + @supabase/supabase-js dependency (and its
  orphaned patch-package patch) — no Supabase SDK in the app at all.
- Delete the RestComms shim, BackendUrl.tsx (redundant with the V2 CloudUrl
  switcher), and NonProdWarning.tsx (already unreferenced). VersionInfo shows
  cloud_core_url instead of backend_url.
- Boot version gate + connection banners already moved to V2 (min-version on
  core, toolkit.session.status) in earlier commits; the connection-screen
  reset now targets cloud_core_url.

Island (modules/island/):
- Delete services/RestComms.ts (the V1 REST client) and every caller.
- Remove the backend_url + saved_backend_urls settings, getRestUrl/getWsUrl
  (the /glasses-ws builder), and the per-change user-settings server sync.
- Drop the dead V1 facades: session.account.*, dev.minimumClientVersion /
  backendUrl / setBackendUrl / savedUrls.
- Remove the V1 phone-location upload (local miniapp forwarding unchanged).
- Remove backend_url from runtime/config + diagnosticContext.

Removed-with-tracking (V2 endpoints do not exist yet; these already silently
failed post-cutover): per-change settings sync, phone-location upload, phone
notification / calendar upload. Follow-up product work, noted in #3392.

Verification: 52 jest suites / 421 tests pass, tsc clean (island included),
device e2e green on cloud-isaiah (V2 version gate, login to home, connection
banner correct, zero legacy-websocket noise).
@isaiahb isaiahb force-pushed the cloud-v1-mobile-ripout branch from f1b72a6 to 288a301 Compare July 10, 2026 02:36
@isaiahb

isaiahb commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Scope expanded to the full V1 removal (host + island), closes #3392

Per review discussion, this PR now removes all Cloud V1 from the mobile app, not just the host auth/socket paths. Audit and plan captured in #3392.

Added since the initial host-auth removal:

  • Deleted the redundant BackendUrl.tsx (the V2 CloudUrl switcher already exists) and the unreferenced NonProdWarning.tsx; VersionInfo shows cloud_core_url.
  • Deleted island's RestComms.ts (the V1 REST client) and every caller, removed the backend_url / saved_backend_urls settings + getRestUrl/getWsUrl (/glasses-ws), the per-change settings server sync, the dead V1 facades (session.account.*, dev.minimumClientVersion / backendUrl / savedUrls), and the V1 phone-location upload.

Removed-with-tracking (no V2 endpoint yet; already silently failing post-cutover, so no live regression): per-change settings sync, phone-location upload, notification/calendar upload. Follow-up product work, noted in #3392.

Net: +114 / −2281. 52 jest suites / 421 tests pass, tsc clean (island included). Device e2e re-verified on cloud-isaiah before this push (V2 version gate, login → home, connection banner correct, zero legacy-websocket noise).

Island coordination note: this touches modules/island/ (the island workstream's module). The removals are of dead-or-silently-failing V1 code with no V2 dependants, verified by the full island jest suite, but flagging for whoever owns that module to sanity-check the settings-store and facade changes.

- Drop the postinstall patch-package step: it pointed at the deleted
  patches-runtime/ dir, whose only patch was the retired Supabase one
  (a missing --patch-dir is a no-op, so this is dead weight, not a fix)
- Verify logout against both MMKV account tokens so the check matches
  the "token pair" comment
- Update stale comments that still described the deleted
  WebSocketManager/SocketComms/ws-types as live
Dev's #3411 renamed @mentra/island to @mentra/engine (toolkit → engine)
across every file this branch deletes or edits. Resolution re-expresses
the ripout in the engine world:

- Files this branch deletes (host SocketComms/WSM/RestComms/ws-types,
  BackendUrl, NonProdWarning, and the module RestComms): deletion wins;
  dev's only changes to them were the mechanical rename.
- Content conflicts: this branch's version plus dev's exact rename sweep
  (@mentra/island → @mentra/engine, toolkit → engine, useToolkitSnapshot
  → useEngineSnapshot), with comment wording aligned to dev's engine
  naming.

tsc clean on the merged tree (mobile src + modules).
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 11, 2026

Copy link
Copy Markdown

Deploying mentra-live-ota-site with  Cloudflare Pages  Cloudflare Pages

Latest commit: 057f852
Status: ✅  Deploy successful!
Preview URL: https://4114324a.mentra-live-ota-site.pages.dev
Branch Preview URL: https://cloud-v1-mobile-ripout.mentra-live-ota-site.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mentra-store-dev with  Cloudflare Pages  Cloudflare Pages

Latest commit: 057f852
Status: ✅  Deploy successful!
Preview URL: https://69fb147b.augmentos-appstore-2.pages.dev
Branch Preview URL: https://cloud-v1-mobile-ripout.augmentos-appstore-2.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying dev-augmentos-console with  Cloudflare Pages  Cloudflare Pages

Latest commit: 057f852
Status: ✅  Deploy successful!
Preview URL: https://7ce0ed65.dev-augmentos-console.pages.dev
Branch Preview URL: https://cloud-v1-mobile-ripout.dev-augmentos-console.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying prod-augmentos-account with  Cloudflare Pages  Cloudflare Pages

Latest commit: 057f852
Status: ✅  Deploy successful!
Preview URL: https://06a0f64e.augmentos-e84.pages.dev
Branch Preview URL: https://cloud-v1-mobile-ripout.augmentos-e84.pages.dev

View logs

@aisraelov aisraelov merged commit 405fd66 into dev Jul 11, 2026
29 of 30 checks passed
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.

2 participants