Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/dev-suppress-update-notices.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@inkeep/open-knowledge-desktop": patch
---

Stop showing auto-update notices in unpackaged dev builds. A dev desktop app never downloads or installs updates, so the boot-time "Update to X didn't install" banner, the staged-update relaunch banner, and the "what's new" toast were all noise driven by stale local state. They're now gated on the same signal that gates update checks (`app.isPackaged`), with the `OK_UPDATER_FORCE_DEV` escape hatch preserved for the manual update smoke.
8 changes: 5 additions & 3 deletions packages/desktop/src/main/auto-updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ export function startAutoUpdater(opts: StartAutoUpdaterOpts): StartAutoUpdaterHa
});
}

const updatesEnabled = isPackaged || forceDevBypass;

const revertToGithubFeed = (cause: string): void => {
if (!usingProxyFeed || proxyFallbackTried) return;
proxyFallbackTried = true;
Expand Down Expand Up @@ -667,7 +669,7 @@ export function startAutoUpdater(opts: StartAutoUpdaterOpts): StartAutoUpdaterHa
running: currentVersion,
});
}
} else {
} else if (updatesEnabled) {
const next = { ...state, versionPendingInstall: attempted };
if (persistSafely(next, 'install-failed-on-boot')) {
state = next;
Expand Down Expand Up @@ -697,7 +699,7 @@ export function startAutoUpdater(opts: StartAutoUpdaterOpts): StartAutoUpdaterHa
{ ...state, lastSeenVersion: currentVersion },
'lastSeenVersion-advance',
);
if (advanced && shouldShowVersionNotice) {
if (advanced && shouldShowVersionNotice && updatesEnabled) {
const fireToastB = (): void => {
const releaseUrl = releaseUrlFor(currentVersion);
activeWhatsNew = { version: currentVersion, releaseUrl, firedAt: now().getTime() };
Expand Down Expand Up @@ -740,7 +742,7 @@ export function startAutoUpdater(opts: StartAutoUpdaterOpts): StartAutoUpdaterHa
scheduleNextCheck();
};

if (isPackaged || forceDevBypass) {
if (updatesEnabled) {
void updater
.checkForUpdates()
.then(() => {
Expand Down
1 change: 1 addition & 0 deletions packages/desktop/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2665,6 +2665,7 @@ function bootPrimaryInstance(): void {

app.on('browser-window-created', (_event, win) => {
win.webContents.once('did-finish-load', () => {
if (!(app.isPackaged || process.env.OK_UPDATER_FORCE_DEV === '1')) return;
const pending = appState.versionPendingInstall;
if (pending) {
sendToRenderer(win.webContents, 'ok:update:downloaded', { version: pending });
Expand Down
44 changes: 44 additions & 0 deletions packages/desktop/tests/integration/auto-updater.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1976,6 +1976,50 @@ describe('dev-mode guard (isPackaged=false)', () => {
const toastA = rig.captured.filter((c) => c.channel === 'ok:update:downloaded');
expect(toastA).toHaveLength(1);
});

test('boot-time failed-install notice suppressed when isPackaged=false', () => {
const { rig } = makeRig({
isPackaged: false,
attemptedInstall: '0.5.0',
appVersion: '0.4.0',
});
expect(rig.captured.filter((c) => c.channel === 'ok:update:relaunch-failed')).toHaveLength(0);
expect(rig.dispatches).not.toContain('install-failed-on-boot' as DispatchKind);
});

test('boot-time whats-new toast suppressed when isPackaged=false (lastSeenVersion still advances)', () => {
const { rig } = makeRig({
isPackaged: false,
lastSeenVersion: '0.3.0',
appVersion: '0.3.1',
});
expect(rig.captured.filter((c) => c.channel === 'ok:update:whats-new')).toHaveLength(0);
expect(rig.dispatches).not.toContain('whats-new-toast-b' as DispatchKind);
expect(rig.state.lastSeenVersion).toBe('0.3.1');
});

test('forceDevBypass=true re-enables the boot-time failed-install notice', () => {
const { rig } = makeRig({
isPackaged: false,
forceDevBypass: true,
attemptedInstall: '0.5.0',
appVersion: '0.4.0',
});
const failed = rig.captured.filter((c) => c.channel === 'ok:update:relaunch-failed');
expect(failed).toHaveLength(1);
expect(rig.dispatches).toContain('install-failed-on-boot' as DispatchKind);
});

test('forceDevBypass=true re-enables the boot-time whats-new toast', () => {
const { rig } = makeRig({
isPackaged: false,
forceDevBypass: true,
lastSeenVersion: '0.3.0',
appVersion: '0.3.1',
});
expect(rig.captured.filter((c) => c.channel === 'ok:update:whats-new')).toHaveLength(1);
expect(rig.dispatches).toContain('whats-new-toast-b' as DispatchKind);
});
});

describe('download-progress (log-only, no UI surface)', () => {
Expand Down