Skip to content

Add nightly build support#3623

Open
wojtekn wants to merge 3 commits into
trunkfrom
add-nightly-build-support
Open

Add nightly build support#3623
wojtekn wants to merge 3 commits into
trunkfrom
add-nightly-build-support

Conversation

@wojtekn
Copy link
Copy Markdown
Contributor

@wojtekn wojtekn commented May 26, 2026

Related issues

How AI was used in this PR

Claude helped implement the changes. All code was reviewed and iterated on by the author.

Proposed Changes

  • Enable automatic update polling for dev builds — previously dev builds had polling disabled entirely; manual "Check for Updates" already worked but nothing fired automatically
  • 24-hour TTL for nightly update checks — timestamp stored in app.json (lastNightlyUpdateCheck) so the check fires at most once per day rather than on every launch
  • buildUpdateFeedUrl({ channel? }) — extracted helper replacing the duplicated inline URL construction in setupUpdates and pollLinuxUpdates; adds optional channel param support
  • switchToNightlyAndUpdate() — exported from updates.ts; points autoUpdater at ?channel=nightly feed and triggers an immediate check, letting Electron's existing update flow handle download and the restart prompt. On Linux, calls pollLinuxUpdates({ channel: 'nightly' }) directly
  • maybePromptNightlySwitch() — detects signed-in Automatticians on stable builds via /rest/v1.2/read/teams, shows a one-time prompt offering to switch to nightly with a "Don't ask again" checkbox. On accept, calls switchToNightlyAndUpdate() directly — no manual download needed
  • Hourly pollerstartNightlyPromptPoller() re-runs the check every hour to catch users who sign in after launch
CleanShot 2026-05-26 at 18 51 44@2x

Testing Instructions

This PR requires sandboxing against 220097-ghe-Automattic/wpcom for the channel=nightly endpoint support.

To test with the sandbox:

  1. Build a stable Studio build and sign in with an Automattician account
  2. Point the update endpoint to the sandbox host
  3. On launch, the nightly prompt dialog should appear
  4. Accepting should trigger an immediate update to the latest nightly build via the normal Electron update flow (download in background → restart prompt)
  5. Declining with "Don't ask again" checked should suppress the dialog on subsequent launches
  6. Declining without "Don't ask again" should re-prompt on next launch

To test nightly auto-update polling:

  1. Install a nightly (dev) build
  2. Verify update check fires on launch if >24h since last check (lastNightlyUpdateCheck in ~/.studio/app.json)
  3. Verify update check is skipped and scheduled for the remaining time if <24h since last check

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

- Enable automatic update polling for dev/nightly builds (previously disabled)
- Add 24-hour TTL for nightly update checks stored in app.json to avoid
  checking on every launch
- Extract buildUpdateFeedUrl() helper and add channel param support so
  the nightly channel can be requested from the update endpoint
- Add maybePromptNightlySwitch() which detects signed-in Automatticians
  on stable builds and offers a one-time prompt to switch to nightly,
  with a "Don't ask again" option
- On accepting, switchToNightlyAndUpdate() points autoUpdater at the
  nightly channel feed and triggers an immediate update using the
  existing Electron update flow
- Add hourly poller to catch users who sign in after app launch
@wojtekn wojtekn changed the title Add nightly build support for Automatticians Add nightly build support May 26, 2026
@wpmobilebot
Copy link
Copy Markdown
Collaborator

wpmobilebot commented May 26, 2026

📊 Performance Test Results

Comparing 85e4621 vs trunk

app-size

Metric trunk 85e4621 Diff Change
App Size (Mac) 1337.93 MB 1337.94 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 85e4621 Diff Change
load 1794 ms 1776 ms 18 ms ⚪ 0.0%

site-startup

Metric trunk 85e4621 Diff Change
siteCreation 9093 ms 9529 ms +436 ms 🔴 4.8%
siteStartup 4392 ms 4386 ms 6 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@wojtekn wojtekn requested review from a team and sejas May 28, 2026 12:36
Copy link
Copy Markdown
Member

@gcsecsey gcsecsey left a comment

Choose a reason for hiding this comment

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

This looks good to me and works well. 👍

To test this, I did these steps:

  • update the version number in apps/studio/package.json and apps/cli/package.json to 1.0.9
  • run npm i
  • apply this patch:
diff --git a/apps/studio/src/lib/nightly-prompt.ts b/apps/studio/src/lib/nightly-prompt.ts
index 2246b7dc1..f262f4911 100644
--- a/apps/studio/src/lib/nightly-prompt.ts
+++ b/apps/studio/src/lib/nightly-prompt.ts
@@ -37,7 +37,7 @@ async function isAutomattician(): Promise< boolean > {
  * - Skipped if the user is not authenticated or not an Automattician.
  */
 export async function maybePromptNightlySwitch(): Promise< void > {
-       if ( process.env.E2E || ! app.isPackaged ) {
+       if ( process.env.E2E ) {
                return;
        }

(END)
  • start the app

Then, when logged in with an a11n account, I get the prompt as described:

Image

When using a non-a11n account, I don't get the prompt:

Image

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.

3 participants