fix: update version and package-lock.json#13
Conversation
|
| Filename | Overview |
|---|---|
| src/main/main.js | Removes erroneous error: property assignment from OpenRouter fetch catch block, preventing it from clobbering the dictation engine error state. |
| scripts/test-startup-error-isolation.js | New test script verifying the catch-block fix; uses a regex that only captures content up to the first inner }, which could miss a re-introduction of error: placed after the first nested brace. |
| package.json | Version bumped to 1.3.044 and new test script entry added; consistent with package-lock.json. |
| package-lock.json | Version bumped to 1.3.044 in both root and packages[""] entries; consistent with package.json. |
| README.md | Current version string updated from 1.3.040 to 1.3.044; README was behind by several patch versions but is now in sync. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[refreshOpenRouterModels called] --> B[fetchOpenRouterModelsFromApi]
B -->|success| C["setState: openRouterModels, cloudTranscriptionModel, openRouterModelsStatus = ready"]
C --> D[savePersistentState]
B -->|catch error| E["setState: openRouterModelsStatus = 'error', openRouterModelsError = msg"]
E --> F["state.error unchanged ✅ (bug fix: was being overwritten before)"]
D --> G[return snapshotState]
F --> G
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[refreshOpenRouterModels called] --> B[fetchOpenRouterModelsFromApi]
B -->|success| C["setState: openRouterModels, cloudTranscriptionModel, openRouterModelsStatus = ready"]
C --> D[savePersistentState]
B -->|catch error| E["setState: openRouterModelsStatus = 'error', openRouterModelsError = msg"]
E --> F["state.error unchanged ✅ (bug fix: was being overwritten before)"]
D --> G[return snapshotState]
F --> G
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
scripts/test-startup-error-isolation.js:27
**Catch-block regex may miss content after the first inner brace**
The non-greedy `[\s\S]*?` terminates at the first `\n\s*}` encountered inside the catch block — currently the closing brace of the `setState({…})` call. Any code added after that inner `}` (e.g. a second `setState({ error: … })`) would fall outside `catchMatch[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 of `refreshSource`) would capture the entire catch body reliably.
Reviews (1): Last reviewed commit: "fix: update version and package-lock.jso..." | Re-trigger Greptile
| } | ||
|
|
||
| const refreshSource = getFunctionSource('refreshOpenRouterModels'); | ||
| const catchMatch = refreshSource.match(/catch\s*\(error\)\s*{([\s\S]*?)\n\s*}/); |
There was a problem hiding this comment.
Catch-block regex may miss content after the first inner brace
The non-greedy [\s\S]*? terminates at the first \n\s*} encountered inside the catch block — currently the closing brace of the setState({…}) call. Any code added after that inner } (e.g. a second setState({ error: … })) would fall outside catchMatch[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 of refreshSource) would capture the entire catch body reliably.
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/test-startup-error-isolation.js
Line: 27
Comment:
**Catch-block regex may miss content after the first inner brace**
The non-greedy `[\s\S]*?` terminates at the first `\n\s*}` encountered inside the catch block — currently the closing brace of the `setState({…})` call. Any code added after that inner `}` (e.g. a second `setState({ error: … })`) would fall outside `catchMatch[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 of `refreshSource`) would capture the entire catch body reliably.
How can I resolve this? If you propose a fix, please make it concise.
fix: update version and package-lock.json