-
Notifications
You must be signed in to change notification settings - Fork 0
fix: update version and package-lock.json #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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.'); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The non-greedy
[\s\S]*?terminates at the first\n\s*}encountered inside the catch block — currently the closing brace of thesetState({…})call. Any code added after that inner}(e.g. a secondsetState({ error: … })) would fall outsidecatchMatch[1], so the negative assertion on line 40 would silently pass even if the bug were re-introduced in that form. Using a greedy[\s\S]*instead (and anchoring the close to the last}before the end ofrefreshSource) would capture the entire catch body reliably.Prompt To Fix With AI