From 953a2abdc7ec08936631c4213ea8f3dd19fbdd04 Mon Sep 17 00:00:00 2001 From: Jubarte Date: Thu, 9 Jul 2026 21:46:56 -0300 Subject: [PATCH] fix: update version and package-lock.json --- README.md | 2 +- package-lock.json | 4 +-- package.json | 3 +- scripts/test-startup-error-isolation.js | 43 +++++++++++++++++++++++++ src/main/main.js | 1 - 5 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 scripts/test-startup-error-isolation.js diff --git a/README.md b/README.md index 91f5da5..0bfcd39 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OpenFlow -Current version: `1.3.040` +Current version: `1.3.044` OpenFlow is a desktop voice dictation app for Windows and macOS built with Electron on the UI layer and Faster-Whisper for local transcription. diff --git a/package-lock.json b/package-lock.json index ee4e29c..9b42b5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "openflow", - "version": "1.3.043", + "version": "1.3.044", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "openflow", - "version": "1.3.043", + "version": "1.3.044", "license": "SEE LICENSE IN LICENSE", "dependencies": { "dotenv": "^17.3.1", diff --git a/package.json b/package.json index b3f12a2..b0d566b 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,13 @@ { "name": "openflow", "productName": "OpenFlow", - "version": "1.3.043", + "version": "1.3.044", "description": "Cross-platform desktop dictation app OpenFlow using Electron and Faster-Whisper.", "main": "src/main/main.js", "scripts": { "start": "electron .", "check": "node --check src/main/main.js && node --check src/main/preload.js && node --check src/main/overlay-preload.js && node --check src/renderer/renderer.js && node --check src/renderer/overlay.js", + "test:startup-error-isolation": "node scripts/test-startup-error-isolation.js", "test:duck-restore": "node scripts/test-duck-restore.js", "build:icons": "node scripts/build-icons.js", "build:python": "node scripts/build-python.js", diff --git a/scripts/test-startup-error-isolation.js b/scripts/test-startup-error-isolation.js new file mode 100644 index 0000000..5556d4c --- /dev/null +++ b/scripts/test-startup-error-isolation.js @@ -0,0 +1,43 @@ +'use strict'; + +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); + +const mainPath = path.join(__dirname, '..', 'src', 'main', 'main.js'); +const source = fs.readFileSync(mainPath, 'utf8'); + +function getFunctionSource(name) { + const marker = `async function ${name}(`; + const start = source.indexOf(marker); + assert.notStrictEqual(start, -1, `${name} was not found in main.js`); + + const bodyStart = source.indexOf('{', start); + let depth = 0; + for (let index = bodyStart; index < source.length; index += 1) { + if (source[index] === '{') depth += 1; + if (source[index] === '}') depth -= 1; + if (depth === 0) return source.slice(start, index + 1); + } + + throw new Error(`Could not parse ${name} from main.js`); +} + +const refreshSource = getFunctionSource('refreshOpenRouterModels'); +const catchMatch = refreshSource.match(/catch\s*\(error\)\s*{([\s\S]*?)\n\s*}/); + +assert(catchMatch, 'refreshOpenRouterModels must handle fetch failures'); +assert( + /openRouterModelsStatus\s*:\s*'error'/.test(catchMatch[1]), + 'OpenRouter failures must remain visible in the cloud-model settings', +); +assert( + /openRouterModelsError\s*:/.test(catchMatch[1]), + 'OpenRouter failures must be stored in openRouterModelsError', +); +assert( + !/(^|\n)\s*error\s*:/.test(catchMatch[1]), + 'An optional OpenRouter lookup must not overwrite the dictation engine error', +); + +console.log('PASS: OpenRouter startup fetch failures are isolated from the dictation engine state.'); diff --git a/src/main/main.js b/src/main/main.js index d97eb38..753ea2c 100644 --- a/src/main/main.js +++ b/src/main/main.js @@ -1794,7 +1794,6 @@ async function refreshOpenRouterModels() { setState({ openRouterModelsStatus: 'error', openRouterModelsError: String((error && error.message) || error), - error: String((error && error.message) || error), }); }