Skip to content

add auto update#203

Merged
Kitenite merged 5 commits into
mainfrom
pearl-peak-95
Dec 1, 2025
Merged

add auto update#203
Kitenite merged 5 commits into
mainfrom
pearl-peak-95

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Dec 1, 2025

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes

Summary by CodeRabbit

  • New Features

    • Desktop (macOS) now checks for updates automatically, downloads in background, and installs on quit; app publishes an auto-update manifest.
  • Documentation

    • Streamlined desktop release guide with a quick-start script; explains draft vs. auto-publish flows and an Auto-update section.
  • Chores

    • Release pipeline now fails when expected artifacts are missing; added auto-update support dependency and script-driven publish options.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
website Ready Ready Preview Comment Dec 1, 2025 5:25am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 1, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds macOS auto-update support (electron-updater) invoked at app startup with hourly checks; updates desktop release automation to upload an auto-update manifest (latest-mac.yml), tighten artifact-not-found behavior in CI, and add a --publish option to the release script and docs.

Changes

Cohort / File(s) Summary
Auto-update implementation
apps/desktop/src/main/lib/auto-updater.ts, apps/desktop/src/main/index.ts, apps/desktop/package.json
New setupAutoUpdater() module added and imported into app startup; configures electron-updater for non-dev macOS builds (auto-download, install-on-quit, prevent downgrades), logs update events, triggers immediate check on ready and schedules hourly checks. electron-updater@6 dependency added.
Release script & docs
apps/desktop/create-release.sh, apps/desktop/RELEASE.md
create-release.sh gains optional --publish flag to control auto-publishing vs. draft releases and adjusts messaging/links; RELEASE.md simplified and rewritten to document the new script-driven flow and auto-update manifest usage.
CI workflow change
.github/workflows/release-desktop.yml
Adds an "Upload auto-update manifest" artifact step publishing apps/desktop/release/latest-mac.yml as desktop-mac-update-manifest; narrows ZIP path to apps/desktop/release/*-mac.zip; adds if-no-files-found: error to DMG, ZIP, and manifest upload steps.
Electron builder config
apps/desktop/electron-builder.ts
Replaces publish: null with a GitHub publish config (provider: "github", owner: "superset-sh", repo: "superset") to enable GitHub-based publishing/manifest generation.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant App as Desktop App (main)
participant AU as electron-updater (autoUpdater)
participant GH as GitHub Releases / Manifest host
note over App,AU: App startup
App->>AU: setupAutoUpdater()
AU->>GH: fetch feed (latest-mac.yml)
alt update available
GH-->>AU: manifest + artifact URL
AU->>App: update-available (log)
AU->>AU: download update (auto-download)
AU->>App: update-downloaded (log)
App->>App: install on quit (auto-install-on-quit)
else no update
GH-->>AU: no update
AU->>App: update-not-available (log)
end
note over AU: hourly recurring checks (timer unref)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Review apps/desktop/src/main/lib/auto-updater.ts for correct electron-updater config, event handling, error logging, and timer unref usage.
  • Verify startup ordering in apps/desktop/src/main/index.ts to ensure checks occur after app readiness and do not run in dev.
  • Confirm .github/workflows/release-desktop.yml artifact paths, names, and if-no-files-found: error behavior match actual produced files.
  • Inspect apps/desktop/create-release.sh branching and usage of --publish to ensure CI interactions and user messaging are correct.
  • Check apps/desktop/electron-builder.ts publish config aligns with repo ownership and manifest generation expectations.

Possibly related PRs

  • release setup #131 — Modifies the desktop release workflow and docs; likely overlaps with CI artifact and manifest handling.
  • create release script #144 — Introduced earlier release automation and electron-builder changes; strongly related to the updated release script and publish configuration.

Poem

🐰 Hopping through manifests bright and new,
I peek for updates, once and hourly too,
A tiny YML points to apples to fetch,
Drafts turn to tags when the script does its stretch,
Hop—release done, and updates jump through! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is completely empty except for the template placeholder comments; no substantive content, implementation details, testing information, or related issues are provided. Fill out all required sections including a clear description of changes, type of change selection, testing steps, and relevant issue links to adequately document this feature addition.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'add auto update' is vague and generic, lacking specificity about what auto-update feature is being added or which component it affects. Clarify the title with more specifics, e.g., 'Add electron auto-updater for desktop app' or 'Implement auto-update mechanism for macOS releases'.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c34f250 and 13e3fe8.

📒 Files selected for processing (3)
  • .github/workflows/release-desktop.yml (1 hunks)
  • apps/desktop/RELEASE.md (1 hunks)
  • apps/desktop/electron-builder.ts (1 hunks)

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
apps/desktop/src/main/index.ts (1)

5-48: Good integration point; consider guarding auto-updater setup

Importing and calling setupAutoUpdater() after app.whenReady() and the main window setup looks solid and lines up with the main-process responsibilities.

To match the robustness of the setupAgentHooks() block, you might optionally wrap setupAutoUpdater() in a try/catch so a misconfigured feed or updater issue can’t crash the main process on startup, e.g.:

   try {
     setupAgentHooks();
   } catch (error) {
     console.error("[main] Failed to set up agent hooks:", error);
     // App can continue without agent hooks, but log the failure
   }

-  await makeAppSetup(() => MainWindow());
-  setupAutoUpdater();
+  await makeAppSetup(() => MainWindow());
+  try {
+    setupAutoUpdater();
+  } catch (error) {
+    console.error("[main] Failed to set up auto-updater:", error);
+  }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fcc7e07 and 16ba414.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • .github/workflows/release-desktop.yml (1 hunks)
  • apps/desktop/RELEASE.md (1 hunks)
  • apps/desktop/package.json (1 hunks)
  • apps/desktop/src/main/index.ts (2 hunks)
  • apps/desktop/src/main/lib/auto-updater.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
apps/desktop/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

For Electron interprocess communication, ALWAYS use tRPC as defined in src/lib/trpc

Files:

  • apps/desktop/src/main/lib/auto-updater.ts
  • apps/desktop/src/main/index.ts
apps/desktop/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

apps/desktop/**/*.{ts,tsx}: Please use alias as defined in tsconfig.json when possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary

Files:

  • apps/desktop/src/main/lib/auto-updater.ts
  • apps/desktop/src/main/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Avoid using any type - use explicit types instead for type safety
Use camelCase for variable and function names following existing codebase patterns
Keep diffs minimal with targeted edits only - avoid unnecessary changes when making modifications
Follow existing patterns and match the codebase style when writing new code

Files:

  • apps/desktop/src/main/lib/auto-updater.ts
  • apps/desktop/src/main/index.ts
apps/desktop/src/main/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Node.js modules (fs, path, os, net, etc.) can be used in main process code only

Files:

  • apps/desktop/src/main/lib/auto-updater.ts
  • apps/desktop/src/main/index.ts
apps/desktop/src/main/index.ts

📄 CodeRabbit inference engine (AGENTS.md)

Load .env file with override: true at the start of the main process before any imports

Files:

  • apps/desktop/src/main/index.ts
🧬 Code graph analysis (2)
apps/desktop/src/main/lib/auto-updater.ts (1)
apps/desktop/src/shared/constants.ts (2)
  • ENVIRONMENT (1-3)
  • PLATFORM (5-9)
apps/desktop/src/main/index.ts (1)
apps/desktop/src/main/lib/auto-updater.ts (1)
  • setupAutoUpdater (9-61)
🪛 LanguageTool
apps/desktop/RELEASE.md

[uncategorized] ~79-~79: The official name of this software platform is spelled with a capital “H”.
Context: ... or delete the stable copies created in .github/workflows/release-desktop.yml. 4. If y...

(GITHUB)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build
🔇 Additional comments (1)
apps/desktop/package.json (1)

59-59: No changes needed; electron-updater v6 is compatible with Electron 39.1.2.

The version "6" is compatible with Electron 39.1.2 and is actively maintained. The shorthand notation allows patch and minor version updates (equivalent to ^6.0.0), which is appropriate for production auto-update functionality. For consistency with other dependencies in this file, consider using "^6.0.0" instead, but this is optional.

Comment thread .github/workflows/release-desktop.yml
Comment thread apps/desktop/RELEASE.md Outdated
Comment on lines +68 to +82
## Auto-update

The desktop app checks for updates on macOS at launch (and every 6 hours) using the GitHub release tagged with the `desktop-v*.*.*` pattern. The workflow creates stable artifact names and uploads the auto-update manifest so the updater and direct download links always point to the latest build.

- Update manifest (macOS): `https://github.com/superset-sh/superset/releases/latest/download/latest-mac.yml`
- Update payload (macOS arm64 zip): `https://github.com/superset-sh/superset/releases/latest/download/Superset-arm64-mac.zip`
- Installer fallback: `https://github.com/superset-sh/superset/releases/latest/download/Superset-arm64.dmg`

To keep auto-update working:
1. Ship releases via the tag-based workflow so `releases/latest` advances.
2. Keep `latest-mac.yml` attached in the release (the workflow uploads it by default).
3. Do not rename or delete the stable copies created in `.github/workflows/release-desktop.yml`.
4. If you add another architecture, upload its auto-update manifest and create a stable copy for the zip so it has a `releases/latest/download/` URL.
5. macOS auto-update requires signed builds; ensure signing is configured when publishing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Align documented check interval with implementation

The docs say the app checks for updates “every 6 hours”, but UPDATE_CHECK_INTERVAL_MS in apps/desktop/src/main/lib/auto-updater.ts is currently 1 hour. Please update either the constant or this text so they match and avoid confusion.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~79-~79: The official name of this software platform is spelled with a capital “H”.
Context: ... or delete the stable copies created in .github/workflows/release-desktop.yml. 4. If y...

(GITHUB)

🤖 Prompt for AI Agents
In apps/desktop/RELEASE.md around lines 68 to 82, the documented auto-update
check interval ("every 6 hours") is inconsistent with the implementation;
UPDATE_CHECK_INTERVAL_MS in apps/desktop/src/main/lib/auto-updater.ts is set to
1 hour. Update one of them so they match: either change the prose in RELEASE.md
to "every 1 hour" (or "hourly") to reflect the current constant, or change
UPDATE_CHECK_INTERVAL_MS to 6 hours in apps/desktop/src/main/lib/auto-updater.ts
if the intended behavior is 6-hour checks; ensure the wording and the constant
use the same time unit and consider adding a short comment in the code linking
to RELEASE.md for future clarity.

Comment on lines +1 to +61
import { app } from "electron";
import { autoUpdater } from "electron-updater";
import { ENVIRONMENT, PLATFORM } from "shared/constants";

const UPDATE_CHECK_INTERVAL_MS = 1000 * 60 * 60 * 1; // 1 hour
const UPDATE_FEED_URL =
"https://github.com/superset-sh/superset/releases/latest/download";

export function setupAutoUpdater(): void {
if (ENVIRONMENT.IS_DEV || !PLATFORM.IS_MAC) {
return;
}

autoUpdater.autoDownload = true;
autoUpdater.autoInstallOnAppQuit = true;
autoUpdater.allowDowngrade = false;

autoUpdater.setFeedURL({
provider: "generic",
url: UPDATE_FEED_URL,
});

autoUpdater.on("error", (error) => {
console.error("[auto-updater] Error during update check:", error);
});

autoUpdater.on("update-available", (info) => {
console.info(
`[auto-updater] Update available: ${info.version}. Downloading...`,
);
});

autoUpdater.on("update-not-available", () => {
console.info("[auto-updater] No updates available");
});

autoUpdater.on("update-downloaded", (info) => {
console.info(
`[auto-updater] Update downloaded (${info.version}). Will install on quit.`,
);
});

const checkForUpdates = () =>
autoUpdater.checkForUpdatesAndNotify().catch((error) => {
console.error("[auto-updater] Failed to check for updates:", error);
});

const interval = setInterval(checkForUpdates, UPDATE_CHECK_INTERVAL_MS);
interval.unref();

if (app.isReady()) {
void checkForUpdates();
} else {
app
.whenReady()
.then(() => checkForUpdates())
.catch((error) => {
console.error("[auto-updater] Failed to start update checks:", error);
});
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -name "RELEASE.md" -o -name "tsconfig.json" | head -20

Repository: superset-sh/superset

Length of output: 309


🏁 Script executed:

if [ -f "apps/desktop/RELEASE.md" ]; then cat "apps/desktop/RELEASE.md"; fi

Repository: superset-sh/superset

Length of output: 5279


🏁 Script executed:

if [ -f "tsconfig.json" ]; then cat "tsconfig.json"; fi

Repository: superset-sh/superset

Length of output: 46


🏁 Script executed:

if [ -f "apps/desktop/tsconfig.json" ]; then cat "apps/desktop/tsconfig.json"; fi

Repository: superset-sh/superset

Length of output: 752


Update interval and documentation should be consistent; verify TypeScript configuration for setInterval typing

The structure and error handling are solid. Two items need attention:

  1. Interval mismatch: The code implements a 1-hour check interval (UPDATE_CHECK_INTERVAL_MS = 1000 * 60 * 60 * 1), but apps/desktop/RELEASE.md states "every 6 hours". Align these—either update the constant to 6 hours or update the documentation.

  2. TypeScript typing for setInterval: The apps/desktop/tsconfig.json doesn't include "node" in the lib array, which may cause setInterval().unref() to fail type checking. Either add "node" to the lib array in tsconfig or cast to NodeJS.Timeout as shown in the snippet above.

🤖 Prompt for AI Agents
In apps/desktop/src/main/lib/auto-updater.ts around lines 1 to 61, the update
interval constant currently sets a 1-hour check but RELEASE.md documents 6
hours, and the call to setInterval(...).unref() can fail TypeScript checks
because tsconfig.json does not include the "node" lib; either change
UPDATE_CHECK_INTERVAL_MS to 1000 * 60 * 60 * 6 to match the docs (or update
RELEASE.md to 1 hour) and fix typing by adding "node" to
apps/desktop/tsconfig.json lib array so setInterval returns NodeJS.Timeout, or
keep the current tsconfig and cast the setInterval result to NodeJS.Timeout
(store it in a variable) before calling unref().

- Release script now creates draft releases by default for review
- Added --publish flag to auto-publish when build completes
- Trimmed RELEASE.md to be concise and accurate
- Fixed code signing secret names in docs
- Removed .zip references (no longer used)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 16ba414 and 2cf436e.

📒 Files selected for processing (2)
  • apps/desktop/RELEASE.md (1 hunks)
  • apps/desktop/create-release.sh (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build - macOS (arm64)
🔇 Additional comments (5)
apps/desktop/create-release.sh (3)

56-80: ✓ Argument parsing handles both positional and flag arguments correctly.

The logic properly parses VERSION as the first positional arg and --publish as an optional flag, with appropriate error handling for unknown options. The implementation is resilient to flag position (users can pass flags before or after the version).


279-309: ✓ Conditional publish logic is sound.

The branching correctly implements two release modes: auto-publish (with gh release edit --draft=false) when the --publish flag is used, and draft-by-default otherwise. Both branches provide clear, helpful messaging to guide users through their chosen workflow.


7-9: ✓ Documentation accurately reflects the new release modes.

The usage examples and feature descriptions clearly communicate the draft-by-default behavior and the optional --publish flag for auto-publishing, helping users understand their options upfront.

Also applies to: 17-22

apps/desktop/RELEASE.md (2)

3-33: ✓ Quick Start provides clear, streamlined release process.

The condensed workflow with helpful examples and explicit mention of draft-by-default behavior sets proper expectations. The inclusion of both script-based and manual publish paths gives users flexibility.


55-76: ✓ Code Signing, Local Testing, and Troubleshooting sections are clear and helpful.

The reference information for secrets, build commands, and common issues is well-organized and should guide developers through local setup and troubleshooting effectively.

Comment thread apps/desktop/RELEASE.md
Comment on lines +46 to +53
## Auto-update

## Build Outputs
The app checks for updates at launch and every 6 hours using:

### macOS (arm64)
- `Superset-<version>-arm64.dmg` - DMG installer
- `Superset-<version>-arm64-mac.zip` - Zipped app bundle

## Troubleshooting
- **Manifest**: `https://github.com/superset-sh/superset/releases/latest/download/latest-mac.yml`
- **Installer**: `https://github.com/superset-sh/superset/releases/latest/download/Superset-arm64.dmg`

### Build fails on macOS
The workflow creates stable-named copies (without version) so these URLs always point to the latest build.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

rg -n 'UPDATE_CHECK_INTERVAL_MS' apps/desktop/src/main/lib/auto-updater.ts -A 2 -B 2

Repository: superset-sh/superset

Length of output: 407


Correct auto-update interval documentation from 6 hours to 1 hour.

Line 48 states the app checks for updates "every 6 hours," but the implementation in apps/desktop/src/main/lib/auto-updater.ts uses UPDATE_CHECK_INTERVAL_MS = 1000 * 60 * 60 * 1 which equals 1 hour. Update the documentation to reflect the actual interval.

🤖 Prompt for AI Agents
In apps/desktop/RELEASE.md around lines 46 to 53, the documentation wrongly
states the app checks for updates "every 6 hours" while the actual
implementation uses a 1-hour interval; update the sentence to read "every 1
hour" (or "every hour") and ensure any adjacent wording or bullet points reflect
the 1-hour interval to match UPDATE_CHECK_INTERVAL_MS in
apps/desktop/src/main/lib/auto-updater.ts.

Setting publish: null prevented latest-mac.yml from being generated.
The github provider generates the manifest for auto-update while the
workflow handles the actual release upload.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2cf436e and c34f250.

📒 Files selected for processing (1)
  • .github/workflows/release-desktop.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build - macOS (arm64)
  • GitHub Check: Build
🔇 Additional comments (2)
.github/workflows/release-desktop.yml (2)

89-95: Verify that the auto-update manifest is generated and is not per-architecture.

The new manifest upload expects a single apps/desktop/release/latest-mac.yml file. Unlike the DMG and ZIP uploads (lines 76, 84) which include ${{ matrix.arch }} in the artifact name, the manifest upload uses a static name desktop-mac-update-manifest (line 92).

If electron-builder generates per-architecture manifests (e.g., latest-mac-arm64.yml, latest-mac-x64.yml), only the last one will be retained in GitHub Artifacts. Verify:

  1. Whether latest-mac.yml is a single unified manifest or per-architecture
  2. If per-architecture, the artifact name should include ${{ matrix.arch }} to avoid conflicts
  3. Whether the release job (line 140) properly consumes this manifest artifact

Also confirm that the manifest is actually generated during the bun run package step (line 70).


73-95: Artifact upload strategy addresses past critical review.

The previous review flagged that ZIP artifacts were missing from the workflow. This PR now adds:

  • ZIP artifact upload with arch-specific naming and strict validation (lines 81–87)
  • Auto-update manifest upload with strict validation (lines 89–95)
  • Consistent if-no-files-found: error across all artifact uploads for early failure detection

This approach ensures the build fails fast if required release artifacts are not generated, preventing incomplete releases.

Comment thread .github/workflows/release-desktop.yml
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