Skip to content

feat(desktop): "Relaunch now" on the v1→v2 flip notice - #7486

Closed
Kitenite wants to merge 2 commits into
mainfrom
flip-notice-relaunch
Closed

Kitenite wants to merge 2 commits into
mainfrom
flip-notice-relaunch

Conversation

@Kitenite

@Kitenite Kitenite commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

Why

The auto-migration flips a machine to v2 on its next launch. As of 12 Sep, 227 people have completed the gate and are still on v1 because they have not relaunched; some run the app for days. The notice already tells them "Everything comes along on your next launch" and then gives them nothing to click. See the status page, decision 1.

What changes

  • FlipNoticeCard takes an optional primary action; when present the dismiss cta renders as the secondary button. The post-flip welcome card is unchanged.
  • V1FlipNotice offers Relaunch now (primary) and Later (dismiss). Relaunch tracks v1_flip_notice_relaunch, then calls a new settings.relaunchApp procedure.
  • relaunchApp is app.relaunch() + quitApp(), the normal quit path with cleanup, not the existing unused restartApp, which bypasses before-quit via app.exit(0).
  • "Relaunch now" added to the catalogs and translated in all 16 locales, matching each locale's existing "Restart" wording. "Later" already existed. bun run check:i18n passes.

Verification

  • New V1FlipNotice.test.tsx (happy-dom + testing-library, real clicks): hidden until completion; shows on completion and tracks shown; Relaunch calls the procedure once and tracks relaunch; Later dismisses without relaunching. Queries are render-bound because the module-level screen can be bound to the shared mock document by an earlier suite.
  • bun test in apps/desktop: 3768 pass, 0 fail. tsc --noEmit clean. Biome clean.

Independent of #7480 (no overlapping files).

https://claude.ai/code/session_016NkfQLLDdHvrPS1BRJtfhj


Summary by cubic

Adds a "Relaunch now" action to the v1→v2 flip notice so users who completed the migration gate can relaunch immediately instead of waiting for their next app launch.

  • Relaunching checks for a staged update first: when one is pending, it installs it so the updater restarts into the new version; otherwise it runs app.relaunch() + quitApp(), so cleanup and DB flushes still run. The unused restartApp bypasses before-quit via app.exit(0).
  • The notice tracks v1_flip_notice_relaunch; the dismiss button is relabeled "Later" and keeps the existing v1_flip_notice_dismissed tracking.
  • FlipNoticeCard accepts an optional primary action; when present the dismiss CTA renders as secondary. The post-flip welcome card is unchanged.
  • Adds unit tests for the relaunch logic and V1FlipNotice behavior; "Relaunch now" is translated in all 16 locales.

Written for commit c70f812. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features
    • Added a “Relaunch now” option to the migration notice, which installs a ready update or restarts the app when no update is ready.
    • Added a “Later” option to dismiss the notice without restarting.
    • The app follows its normal shutdown process before restarting.
  • Localization
    • Added translations for the relaunch action across supported languages.

@coderabbitai

coderabbitai Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 602f92d3-c04c-4e97-a6cd-21db2b3f6e76

📥 Commits

Reviewing files that changed from the base of the PR and between 2adbc17 and c70f812.

📒 Files selected for processing (3)
  • apps/desktop/src/lib/trpc/routers/settings/index.ts
  • apps/desktop/src/main/lib/relaunch-app.test.ts
  • apps/desktop/src/main/lib/relaunch-app.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The V1 migration notice now has a translated “Relaunch now” action and a “Later” dismissal action. The settings router delegates relaunch handling to update-aware logic. Tests cover notice visibility, tracking, relaunch, and dismissal.

Changes

V1 Flip Relaunch

Layer / File(s) Summary
Update-aware relaunch
apps/desktop/src/main/lib/relaunch-app.ts, apps/desktop/src/main/lib/relaunch-app.test.ts, apps/desktop/src/lib/trpc/routers/settings/index.ts
The settings mutation delegates to relaunchApp. If an update is ready, the helper installs it and returns. Otherwise, it relaunches the app and then quits. Tests cover both paths.
Notice action and translations
apps/desktop/src/renderer/routes/_authenticated/components/V1FlipNotice/..., packages/i18n/locales/*/messages.po
Adds an optional primary card action and connects “Relaunch now” to the settings mutation. Changes the dismissal label to “Later” and adds translations for the relaunch action.
Notice interaction tests
apps/desktop/src/renderer/routes/_authenticated/components/V1FlipNotice/V1FlipNotice.test.tsx
Tests migration visibility, analytics tracking, relaunch behavior, and dismissal behavior.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant V1FlipNotice
  participant electronTrpcClient
  participant settingsRouter
  participant relaunchApp
  participant UpdateInstaller
  participant ElectronApp
  participant quitApp
  User->>V1FlipNotice: Clicks "Relaunch now"
  V1FlipNotice->>electronTrpcClient: relaunchApp.mutate()
  electronTrpcClient->>settingsRouter: Invoke relaunchApp
  settingsRouter->>relaunchApp: Pass update and relaunch callbacks
  relaunchApp->>UpdateInstaller: Check readiness
  alt Update ready
    relaunchApp->>UpdateInstaller: installUpdate()
  else Update not ready
    relaunchApp->>ElectronApp: relaunch()
    relaunchApp->>quitApp: quit()
  end
  settingsRouter-->>electronTrpcClient: Return success
Loading

Merge Risk: ⚪ Minimal · up to c70f8

The relaunch paths have no identified issue requiring a fix before merge.

Security Architecture Review

Security architecture risk: 🔵 Low · up to c70f8

The new button uses existing desktop relaunch and update capabilities. The application, rather than the button, decides whether an update is ready. No new security exposure was established, but caller restrictions and some failure behavior remain unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The evidenced sensitive outcome is control of the local desktop process’s restart or staged-update handoff. The mutation accepts no update identifier or other caller-supplied input, and readiness is decided in the main process. Wider service, tenant or remote reachability was not established.

Trust Boundaries and Controls

  • observed — The notice crosses from renderer to main through Electron tRPC. Its authenticated UI location is not a procedure-level authorization check; sender enforcement inside the IPC transport remains unverified. Existing public restart and install routes are counterevidence to newly introduced authority over those operations.

Resilience and Maintainability Implications

  • observed — The updater prevents duplicate installation attempts, while normal quit runs the established cleanup sequence. These controls do not establish recovery from a synchronous installer or relaunch exception.

Hardening Proposals

  • proposed — Document or enforce the trusted-window requirement for lifecycle and update IPC procedures at the transport or procedure boundary. This would close the caller-authority uncertainty; the inspected code does not establish that this PR introduced the underlying exposure.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title uses conventional commit format and clearly describes the primary change: adding a “Relaunch now” action to the v1→v2 flip notice.
Description check ✅ Passed The description clearly explains the motivation, implementation, testing, localization changes, and validation results. It uses different headings from the template and omits the checklist, but it pro…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@expo

expo Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

No installed development build can load this pull request as an update: its native fingerprint is 63273df0c28c and no development build has it. Add the mobile-build label to build one.

@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

@Kitenite

Copy link
Copy Markdown
Member Author

Dev-app verification over CDP, with one gap to close before merge.

Verified: the notice renders with Relaunch now (primary) and Later; a real click on Relaunch now quits through the graceful path (all three host-services log shutdown (SIGTERM), draining connections), and a second Electron instance spawns 0.4 s later in its own process group, acquires the single-instance lock, and starts its browser bridge.

Not verified: that relaunched instance exits within about a second in dev, both under turbo and with electron-vite run directly, and its main.log ends at the browser-bridge line with no error. So the landing on v2 after the relaunch is unobserved. Needs one run in a packaged build, or a dev main with logging around the early exit, before this merges.

Screenshots and the session write-up: https://app.superset.sh/page/v1-v2-migration-day-12-september-br7w3x

The flip lands on the next launch, and 227 people have completed the gate
and are still on v1 waiting for one. The notice already says so; now it
offers the relaunch. The button goes through the normal quit path
(app.relaunch + quitApp) so cleanup and DB flushes run, unlike the
unused restartApp which bypasses before-quit. "Later" keeps the old
dismiss. Fires v1_flip_notice_relaunch so the funnel can count it.

The card gets an optional primary action; the post-flip welcome card is
unchanged. "Relaunch now" is translated in all 16 locales.

Rebased on main after #7480, whose optInV2 pin holds the surface on v1
until relaunch; the relaunch is exactly that relaunch, so the two compose
with no code change.

The relaunched instance only dies in dev: electron-vite exits with the old
Electron (ps.on('close', process.exit)), taking the renderer dev server
with it, and the new instance's dev-only parent-exit poll quits it within
a second. A production build relaunches, stays up, and lands on v2 with
the welcome card.

Claude-Session: https://claude.ai/code/session_016NkfQLLDdHvrPS1BRJtfhj

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Kitenite

Kitenite commented Sep 26, 2026 •

Copy link
Copy Markdown
Member Author

Closing the gap from the 12 Sep dev-app verification: "the relaunched instance exits within about a second in dev, so the landing on v2 is unobserved."

Why it died in dev (harness only, not the feature). Two dev-only mechanisms:

  • electron-vite runs ps.on('close', process.exit), so the runner exits when the old Electron quits and takes the renderer dev server with it.
  • The relaunched Electron is reparented to launchd. Its installDevRunnerExit poll (dev only, DEV_PARENT_POLL_MS = 1000) sees the original parent gone and quits it. That matches the ~1 s exit, both under turbo and with electron-vite run directly.

Neither runs in a packaged app: NODE_ENV is baked to production.

Observed landing, production build. Setup: electron-vite build with NODE_ENV=production, launched with an isolated SUPERSET_HOME_DIR and --user-data-dir against the worktree's local API, signed in, CDP on the page.

  1. Opted out of v2 (optInV2=false), so the v1 surface showed. Wrote the completion marker and fired v1-migration-completed as a stand-in for a finished pass. The notice appeared with Relaunch now / Later, and the surface held on v1 (fix(desktop): stop stale repos and stale ledger rows from stranding v1 users on v1 #7480's pin).
  2. Clicked Relaunch now with real CDP mouse input.
  3. The old main process exited. A new main process spawned in the same second (ppid 1), stayed up (checked at 54 s and 4.5 min), rendered the v2 surface with "Welcome to the new Superset", and consumed the continuity flag. No reload was involved.
  4. In the second run the markers were written less than 1 s before the click and still survived the quit and relaunch.

A first run came up blank after the relaunch. The cause was my local API missing the newer SANDBOX_GATE_* / VERCEL_SANDBOX_* env: tRPC returned 500 and CollectionsProvider waited forever. A plain reload was blank as well, so the relaunch wasn't involved. With those env vars set, the same relaunched process rendered v2, and run 2 above was clean end to end.

Branch. Rebased on main (#7480, #7514, #7649 etc.) with no conflicts and no code change. #7480's optInV2AtCompletion pin is what keeps the surface on v1 until this relaunch, so the two compose. In apps/desktop: bun run typecheck passes, biome check on the touched dirs is clean, bun test passes (V1FlipNotice, settings router, dev-runner-exit, quit-sequence, v1-migration: 149 pass, 0 fail), and bun run check:i18n is clean.


Update (c70f812): the pending-update race was real, and it's fixed.

Reproduction. Two packaged builds (1.30.2 and 1.30.3) from this branch, signed with a throwaway self-signed identity so Squirrel.Mac accepts the update. Both designated requirements are identifier "com.superset.relaunchprobe" and certificate leaf = H"c01d…". The feed URL was patched locally to point at a localhost feed (latest-mac.yml plus the zip) and reverted before committing. 1.30.2 downloaded 1.30.3 and Squirrel staged it (ShipItState.plist: launchAfterInstallation: false, the auto-install-on-quit state a real user sits in). Then I clicked Relaunch now with real CDP input.

  • Before the fix: at 11:44:53 the old main quit and app.relaunch() started a new main in the same second from the still-1.30.2 bundle. main.log: Initialized: version=1.30.2 at 11:44:54.091. ShipIt logged Installation completed successfully at 11:44:55.420, swapping 1.30.3 in underneath the running process. The relaunched 1.30.2 then logged Update available: 1.30.2 → 1.30.3, downloaded it again, and started a second ShipIt waiting for the next quit. The user comes back on the old version, running old code from a swapped bundle, and has to quit again to get the update. The v1→v2 flip itself still landed.
  • After the fix: the same setup and click. No old-bundle relaunch. ShipIt got launchAfterInstallation: true, installed at 11:52:08, and relaunched the app at 11:52:14. main.log: Initialized: version=1.30.3, Updated: 1.30.2 → 1.30.3, and no re-download. The first boot landed on v2: continuity flag consumed, welcome card showing.

(Use main.log's app.getVersion() for the version. The renderer's window.App.appVersion is baked in at compile time, and both packages shared one dist.)

Fix. settings.relaunchApp now calls relaunchApp() (main/lib/relaunch-app.ts). With an update staged (isUpdateReadyToInstall()), it calls the existing installUpdate() → autoUpdater.quitAndInstall(false, true), which quits through before-quit (graceful host-service shutdown; runQuitCleanup already has the update-install branch) and restarts into the new version. Otherwise it runs app.relaunch() + quitApp() as before. relaunch-app.test.ts covers both branches, and the staged-update test fails against the old always-relaunch behaviour.

Re-run on c70f812. In apps/desktop: typecheck passes; biome is clean; bun test passes (V1FlipNotice, settings, relaunch-app, dev-runner-exit, quit-sequence, v1-migration: 151 pass, 0 fail); check:i18n is clean. I also re-ran the production-build relaunch journey with no update staged: a new main process started (parent launchd), stayed up, and landed on v2 with the welcome card.

Isolation. Test builds were packaged with appId=com.superset.relaunchprobe, so they get their own ShipIt job, cache and updater cache (updaterCacheDirName in app-update.yml). A wrapper main (probe-entry.js) hard-set userData, sessionData and the logs path, set the app name, and set SUPERSET_HOME_DIR to scratch dirs. That held even for ShipIt's relaunch, which passes no argv or env. The unpackaged runs used SUPERSET_HOME_DIR and --user-data-dir in scratch. Every build used a throwaway vite config that deleted SENTRY_AUTH_TOKEN and the Sentry DSNs after the .env load; build logs show no upload. The signing keychain lived in scratch and was on the user search list only while codesign ran, then deleted. The probe's caches and logs were removed afterwards.

With an update downloaded, quitting hands the install to Squirrel.Mac
(autoInstallOnAppQuit), and app.relaunch() started the old bundle in the
same second. Reproduced with two locally signed builds and a localhost
feed: the relaunched process came up as 1.30.2 about 1.3s before ShipIt
finished swapping in 1.30.3 beneath it, then found 1.30.3 again,
re-downloaded it and staged a second install for the next quit.

Relaunch now routes through installUpdate() when an update is staged, so
Squirrel restarts into the new version (1.30.3, "Updated: 1.30.2 →
1.30.3", no re-download). The quit still runs before-quit cleanup. With
no staged update it relaunches as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Kitenite

Copy link
Copy Markdown
Member Author

Closing. Anyone who could see this button is already on a build that contains it, and any quit (including installing an update) flips a gated user anyway. Data on 2026-09-26: the 210 gated-but-not-relaunched users have a median wait of 1.6 days (max 6.5), and 90% of devices flip within ~8 days of their gate on their own. Not worth the extra surface. The staged-update relaunch race found while verifying this only exists with this button, so it closes with it. Branch kept (flip-notice-relaunch, c70f812) if we want it later.

@Kitenite Kitenite closed this Sep 27, 2026

This branch was previously deployed

1 inactive deployment
preview — c70f812e Deployed Sep 26, 2026 by Kitenite via Deploy Marketing #10454
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.

1 participant