Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Move OpenKnowledge Desktop to Electron 44.5.1 (PRD-8922) (#5276)
Andrew Mikofalvy609cd7f71050
diff --git a/.changeset/electron-44-runtime.md b/.changeset/electron-44-runtime.mdnew file mode 100644index 000000000..c2082a6b9--- /dev/null+++ b/.changeset/electron-44-runtime.md@@ -0,0 +1,5 @@+---+"@inkeep/open-knowledge": minor+---++The desktop app now runs on Electron 44, with Chromium 152 and Node 24.21. It requires macOS 13 (Ventura) or later, so Macs on macOS 12 stay on their current version and are not offered this update.diff --git a/.github/scripts/retry-transient.mjs b/.github/scripts/retry-transient.mjsindex 369353fae..558d5e8e8 100644--- a/.github/scripts/retry-transient.mjs+++ b/.github/scripts/retry-transient.mjs@@ -79,6 +79,7 @@ const TERMINAL_RULES = ['missing-executable',/(?:\bspawn\s+\S+\s+ENOENT\b|[\r\n]\s*Error:\s*Cannot find module\b|\bERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL\b[^\r\n]*\bCommand\b[^\r\n]*\bnot found\b|[\r\n]\s*\S{0,256}(?:ba)?sh(?:\.exe)?:[^\r\n]{0,512}:\s*command not found\b)/i,],+ ['update-manifest', /\bOK_PACKAGING_UPDATE_MANIFEST_FAILURE\b/],['download-integrity', /\b(?:checksum|hash) mismatch,\s*expected\b/i],];const TERMINAL_RULE_IDS = Object.freeze(TERMINAL_RULES.map(([id]) => id));diff --git a/.github/scripts/retry-transient.test.mjs b/.github/scripts/retry-transient.test.mjsindex 5bfdb0449..1d7a05d66 100644--- a/.github/scripts/retry-transient.test.mjs+++ b/.github/scripts/retry-transient.test.mjs@@ -306,6 +306,7 @@ describe('failure evidence classification', () => {'ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL Command "electron-builder" not found','spawn electron-builder ENOENT','ENOSPC: no space left on device',+ '[desktop-builder] beta-mac.yml: The macOS update manifest is not a YAML mapping [OK_PACKAGING_UPDATE_MANIFEST_FAILURE]',])('classifies explicit terminal evidence as terminal: %s', (text) => {expect(inspect(text).classification).toBe('terminal');});@@ -445,6 +446,13 @@ describe('failure evidence classification', () => {});expect(maskedTlsTrust.log).toContain('reason=rule:tls-trust outcome=terminal');expect(maskedTlsTrust.log).not.toContain('rule:download-integrity');+ const maskedUpdateManifest = await run({+ command: nodeCmd(+ 'console.error("sha512 checksum mismatch, expected AAA, got BBB\\n[desktop-builder] beta-mac.yml: not a YAML mapping [OK_PACKAGING_UPDATE_MANIFEST_FAILURE]");process.exit(1)',+ ),+ });+ expect(maskedUpdateManifest.log).toContain('reason=rule:update-manifest outcome=terminal');+ expect(maskedUpdateManifest.log).not.toContain('rule:download-integrity');const tlsTrustWithSymptom = await run({command: nodeCmd('console.error("Error Domain=NSURLErrorDomain Code=-1202\\nError: Exit code: ENOENT. spawn /Users/runner/Library/Caches/electron-builder/app-builder/app-builder ENOENT");process.exit(1)',diff --git a/docs/content/get-started/overview.mdx b/docs/content/get-started/overview.mdxindex 385e4ed3c..381a9d028 100644--- a/docs/content/get-started/overview.mdx+++ b/docs/content/get-started/overview.mdx@@ -9,7 +9,7 @@ OpenKnowledge is an IDE for co-creating markdown-based knowledge bases and docum<AgentIcons />-Available as a [desktop app](https://openknowledge.ai/download) for macOS, Windows, and Linux — or as a local web app and CLI (any platform, including Intel Macs).+Available as a [desktop app](https://openknowledge.ai/download) for macOS 13 or later, Windows, and Linux — or as a local web app and CLI (any platform, including Intel Macs).## Three layersdiff --git a/docs/content/get-started/quickstart.mdx b/docs/content/get-started/quickstart.mdxindex 98b995dac..ac55340c6 100644--- a/docs/content/get-started/quickstart.mdx+++ b/docs/content/get-started/quickstart.mdx@@ -13,7 +13,7 @@ description: Set up a knowledge base with OpenKnowledge in less than five minute### Install the desktop app (macOS, Windows, Linux)-Download the installer for your platform:+Download the installer for your platform. On a Mac, the desktop app needs macOS 13 (Ventura) or later:<DownloadButton />diff --git a/docs/content/migrate/notion.mdx b/docs/content/migrate/notion.mdxindex 6711fa86f..a5145f1a1 100644--- a/docs/content/migrate/notion.mdx+++ b/docs/content/migrate/notion.mdx@@ -8,7 +8,7 @@ This guide will cover exporting your Notion workspace to markdown files so that## Install OpenKnowledge-### Desktop app (macOS, Windows, Linux)+### Desktop app (macOS 13+, Windows, Linux)Download the latest version of the OpenKnowledge desktop app. The button picks your platform automatically; its dropdown carries every other build, and the [downloads page](https://openknowledge.ai/download) lists them all.diff --git a/docs/content/migrate/obsidian.mdx b/docs/content/migrate/obsidian.mdxindex 157813c6d..564d56d7c 100644--- a/docs/content/migrate/obsidian.mdx+++ b/docs/content/migrate/obsidian.mdx@@ -12,7 +12,7 @@ OpenKnowledge and Obsidian are both editors over a [folder of plain markdown](/d## Open your vault-### Desktop app (macOS, Windows, Linux)+### Desktop app (macOS 13+, Windows, Linux)Open OpenKnowledge, choose **Open folder on disk**, and select your existing vault folder, then proceed through the **Setup** screen. OpenKnowledge uses the folder in place — it doesn't copy or move your notes.diff --git a/docs/content/reference/cli.mdx b/docs/content/reference/cli.mdxindex 449265b18..fea933902 100644--- a/docs/content/reference/cli.mdx+++ b/docs/content/reference/cli.mdx@@ -4,7 +4,7 @@ icon: LuTerminaldescription: Install the ok CLI and run the OpenKnowledge web app in your browser — on any platform, including Intel Macs and servers.----For the smoothest experience, use the [desktop app](/docs/get-started/quickstart) — it ships for **macOS**, **Windows**, and **Linux**. Anywhere else (an **Intel Mac**, a server), or when you'd rather stay in the terminal, install the `ok` CLI from npm and run the **same editor as a local web app** in your browser.+For the smoothest experience, use the [desktop app](/docs/get-started/quickstart) — it ships for **macOS 13 or later**, **Windows**, and **Linux**. Anywhere else (an **Intel Mac**, a server), or when you'd rather stay in the terminal, install the `ok` CLI from npm and run the **same editor as a local web app** in your browser.<Callout type="info" title="Prerequisites — Verify Node and Git are installed">Open a terminal and run:diff --git a/docs/content/reference/core-concepts.md b/docs/content/reference/core-concepts.mdindex 2d379b80a..1383f976d 100644--- a/docs/content/reference/core-concepts.md+++ b/docs/content/reference/core-concepts.md@@ -79,7 +79,7 @@ The third layer is the content itself. OpenKnowledge has **no database dependencThis means:- **No lock-in.** Your knowledge is portable markdown you can read, grep, diff, and commit with ordinary tools.-- **Almost nothing to install.** The recommended path is the desktop app (macOS, Windows, or Linux); there is no separate database or service to run.+- **Almost nothing to install.** The recommended path is the desktop app (macOS 13 or later, Windows, or Linux); there is no separate database or service to run.- **The engine is a management layer, not a gatekeeper.** It maintains consistency when you go through it, but editing the raw files yourself is always allowed.The set of files the engine treats as your knowledge base is the configured content directory. See [Configuration](./configuration.mdx) for where that and other settings live.diff --git a/docs/content/workflows/karpathy-llm-wiki.mdx b/docs/content/workflows/karpathy-llm-wiki.mdxindex c5c94cd4c..d16aa67a4 100644--- a/docs/content/workflows/karpathy-llm-wiki.mdx+++ b/docs/content/workflows/karpathy-llm-wiki.mdx@@ -64,7 +64,7 @@ Either way, by the end of this guide you'll have a working source-grounded knowlYou need:-- **The OpenKnowledge desktop app.** The desktop app (macOS, Windows, Linux) is the canonical surface: WYSIWYG editor, file sidebar, agent activity panel, version timeline, and the starter-pack picker all live there. Install it from the [Quickstart](../get-started/quickstart.mdx).+- **The OpenKnowledge desktop app.** The desktop app (macOS 13+, Windows, Linux) is the canonical surface: WYSIWYG editor, file sidebar, agent activity panel, version timeline, and the starter-pack picker all live there. Install it from the [Quickstart](../get-started/quickstart.mdx).- **An MCP-capable agent assistant.** [Claude Code](../integrations/claude-code.mdx), [Cursor](../integrations/cursor.mdx), [Codex](../integrations/codex.mdx), [OpenCode](../integrations/opencode.mdx), or [OpenClaw](../integrations/openclaw.mdx). The OK desktop app's first-launch flow detects them and wires them up.- **A read of the source pattern.** Andrej Karpathy's [LLM wiki gist](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f) is the canonical description of what we're implementing here. It's a 10-minute read and worth doing first; this guide builds on it directly.diff --git a/packages/app/src/globals.css b/packages/app/src/globals.cssindex cc8974fb6..2e3493d13 100644--- a/packages/app/src/globals.css+++ b/packages/app/src/globals.css@@ -3613,7 +3613,7 @@ button:active:not(:disabled) {with it. No drift, no cycle (we override background-color, NOT --sidebar).Browser support: relative-color syntax is Chromium 119+ / WebKit 16.4+ /- Firefox 128+. Electron 43 ships Chromium 150+ — fully supported.+ Firefox 128+. Electron 44 ships Chromium 152+ — fully supported.prefers-reduced-transparency has its own dedicated fallback path below(the @media (prefers-reduced-transparency: reduce) block) and isdiff --git a/packages/desktop/build/helper-bundle/Info.plist b/packages/desktop/build/helper-bundle/Info.plistindex 12f62d82f..3f4a71a18 100644--- a/packages/desktop/build/helper-bundle/Info.plist+++ b/packages/desktop/build/helper-bundle/Info.plist@@ -1,7 +1,7 @@<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><!--- UPSTREAM([email protected]): the helper stub `scripts/afterPack.mjs` clones+ UPSTREAM([email protected]): the helper stub `scripts/afterPack.mjs` clonesinto this bundle reads its own `_NSGetExecutablePath()` basename early inboot and silently SIGTRAPs (exit 133, empty stderr) unless it is`<productName> Helper`, so `CFBundleExecutable` carries that namediff --git a/packages/desktop/electron-builder.yml b/packages/desktop/electron-builder.ymlindex fd874df89..7b2709aaf 100644--- a/packages/desktop/electron-builder.yml+++ b/packages/desktop/electron-builder.yml@@ -9,7 +9,7 @@ copyright: Copyright © 2026 Inkeep# "electron" devDep in packages/desktop/package.json — that devDep is# pinned exact (no caret) so the packaged runtime and the version used by# electron-rebuild / native-module ABI compilation cannot drift.-electronVersion: "43.4.0"+electronVersion: "44.5.1"# @electron/rebuild stays enabled for mac and Windows from this config because# other native modules still use that pass. node-pty's N-API prebuilds do not@@ -335,7 +335,7 @@ mac:# spawned server process without a Dock tile — without this, the# re-exec into the parent's MacOS binary triggers LaunchServices to# pin a stuck "exec" Dock placeholder for the child's lifetime.- # UPSTREAM([email protected]): the helper binary afterPack clones into+ # UPSTREAM([email protected]): the helper binary afterPack clones into# `<productName> Server.app/Contents/MacOS` SIGTRAPs unless it is named# `<productName> Helper`; see `build/helper-bundle/Info.plist`.extraFiles:diff --git a/packages/desktop/package.json b/packages/desktop/package.jsonindex cf01ffa57..71aecd1ac 100644--- a/packages/desktop/package.json+++ b/packages/desktop/package.json@@ -61,7 +61,7 @@"@vitejs/plugin-react": "^6.0.1","babel-plugin-react-compiler": "0.0.0-experimental-a8e64ef-20260402","culori": "^4.0.2",- "electron": "43.4.0",+ "electron": "44.5.1","electron-builder": "^26.16.1","electron-vite": "^6.0.0-beta.1","ts-morph": "^28.0.0",diff --git a/packages/desktop/resources/cli/bin/ok.sh b/packages/desktop/resources/cli/bin/ok.shindex c87458b40..edbf1480b 100755--- a/packages/desktop/resources/cli/bin/ok.sh+++ b/packages/desktop/resources/cli/bin/ok.sh@@ -34,7 +34,7 @@ if [ ! -f "$CLI" ] || [ ! -x "$ELECTRON" ]; thenexit 69fi-# UPSTREAM([email protected]): an ELECTRON_RUN_AS_NODE boot reads its own basename+# UPSTREAM([email protected]): an ELECTRON_RUN_AS_NODE boot reads its own basename# via _NSGetExecutablePath() and SIGTRAPs on anything but "<product> Helper",# so the executable name below is fixed by Electron, not by us.RUNTIME="$ELECTRON"diff --git a/packages/desktop/scripts/mac-update-manifest.ts b/packages/desktop/scripts/mac-update-manifest.tsnew file mode 100644index 000000000..8bdb0fb89--- /dev/null+++ b/packages/desktop/scripts/mac-update-manifest.ts@@ -0,0 +1,48 @@+import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';+import { join } from 'node:path';+import { parse as parseYaml } from 'yaml';++// UPSTREAM([email protected], [email protected]): Electron 44 requires macOS 13, which `os.release()` reports as Darwin 22; electron-updater skips a manifest whose `minimumSystemVersion` is above that value.+export const MAC_UPDATE_MINIMUM_DARWIN_VERSION = '22.0.0';++export function withMacMinimumSystemVersion(+ manifest: string,+ version: string = MAC_UPDATE_MINIMUM_DARWIN_VERSION,+): string {+ const parsed: unknown = parseYaml(manifest);+ if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {+ throw new Error('The macOS update manifest is not a YAML mapping');+ }+ if ('minimumSystemVersion' in parsed) {+ if (parsed.minimumSystemVersion === version) return manifest;+ throw new Error(+ `The macOS update manifest already requires ${String(parsed.minimumSystemVersion)}, not ${version}`,+ );+ }+ const stamped = `${manifest.endsWith('\n') ? manifest : `${manifest}\n`}minimumSystemVersion: '${version}'\n`;+ const reparsed = parseYaml(stamped) as { minimumSystemVersion?: unknown };+ if (reparsed.minimumSystemVersion !== version) {+ throw new Error(`The macOS update manifest did not keep minimumSystemVersion ${version}`);+ }+ return stamped;+}++export function stampMacUpdateManifests(outputDir: string): string[] {+ const names = existsSync(outputDir)+ ? readdirSync(outputDir).filter((name) => name.endsWith('-mac.yml'))+ : [];+ if (names.length === 0) {+ throw new Error(`electron-builder wrote no macOS update manifest to ${outputDir}`);+ }+ for (const name of names) {+ const path = join(outputDir, name);+ try {+ writeFileSync(path, withMacMinimumSystemVersion(readFileSync(path, 'utf8')));+ } catch (err) {+ throw new Error(`${name}: ${err instanceof Error ? err.message : String(err)}`, {+ cause: err,+ });+ }+ }+ return names;+}diff --git a/packages/desktop/scripts/packaging-diagnostics.mjs b/packages/desktop/scripts/packaging-diagnostics.mjsindex 9a9a04fbd..aa23dea1a 100644--- a/packages/desktop/scripts/packaging-diagnostics.mjs+++ b/packages/desktop/scripts/packaging-diagnostics.mjs@@ -1,5 +1,6 @@#!/usr/bin/env nodeexport const FUSE_FAILURE_MARKER = 'OK_PACKAGING_FUSE_FAILURE';+export const UPDATE_MANIFEST_FAILURE_MARKER = 'OK_PACKAGING_UPDATE_MANIFEST_FAILURE';export function createFuseFailure(message, options) {return new Error(`${message} [${FUSE_FAILURE_MARKER}]`, options);diff --git a/packages/desktop/scripts/run-electron-builder.mjs b/packages/desktop/scripts/run-electron-builder.mjsindex c8563a4fe..45829549a 100644--- a/packages/desktop/scripts/run-electron-builder.mjs+++ b/packages/desktop/scripts/run-electron-builder.mjs@@ -14,6 +14,11 @@ import {createVariantPostRemove,parseBuilderConfig,} from './desktop-variant-config.ts';+import {+ MAC_UPDATE_MINIMUM_DARWIN_VERSION,+ stampMacUpdateManifests,+} from './mac-update-manifest.ts';+import { UPDATE_MANIFEST_FAILURE_MARKER } from './packaging-diagnostics.mjs';const variantName = parseDesktopVariantName(process.env.OK_DESKTOP_VARIANT);const variant = DESKTOP_VARIANTS[variantName];@@ -94,4 +99,21 @@ if (result.error) throw result.error;if (result.signal) {console.error(`[desktop-builder] electron-builder terminated by ${result.signal}`);}+if (result.status === 0 && args.includes('--mac') && !args.includes('--dir')) {+ const outputDir = join(process.cwd(), config.directories?.output ?? 'dist');+ let stamped;+ try {+ stamped = stampMacUpdateManifests(outputDir);+ } catch (err) {+ console.error(+ `[desktop-builder] ${err instanceof Error ? err.message : String(err)} [${UPDATE_MANIFEST_FAILURE_MARKER}]`,+ );+ process.exit(1);+ }+ for (const name of stamped) {+ console.log(+ `[desktop-builder] ${name} requires Darwin ${MAC_UPDATE_MINIMUM_DARWIN_VERSION} or later`,+ );+ }+}process.exit(result.status ?? 1);diff --git a/packages/desktop/src/main/asset-menu.ts b/packages/desktop/src/main/asset-menu.tsindex 97bce0333..e9f92a87c 100644--- a/packages/desktop/src/main/asset-menu.ts+++ b/packages/desktop/src/main/asset-menu.ts@@ -1,5 +1,6 @@import { menuLabelForPlatform, NATIVE_MENU_LABELS } from '@inkeep/open-knowledge-core';import type { BrowserWindow, Menu, MenuItemConstructorOptions } from 'electron';+import { getLogger } from './desktop-logger.ts';import { type MenuTranslator, translateEnglish } from './menu-translator.ts';type AssetMenuKind = 'asset' | 'wiki-link' | 'image';@@ -10,6 +11,17 @@ interface AssetMenuActions {readonly copyLink: () => void | Promise<void>;}+function runAssetMenuAction(name: keyof AssetMenuActions, action: () => void | Promise<void>) {+ const report = (err: unknown) => {+ getLogger('asset-context-menu').warn({ err, action: name }, 'asset menu action failed');+ };+ try {+ void Promise.resolve(action()).catch(report);+ } catch (err) {+ report(err);+ }+}+export function revealMenuLabel(platform: NodeJS.Platform): string {return menuLabelForPlatform('revealInFinder', platform);}@@ -30,20 +42,20 @@ export function buildAssetMenuTemplate({label: translate(revealMenuLabel(platform)),click: () => {- void actions.reveal();+ runAssetMenuAction('reveal', actions.reveal);},},{label: translate(NATIVE_MENU_LABELS.openInDefaultApp),click: () => {- void actions.openInDefault();+ runAssetMenuAction('openInDefault', actions.openInDefault);},},{ type: 'separator' },{label: translate(NATIVE_MENU_LABELS.copyLink),click: () => {- void actions.copyLink();+ runAssetMenuAction('copyLink', actions.copyLink);},},];diff --git a/packages/desktop/src/main/copy-image-clipboard.test.ts b/packages/desktop/src/main/copy-image-clipboard.test.tsindex 740f9a246..e1c755a6a 100644--- a/packages/desktop/src/main/copy-image-clipboard.test.ts+++ b/packages/desktop/src/main/copy-image-clipboard.test.ts@@ -1,14 +1,24 @@import { describe, expect, test, vi } from 'vitest';import { type CopyImageToClipboardDeps, copyImageToClipboard } from './copy-image-clipboard.ts';+const PNG_BYTES = Buffer.from([0x89, 0x50, 0x4e, 0x47]);++class FakeClipboardItem {+ readonly types: string[];+ constructor(readonly items: Record<string, Blob>) {+ this.types = Object.keys(items);+ }+}+function baseDeps(overrides: Partial<CopyImageToClipboardDeps> = {}): CopyImageToClipboardDeps {return {projectPath: '/proj',platform: 'darwin',assetOrigin: 'http://localhost:5173',- clipboard: { writeImage: vi.fn() },+ clipboard: { write: vi.fn(async () => {}) },+ ClipboardItem: FakeClipboardItem as unknown as CopyImageToClipboardDeps['ClipboardItem'],nativeImage: {- createFromBuffer: () => ({ isEmpty: () => false }),+ createFromBuffer: () => ({ isEmpty: () => false, toPNG: () => PNG_BYTES }),},fetch: vi.fn(async () => new Response(new Uint8Array([1, 2, 3]), { status: 200 })),resolveCanonical: (p) => p,@@ -18,10 +28,10 @@ function baseDeps(overrides: Partial<CopyImageToClipboardDeps> = {}): CopyImageTdescribe('copyImageToClipboard — same-origin path handling', () => {test('refuses %-encoded ../ traversal with path-escape', async () => {- const writeImage = vi.fn();+ const write = vi.fn(async () => {});const result = await copyImageToClipboard(baseDeps({- clipboard: { writeImage },+ clipboard: { write },resolveCanonical: () => '/etc/passwd',}),{ src: 'http://localhost:5173/%2E%2E/%2E%2E/etc/passwd', alt: 'x' },@@ -31,16 +41,16 @@ describe('copyImageToClipboard — same-origin path handling', () => {reason: 'path-escape',detail: expect.stringContaining('outside project'),});- expect(writeImage).not.toHaveBeenCalled();+ expect(write).not.toHaveBeenCalled();});test('windows drive-letter after decode triggers the isAbsolute guard', async () => {- const writeImage = vi.fn();+ const write = vi.fn(async () => {});const resolveCanonical = vi.fn((p: string) => p);const result = await copyImageToClipboard(baseDeps({platform: 'win32',- clipboard: { writeImage },+ clipboard: { write },resolveCanonical,}),{ src: 'http://localhost:5173/C:/Windows/System32/passwd', alt: 'x' },@@ -51,14 +61,14 @@ describe('copyImageToClipboard — same-origin path handling', () => {detail: expect.stringContaining('absolute rel path'),});expect(resolveCanonical).not.toHaveBeenCalled();- expect(writeImage).not.toHaveBeenCalled();+ expect(write).not.toHaveBeenCalled();});test('realpath ENOENT surfaces as read-error (missing file along the chain)', async () => {- const writeImage = vi.fn();+ const write = vi.fn(async () => {});const result = await copyImageToClipboard(baseDeps({- clipboard: { writeImage },+ clipboard: { write },resolveCanonical: () => {throw Object.assign(new Error('no such file'), { code: 'ENOENT' });},@@ -70,14 +80,14 @@ describe('copyImageToClipboard — same-origin path handling', () => {reason: 'read-error',detail: expect.stringContaining('no such file'),});- expect(writeImage).not.toHaveBeenCalled();+ expect(write).not.toHaveBeenCalled();});test('readFile EACCES surfaces as read-error (permission denied)', async () => {- const writeImage = vi.fn();+ const write = vi.fn(async () => {});const result = await copyImageToClipboard(baseDeps({- clipboard: { writeImage },+ clipboard: { write },readFile: async () => {throw Object.assign(new Error('permission denied'), { code: 'EACCES' });},@@ -89,15 +99,15 @@ describe('copyImageToClipboard — same-origin path handling', () => {reason: 'read-error',detail: expect.stringContaining('permission denied'),});- expect(writeImage).not.toHaveBeenCalled();+ expect(write).not.toHaveBeenCalled();});test('non-image extension is refused at the disk-read gate (extension whitelist)', async () => {- const writeImage = vi.fn();+ const write = vi.fn(async () => {});const readFile = vi.fn();const result = await copyImageToClipboard(baseDeps({- clipboard: { writeImage },+ clipboard: { write },readFile,}),{ src: 'http://localhost:5173/.ok/config.yml', alt: 'x' },@@ -108,14 +118,14 @@ describe('copyImageToClipboard — same-origin path handling', () => {detail: expect.stringContaining('unsupported ext'),});expect(readFile).not.toHaveBeenCalled();- expect(writeImage).not.toHaveBeenCalled();+ expect(write).not.toHaveBeenCalled();});test('realpath refuses a symlink escape (containment on canonical path, not lexical)', async () => {- const writeImage = vi.fn();+ const write = vi.fn(async () => {});const result = await copyImageToClipboard(baseDeps({- clipboard: { writeImage },+ clipboard: { write },resolveCanonical: () => '/etc/passwd',}),{ src: 'http://localhost:5173/assets/logo.png', alt: 'x' },@@ -125,16 +135,16 @@ describe('copyImageToClipboard — same-origin path handling', () => {reason: 'path-escape',detail: expect.stringContaining('outside project'),});- expect(writeImage).not.toHaveBeenCalled();+ expect(write).not.toHaveBeenCalled();});});describe('copyImageToClipboard — cross-origin fetch', () => {test('4xx / 5xx response resolves fetch-failed with HTTP status', async () => {- const writeImage = vi.fn();+ const write = vi.fn(async () => {});const result = await copyImageToClipboard(baseDeps({- clipboard: { writeImage },+ clipboard: { write },fetch: vi.fn(async () => new Response('', { status: 404 })),}),{ src: 'https://cdn.example.com/missing.png', alt: 'x' },@@ -144,14 +154,14 @@ describe('copyImageToClipboard — cross-origin fetch', () => {reason: 'fetch-failed',detail: 'HTTP 404',});- expect(writeImage).not.toHaveBeenCalled();+ expect(write).not.toHaveBeenCalled();});test('fetch throw (network error, timeout) surfaces as fetch-failed', async () => {- const writeImage = vi.fn();+ const write = vi.fn(async () => {});const result = await copyImageToClipboard(baseDeps({- clipboard: { writeImage },+ clipboard: { write },fetch: vi.fn(async () => {throw new Error('boom');}),@@ -163,18 +173,18 @@ describe('copyImageToClipboard — cross-origin fetch', () => {reason: 'fetch-failed',detail: 'boom',});- expect(writeImage).not.toHaveBeenCalled();+ expect(write).not.toHaveBeenCalled();});});describe('copyImageToClipboard — decode + write', () => {test('empty-image branch when nativeImage.createFromBuffer decodes empty (SVG / AVIF / WebP)', async () => {- const writeImage = vi.fn();+ const write = vi.fn(async () => {});const result = await copyImageToClipboard(baseDeps({- clipboard: { writeImage },+ clipboard: { write },nativeImage: {- createFromBuffer: () => ({ isEmpty: () => true }),+ createFromBuffer: () => ({ isEmpty: () => true, toPNG: () => Buffer.alloc(0) }),},}),{ src: 'https://cdn.example.com/x.svg', alt: 'x' },@@ -183,24 +193,30 @@ describe('copyImageToClipboard — decode + write', () => {if (!result.ok) {expect(result.reason).toBe('empty-image');}- expect(writeImage).not.toHaveBeenCalled();+ expect(write).not.toHaveBeenCalled();});- test('happy path: writeImage called, ok:true returned', async () => {- const writeImage = vi.fn();- const result = await copyImageToClipboard(baseDeps({ clipboard: { writeImage } }), {- src: 'https://cdn.example.com/pic.png',+ test('happy path: writes the image to the clipboard as PNG', async () => {+ const write = vi.fn(async () => {});+ const result = await copyImageToClipboard(baseDeps({ clipboard: { write } }), {+ src: 'https://cdn.example.com/pic.jpg',alt: 'x',});expect(result).toEqual({ ok: true });- expect(writeImage).toHaveBeenCalledTimes(1);+ expect(write).toHaveBeenCalledTimes(1);+ const [items] = write.mock.calls[0] as unknown as [FakeClipboardItem[]];+ expect(items).toHaveLength(1);+ expect(items[0].types).toEqual(['image/png']);+ const blob = items[0].items['image/png'];+ expect(blob.type).toBe('image/png');+ expect(Buffer.from(await blob.arrayBuffer())).toEqual(PNG_BYTES);});- test('writeImage throw surfaces as write-error (defends against NSPasteboard flakes)', async () => {- const writeImage = vi.fn(() => {+ test('clipboard write rejection surfaces as write-error (defends against NSPasteboard flakes)', async () => {+ const write = vi.fn(async () => {throw new Error('NSPasteboard write failed');});- const result = await copyImageToClipboard(baseDeps({ clipboard: { writeImage } }), {+ const result = await copyImageToClipboard(baseDeps({ clipboard: { write } }), {src: 'https://cdn.example.com/pic.png',alt: 'x',});diff --git a/packages/desktop/src/main/copy-image-clipboard.ts b/packages/desktop/src/main/copy-image-clipboard.tsindex bad05aaf6..3c37e7c47 100644--- a/packages/desktop/src/main/copy-image-clipboard.ts+++ b/packages/desktop/src/main/copy-image-clipboard.ts@@ -3,7 +3,7 @@ import { readFile } from 'node:fs/promises';import { resolve as resolvePath } from 'node:path';import * as pathPosix from 'node:path/posix';import * as pathWin32 from 'node:path/win32';-import type { Clipboard, NativeImage } from 'electron';+import type { Clipboard, ClipboardItem, NativeImage } from 'electron';import { isPathWithinProject } from './ipc-handlers.ts';const CLIPBOARD_IMAGE_EXTS: ReadonlySet<string> = new Set(['png', 'jpg', 'jpeg']);@@ -20,9 +20,10 @@ export interface CopyImageToClipboardDeps {readonly projectPath: string;readonly platform: NodeJS.Platform;readonly assetOrigin: string;- readonly clipboard: Pick<Clipboard, 'writeImage'>;+ readonly clipboard: Pick<Clipboard, 'write'>;+ readonly ClipboardItem: new (items: Record<string, Blob>) => ClipboardItem;readonly nativeImage: {- createFromBuffer(buffer: Buffer): Pick<NativeImage, 'isEmpty'>;+ createFromBuffer(buffer: Buffer): Pick<NativeImage, 'isEmpty' | 'toPNG'>;};readonly fetch?: typeof fetch;readonly resolveCanonical?: (path: string) => string;@@ -49,13 +50,13 @@ export async function copyImageToClipboard(}try {- // biome-ignore lint/suspicious/noExplicitAny: nativeImage.createFromBuffer returns Pick<>, writeImage wants full NativeImage — safe at runtime because Electron only reads the surface Pick<> covers.- deps.clipboard.writeImage(img as any);+ const png = new Blob([new Uint8Array(img.toPNG())], { type: 'image/png' });+ await deps.clipboard.write([new deps.ClipboardItem({ 'image/png': png })]);} catch (err) {return {ok: false,reason: 'write-error',- detail: (err as Error)?.message ?? 'writeImage failed',+ detail: (err as Error)?.message ?? 'clipboard write failed',};}return { ok: true };diff --git a/packages/desktop/src/main/index.ts b/packages/desktop/src/main/index.tsindex dacd2ab01..102a3655d 100644--- a/packages/desktop/src/main/index.ts+++ b/packages/desktop/src/main/index.ts@@ -116,6 +116,7 @@ import type {import {app,BrowserWindow,+ ClipboardItem,clipboard,crashReporter,dialog,@@ -4248,9 +4249,7 @@ function registerIpcHandlers() {params.relPath,);},- copyLink: () => {- clipboard.writeText(params.relPath);- },+ copyLink: () => clipboard.writeText(params.relPath),},},);@@ -4411,7 +4410,7 @@ function registerIpcHandlers() {});handle('ok:clipboard:write-text', async (_event, text) => {- clipboard.writeText(text);+ await clipboard.writeText(text);return undefined;});@@ -4424,16 +4423,24 @@ function registerIpcHandlers() {if (!projectPath || !apiOrigin) {return { ok: false as const, reason: 'read-error' as const, detail: 'no project context' };}- return copyImageToClipboard(+ const result = await copyImageToClipboard({projectPath,platform: process.platform,assetOrigin: apiOrigin,clipboard,+ ClipboardItem,nativeImage,},{ src, alt },);+ if (!result.ok) {+ getLogger('copy-image').warn(+ { reason: result.reason, detail: result.detail },+ 'copy image to clipboard failed',+ );+ }+ return result;});handle('ok:locale:set-preference', async (_event, { preference }) => {@@ -5810,7 +5817,7 @@ function installDockIcon(instanceLabel: string | null) {if (process.platform !== 'darwin') return;if (app.isPackaged) return;/*- * UPSTREAM([email protected]): an unpackaged app runs out of Electron's own+ * UPSTREAM([email protected]): an unpackaged app runs out of Electron's own* bundle, so macOS reads the Dock tile name from that Info.plist and* `app.setName()` cannot reach it. A badge is the only runtime way to put an* instance label on the Dock icon.diff --git a/packages/desktop/src/main/linux-install-fallback.test.ts b/packages/desktop/src/main/linux-install-fallback.test.tsindex 4ac9984e2..30ff54021 100644--- a/packages/desktop/src/main/linux-install-fallback.test.ts+++ b/packages/desktop/src/main/linux-install-fallback.test.ts@@ -1,4 +1,4 @@-import { describe, expect, test, vi } from 'vitest';+import { describe, expect, onTestFinished, test, vi } from 'vitest';import {classifyInstallFailure,detectGraphicalAuthCommand,@@ -186,7 +186,7 @@ describe('runManualInstallFallbackDialog', () => {const shown = vi.fn(async (_request: ManualInstallDialogRequest) => ({response: queue.shift() ?? 2,}));- const copied = vi.fn();+ const copied = vi.fn(async (_command: string) => {});const relaunched = vi.fn();return {shown,@@ -227,8 +227,42 @@ describe('runManualInstallFallbackDialog', () => {expect(deps.relaunched).toHaveBeenCalledTimes(1);});+ test('a failed clipboard write re-shows the dialog saying the command was not copied', async () => {+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});+ onTestFinished(() => warn.mockRestore());+ const outcomes = [false, true];+ const copied = vi.fn(async (_command: string) => {+ if (!outcomes.shift()) throw new Error('clipboard unavailable');+ });+ const shown: ManualInstallDialogRequest[] = [];+ const responses = [0, 0, 1];+ const deps: ManualInstallDialogDeps = {+ showDialog: async (request) => {+ shown.push(request);+ return { response: responses.shift() ?? 2 };+ },+ copyCommandToClipboard: copied,+ relaunchApp: vi.fn(),+ };+ await expect(runManualInstallFallbackDialog(deps, ctx)).resolves.toBe('relaunch');+ expect(shown).toHaveLength(3);+ expect(shown[0]?.detail).not.toContain('was not copied');+ expect(shown[1]?.detail).toMatch(/^The command was not copied\./);+ expect(shown[1]?.detail).toContain(ctx.command);+ expect(shown[1]?.buttons).toEqual(shown[0]?.buttons);+ expect(shown[2]).toEqual(shown[0]);+ expect(warn).toHaveBeenCalledWith(+ '[linux-install-fallback] copying the install command failed',+ expect.objectContaining({+ version: ctx.version,+ installerPath: ctx.installerPath,+ err: expect.any(Error),+ }),+ );+ });+test('a dialog rejection mid-loop (parent window destroyed) resolves as dismissal', async () => {- const copied = vi.fn();+ const copied = vi.fn(async (_command: string) => {});const relaunched = vi.fn();let calls = 0;const deps: ManualInstallDialogDeps = {diff --git a/packages/desktop/src/main/linux-install-fallback.ts b/packages/desktop/src/main/linux-install-fallback.tsindex 2fe9c3f59..03f06257c 100644--- a/packages/desktop/src/main/linux-install-fallback.ts+++ b/packages/desktop/src/main/linux-install-fallback.ts@@ -97,7 +97,7 @@ export interface ManualInstallDialogRequest {export interface ManualInstallDialogDeps {showDialog: (request: ManualInstallDialogRequest) => Promise<{ response: number }>;- copyCommandToClipboard: (command: string) => void;+ copyCommandToClipboard: (command: string) => Promise<void>;relaunchApp: () => void;}@@ -105,24 +105,33 @@ export async function runManualInstallFallbackDialog(deps: ManualInstallDialogDeps,ctx: LinuxManualInstallContext,): Promise<'relaunch' | 'dismissed'> {+ const detail =+ 'Administrator authorization is not available in this session, so the update ' ++ 'cannot be installed for you.\n\n' ++ 'To install it manually, run this in a terminal:\n\n' ++ `${ctx.command}\n\n` ++ 'The downloaded update stays on disk until it is installed or replaced by a ' ++ 'newer version. Relaunch restarts OpenKnowledge whether or not you have ' ++ 'installed it yet.';const request: ManualInstallDialogRequest = {message: `OpenKnowledge ${ctx.version} couldn't install automatically`,- detail:- 'Administrator authorization is not available in this session, so the update ' +- 'cannot be installed for you.\n\n' +- 'To install it manually, run this in a terminal:\n\n' +- `${ctx.command}\n\n` +- 'The downloaded update stays on disk until it is installed or replaced by a ' +- 'newer version. Relaunch restarts OpenKnowledge whether or not you have ' +- 'installed it yet.',+ detail,buttons: ['Copy Command', 'Relaunch OpenKnowledge', 'Not Now'],defaultId: 0,cancelId: 2,};+ const copyFailedRequest: ManualInstallDialogRequest = {+ ...request,+ detail:+ 'The command was not copied. Type it into the terminal yourself rather than pasting, ' ++ 'because the clipboard still holds whatever it held before.\n\n' ++ detail,+ };+ let copyFailed = false;for (;;) {let result: { response: number };try {- result = await deps.showDialog(request);+ result = await deps.showDialog(copyFailed ? copyFailedRequest : request);} catch (err) {console.warn('[linux-install-fallback] dialog failed — treating as dismissal', {version: ctx.version,@@ -132,7 +141,17 @@ export async function runManualInstallFallbackDialog(return 'dismissed';}if (result.response === 0) {- deps.copyCommandToClipboard(ctx.command);+ copyFailed = await deps.copyCommandToClipboard(ctx.command).then(+ () => false,+ (err: unknown) => {+ console.warn('[linux-install-fallback] copying the install command failed', {+ version: ctx.version,+ installerPath: ctx.installerPath,+ err,+ });+ return true;+ },+ );continue;}if (result.response === 1) {diff --git a/packages/desktop/src/main/window-manager.ts b/packages/desktop/src/main/window-manager.tsindex a0ec5f1aa..1ef385275 100644--- a/packages/desktop/src/main/window-manager.ts+++ b/packages/desktop/src/main/window-manager.ts@@ -1451,7 +1451,7 @@ export class WindowManager {this.deps.flushLog?.();};const terminate = (): 'killed' | 'deferred-until-spawn' | 'kill-refused' => {- // UPSTREAM([email protected]): kill() before spawn returns false and leaves the launch running.+ // UPSTREAM([email protected]): kill() before spawn returns false and leaves the launch running.if (utility.kill()) return 'killed';if (utility.pid !== undefined) return 'kill-refused';utility.once('spawn', killOnceSpawned);diff --git a/packages/desktop/tests/main/asset-menu.test.ts b/packages/desktop/tests/main/asset-menu.test.tsindex 8ecc90643..2a7a3ec46 100644--- a/packages/desktop/tests/main/asset-menu.test.ts+++ b/packages/desktop/tests/main/asset-menu.test.ts@@ -1,5 +1,11 @@import type { BrowserWindow, Menu, MenuItemConstructorOptions } from 'electron';import { describe, expect, test, vi } from 'vitest';++const warn = vi.hoisted(() => vi.fn());+vi.mock('../../src/main/desktop-logger.ts', () => ({+ getLogger: () => ({ info: () => {}, warn, error: () => {}, debug: () => {} }),+}));+import {buildAssetMenuTemplate,popAssetMenu,@@ -79,6 +85,33 @@ describe('buildAssetMenuTemplate', () => {expect(actions.copyLink).toHaveBeenCalledTimes(1);});+ test.each([+ ['reveal', 0],+ ['openInDefault', 1],+ ['copyLink', 3],+ ] as const)(+ 'a rejected or throwing %s action is logged, not left unhandled',+ async (name, index) => {+ for (const failure of [+ () => Promise.reject(new Error('clipboard write failed')),+ () => {+ throw new Error('sync failure');+ },+ ]) {+ warn.mockClear();+ const actions = { ...makeActions(), [name]: vi.fn(failure) };+ const template = buildAssetMenuTemplate({ kind: 'asset', platform: 'darwin', actions });+ // biome-ignore lint/suspicious/noExplicitAny: test invokes the click callback+ (template[index] as any).click();+ await vi.waitFor(() => expect(warn).toHaveBeenCalledTimes(1));+ expect(warn).toHaveBeenCalledWith(+ { err: expect.any(Error), action: name },+ 'asset menu action failed',+ );+ }+ },+ );+test('wiki-link kind produces the same template shape (uniform UX)', () => {const wikiActions = makeActions();const assetActions = makeActions();diff --git a/packages/desktop/tests/unit/desktop-variant-config.test.ts b/packages/desktop/tests/unit/desktop-variant-config.test.tsindex f2ec58033..f570793fb 100644--- a/packages/desktop/tests/unit/desktop-variant-config.test.ts+++ b/packages/desktop/tests/unit/desktop-variant-config.test.ts@@ -23,11 +23,22 @@ import {createVariantPostRemove,parseBuilderConfig,} from '../../scripts/desktop-variant-config.ts';+import { MAC_UPDATE_MINIMUM_DARWIN_VERSION } from '../../scripts/mac-update-manifest.ts';import { DESKTOP_VARIANTS } from '../../src/shared/desktop-variant.ts';import { removeTempDirBestEffort } from '../support/temp-dir-cleanup.test-helper';const desktopRoot = resolve(dirname(fileURLToPath(import.meta.url)), '../..');+const MAC_MANIFEST = `version: 1.0.0+files:+ - url: OpenKnowledge-arm64.zip+ sha512: abc+ size: 1+path: OpenKnowledge-arm64.zip+sha512: abc+releaseDate: '2026-10-01T00:00:00.000Z'+`;+const fixtures: string[] = [];const children = new Map<ChildProcess, Promise<void>>();@@ -47,12 +58,15 @@ async function runBuilder(signal = false,platform: NodeJS.Platform = process.platform,variant = 'stable',+ writesMacManifest = true,) {const fixture = mkdtempSync(join(tmpdir(), 'ok-builder-wrapper-'));fixtures.push(fixture);for (const file of ['scripts/run-electron-builder.mjs','scripts/desktop-variant-config.ts',+ 'scripts/mac-update-manifest.ts',+ 'scripts/packaging-diagnostics.mjs','src/shared/desktop-variant.ts','package.json','electron-builder.yml',@@ -80,7 +94,11 @@ async function runBuilder(writeFileSync(join(builderDir, 'cli.js'),`- import { writeFileSync } from 'node:fs';+ import { mkdirSync, writeFileSync } from 'node:fs';+ if (process.argv.includes('--mac') && process.env.OK_BUILDER_TEST_MAC_MANIFEST === '1') {+ mkdirSync('dist-desktop', { recursive: true });+ writeFileSync('dist-desktop/latest-mac.yml', ${JSON.stringify(MAC_MANIFEST)});+ }writeFileSync('invocation.json', JSON.stringify({execPath: process.execPath,args: process.argv.slice(2),@@ -124,6 +142,7 @@ async function runBuilder(OK_BUILDER_TEST_STATUS: String(status),OK_BUILDER_TEST_SIGNAL: signal ? '1' : '0',OK_BUILDER_TEST_PLATFORM: platform,+ OK_BUILDER_TEST_MAC_MANIFEST: writesMacManifest ? '1' : '0',},stdio: ['ignore', 'pipe', 'pipe'],},@@ -456,9 +475,54 @@ describe('electron-builder wrapper execution', () => {readFileSync(join(fixture, '.variant-build/electron-builder.yml'), 'utf8'),);expect(generated.npmRebuild).toBe(target === '--linux' ? false : baseRebuild);+ if (target === '--mac') {+ const manifest = parseYaml(+ readFileSync(join(fixture, 'dist-desktop/latest-mac.yml'), 'utf8'),+ );+ expect(manifest.minimumSystemVersion).toBe(MAC_UPDATE_MINIMUM_DARWIN_VERSION);+ expect(manifest.version).toBe('1.0.0');+ }},);+ test('fails a macOS package whose builder wrote no update manifest', async () => {+ const { result } = await runBuilder(+ ['--mac', '--publish', 'never'],+ 0,+ false,+ 'darwin',+ 'stable',+ false,+ );+ expect(result.status).toBe(1);+ expect(result.stderr).toContain('wrote no macOS update manifest');+ expect(result.stderr).toContain('[OK_PACKAGING_UPDATE_MANIFEST_FAILURE]');+ });++ test('an unpacked --mac --dir build leaves any manifest unstamped', async () => {+ const { fixture, result } = await runBuilder(+ ['--mac', '--dir', '--publish', 'never'],+ 0,+ false,+ 'darwin',+ );+ expect(result.status, result.stderr).toBe(0);+ expect(readFileSync(join(fixture, 'dist-desktop/latest-mac.yml'), 'utf8')).toBe(MAC_MANIFEST);+ });++ test('a failing --mac build forwards its own status instead of the manifest check', async () => {+ const { result } = await runBuilder(+ ['--mac', '--publish', 'never'],+ 7,+ false,+ 'darwin',+ 'stable',+ false,+ );+ expect(result.status).toBe(7);+ expect(result.stderr).not.toContain('update manifest');+ });+test('forwards a failing builder exit status', async () => {const { result } = await runBuilder(['--linux'], 7);expect(result.status, result.stderr).toBe(7);diff --git a/packages/desktop/tests/unit/mac-update-manifest.test.ts b/packages/desktop/tests/unit/mac-update-manifest.test.tsnew file mode 100644index 000000000..884a373d9--- /dev/null+++ b/packages/desktop/tests/unit/mac-update-manifest.test.ts@@ -0,0 +1,78 @@+import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { afterEach, describe, expect, test } from 'vitest';+import { parse as parseYaml } from 'yaml';+import {+ MAC_UPDATE_MINIMUM_DARWIN_VERSION,+ stampMacUpdateManifests,+ withMacMinimumSystemVersion,+} from '../../scripts/mac-update-manifest.ts';+import { removeTempDirBestEffort } from '../support/temp-dir-cleanup.test-helper';++const MANIFEST = `version: 0.72.0-beta.1+files:+ - url: OpenKnowledge-Beta-arm64.zip+ sha512: abc+ size: 10+path: OpenKnowledge-Beta-arm64.zip+sha512: abc+releaseDate: '2026-10-01T00:00:00.000Z'`;++const dirs: string[] = [];+afterEach(() => {+ for (const dir of dirs.splice(0)) removeTempDirBestEffort(dir);+});++describe('withMacMinimumSystemVersion', () => {+ test('requires Darwin 22, the macOS 13 kernel, as a string electron-updater can compare', () => {+ const stamped = withMacMinimumSystemVersion(MANIFEST);+ expect(MAC_UPDATE_MINIMUM_DARWIN_VERSION).toBe('22.0.0');+ expect(parseYaml(stamped)).toEqual({+ ...parseYaml(MANIFEST),+ minimumSystemVersion: '22.0.0',+ });+ expect(stamped.startsWith(MANIFEST)).toBe(true);+ });++ test('leaves an already stamped manifest unchanged and refuses a different floor', () => {+ const stamped = withMacMinimumSystemVersion(MANIFEST);+ expect(withMacMinimumSystemVersion(stamped)).toBe(stamped);+ expect(() => withMacMinimumSystemVersion(stamped, '23.0.0')).toThrow(/already requires 22.0.0/);+ });++ test('refuses a manifest that is not a mapping', () => {+ expect(() => withMacMinimumSystemVersion('- a\n- b\n')).toThrow(/not a YAML mapping/);+ });+});++describe('stampMacUpdateManifests', () => {+ test('stamps every macOS manifest and leaves other platforms alone', () => {+ const dir = mkdtempSync(join(tmpdir(), 'ok-mac-manifest-'));+ dirs.push(dir);+ writeFileSync(join(dir, 'beta-mac.yml'), MANIFEST);+ writeFileSync(join(dir, 'beta-product-mac.yml'), MANIFEST);+ writeFileSync(join(dir, 'beta.yml'), MANIFEST);+ expect(stampMacUpdateManifests(dir).sort()).toEqual(['beta-mac.yml', 'beta-product-mac.yml']);+ for (const name of ['beta-mac.yml', 'beta-product-mac.yml']) {+ expect(parseYaml(readFileSync(join(dir, name), 'utf8')).minimumSystemVersion).toBe('22.0.0');+ }+ expect(readFileSync(join(dir, 'beta.yml'), 'utf8')).toBe(MANIFEST);+ });++ test('names the manifest that could not be stamped', () => {+ const dir = mkdtempSync(join(tmpdir(), 'ok-mac-manifest-'));+ dirs.push(dir);+ writeFileSync(join(dir, 'beta-mac.yml'), '- not\n- a mapping\n');+ expect(() => stampMacUpdateManifests(dir)).toThrow(/^beta-mac\.yml: .*not a YAML mapping/);+ });++ test('fails when the build produced no macOS manifest', () => {+ const dir = mkdtempSync(join(tmpdir(), 'ok-mac-manifest-'));+ dirs.push(dir);+ expect(() => stampMacUpdateManifests(dir)).toThrow(/wrote no macOS update manifest/);+ expect(() => stampMacUpdateManifests(join(dir, 'missing'))).toThrow(+ /wrote no macOS update manifest/,+ );+ });+});diff --git a/packages/desktop/tests/unit/preload-single-entry.test.ts b/packages/desktop/tests/unit/preload-single-entry.test.tsindex 6fd657cf8..b964c68d4 100644--- a/packages/desktop/tests/unit/preload-single-entry.test.ts+++ b/packages/desktop/tests/unit/preload-single-entry.test.ts@@ -8,7 +8,7 @@ import { describe, expect, test } from 'vitest';const desktopRoot = resolve(fileURLToPath(new URL('../../', import.meta.url)));-/* UPSTREAM([email protected]): a sandboxed preload's require resolves only the module names that+/* UPSTREAM([email protected]): a sandboxed preload's require resolves only the module names thatlib/sandboxed_renderer/init.ts maps, and lib/sandboxed_renderer/preload.ts throws"module not found" for any other name, Node builtins such as fs included. */const SANDBOXED_PRELOAD_MODULES = new Set([diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 82cdb1207..1618ba19c 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -1245,8 +1245,8 @@ importers:specifier: ^4.0.2version: 4.0.2electron:- specifier: 43.4.0- version: 43.4.0+ specifier: 44.5.1+ version: 44.5.1electron-builder:specifier: ^26.16.1version: 26.16.1([email protected])@@ -7701,8 +7701,8 @@ packages:resolution: {integrity: sha512-bO3y10YikuUwUuDUQRM4KfwNkKhnpVO7IPdbsrejwN9/AABJzzTQ4GeHwyzNSrVO+tEH3/Np255a3sVZpZDjvg==}engines: {node: '>=8.0.0'}- resolution: {integrity: sha512-3qxGF0CeQbiox5oWV1JlbWGQ1VerbmDhTFqW4sJ8h7uqTHniFYPObXJcDna0DMh32et0fFyKzz0YY8lJv3t5jg==}+ resolution: {integrity: sha512-lx7AYoFIiyvEvgvpyWO9kOC60xtNPpiPZAth6Fmg9NutzpCAMLwpUlaBY2EXfZyIgUdzEmLMj9KvK0Vrokl1yQ==}engines: {node: '>= 22.12.0'}hasBin: true@@ -18227,7 +18227,7 @@ snapshots:transitivePeerDependencies:- supports-colordependencies:'@electron-internal/extract-zip': 1.0.5'@electron/get': 5.1.0