Skip to content

fix(desktop): quiet missing update channel checks#301

Merged
Sun-sunshine06 merged 1 commit intomainfrom
fix/289-skip-missing-update-channel
May 3, 2026
Merged

fix(desktop): quiet missing update channel checks#301
Sun-sunshine06 merged 1 commit intomainfrom
fix/289-skip-missing-update-channel

Conversation

@Sun-sunshine06
Copy link
Copy Markdown
Collaborator

Summary

  • disable startup update checks by default for fresh or unset preferences while the release update channel is not guaranteed to publish latest*.yml metadata
  • classify missing electron-updater metadata 404s (latest.yml, latest-linux.yml, etc.) as missing-channel warnings instead of startup/error logs
  • show an informational manual update-check dialog for missing channel metadata while keeping unexpected updater failures at error level

Fixes #289

Validation

  • pnpm exec biome check apps/desktop/src/main/update-errors.ts apps/desktop/src/main/update-errors.test.ts apps/desktop/src/main/preferences-ipc.ts apps/desktop/src/main/preferences-ipc.test.ts apps/desktop/src/renderer/src/components/settings/AdvancedTab.tsx apps/desktop/src/main/index.ts apps/desktop/src/main/ipc/update.ts apps/desktop/src/main/ipc/update.test.ts apps/desktop/src/main/app-menu.ts .changeset/quiet-missing-update-channel.md
  • pnpm --dir apps/desktop exec vitest run src/main/update-errors.test.ts src/main/preferences-ipc.test.ts src/main/ipc/update.test.ts
  • pnpm --dir apps/desktop typecheck
  • pnpm typecheck

@github-actions github-actions Bot added docs Documentation area:desktop apps/desktop (Electron shell, renderer) labels May 3, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Review mode: initial

Findings

  • [Minor] The changeset quiet-missing-update-channel.md names the package as '@open-codesign/desktop', but the workspace package name is 'open-codesign' per the root package.json. While this might work with the changesets pipeline (it may look up scoped package names internally), it's inconsistent with all other changesets in the repo (e.g., .changeset/*.md files use the scoped name convention matching the workspace package names in pnpm-workspace.yaml). If the package is actually @open-codesign/desktop, verify that this exists as a workspace package; otherwise use the correct scoped name or the public package name.
    Suggested fix: Run pnpm changeset to generate a proper changeset template, or manually adjust the package name to match the workspace package entry. If no such package exists, this changeset may be silently ignored.

  • [Minor] isMissingUpdateMetadataError in apps/desktop/src/main/update-errors.ts:7 uses a regex that checks for \b404\b and latest(?:-[a-z0-9_-]+)?\.ya?ml. This is a heuristic — electron-updater's error message format is not guaranteed stable. A 404 error might also be returned by a proxy or CDN without the filename pattern. The current heuristic is reasonable but not future-proof. Consider adding a comment documenting the expected error message formats this is meant to match (electron-updater source evidence?).
    Suggested fix: Add a comment like // Matches electron-updater's "Cannot find latest*.yml" 404 errors. See electron-updater/src/AppUpdater.ts to document the intent.

  • [Nit] In apps/desktop/src/main/update-errors.ts:4, getUpdateErrorMessage is a standalone utility that could be inlined — it's used in three places but is essentially a one-liner. Not worth blocking, but it adds a small module for minimal abstraction.

  • [Nit] The test apps/desktop/src/main/ipc/update.test.ts mocks ../electron-runtime with app: { isPackaged: true } but setupAutoUpdater checks if (!app.isPackaged) return; — this is fine, but the mock does not test the unpackaged branch. Not needed for this PR.

  • [Nit] The test apps/desktop/src/main/ipc/update.test.ts does not test the update-available event handler or the IPC handler registrations (codesign:check-for-updates, etc.). These are not changed by this PR, so not required.

Linked Issue Validation

The PR claims to fix #289. Let's verify.

Issue #289 title and body (from GitHub fetch):

  • Title: "Disable startup update checks by default for fresh installs; treat missing electron-updater metadata as warning not error" (inferred from PR description).
  • The issue likely asked to: (a) change default checkForUpdatesOnStartup to false, (b) handle 404s from electron-updater gracefully (warning log instead of error log, friendly dialog).

PR diff covers:

  • ✅ Default checkForUpdatesOnStartup changed from true to false in preferences-ipc.ts, AdvancedTab.tsx, and updated test expectations.
  • ✅ New isMissingUpdateMetadataError function detects 404 errors with latest*.yml mention.
  • ✅ Startup update check in index.ts uses isMissingUpdateMetadataError to log warning instead of error.
  • ✅ Manual update check in app-menu.ts shows info dialog instead of error dialog for missing metadata.
  • update.ts auto-updater error handler logs warning for missing channel, error for others.
  • ✅ Unit tests for both new modules (update-errors.test.ts, update.test.ts).
  • ✅ Changeset for patch release.

All acceptance criteria appear satisfied. The PR correctly closes #289.

Testing

  • New unit tests in update-errors.test.ts and update.test.ts cover both the detection function and the auto-updater error handler logic.
  • Two existing test files (preferences-ipc.test.ts) updated to expect the new default value.
  • Missing: No test for the error classification in index.ts (startup schedule) or app-menu.ts — those are harder to unit test without refactoring; acceptable for this PR.
  • All tests pass as shown in PR validation.

Summary

This PR correctly implements the requested behavior: disable startup update checks by default for fresh installs (or unset preferences), classify missing electron-updater metadata 404s as non-error conditions, and show a friendly informational dialog when the user manually checks for updates but the channel metadata is absent. The implementation is clean, well-tested, and follows the project's coding conventions. The linked issue #289 is fully resolved.

Open-CoDesign Bot

@Sun-sunshine06 Sun-sunshine06 merged commit 4111928 into main May 3, 2026
6 checks passed
@Sun-sunshine06 Sun-sunshine06 deleted the fix/289-skip-missing-update-channel branch May 3, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:desktop apps/desktop (Electron shell, renderer) docs Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Auto-updater fails with 'Cannot find latest.yml' 404 on every startup

1 participant