Skip to content

fix: update version and package-lock.json#13

Merged
MusicMaster4 merged 1 commit into
mainfrom
testing
Jul 10, 2026
Merged

fix: update version and package-lock.json#13
MusicMaster4 merged 1 commit into
mainfrom
testing

Conversation

@MusicMaster4

Copy link
Copy Markdown
Owner

fix: update version and package-lock.json

@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown

Greptile Summary

This PR bumps the version from 1.3.043 to 1.3.044 and fixes a bug where a failed OpenRouter API fetch would inadvertently overwrite state.error, masking or corrupting the dictation engine's error state.

  • Bug fix in main.js: removes error: ... from the catch block of refreshOpenRouterModels, so OpenRouter lookup failures now only update OpenRouter-specific state (openRouterModelsStatus, openRouterModelsError) and leave the core dictation engine error state untouched.
  • New test script (scripts/test-startup-error-isolation.js) is added to assert the fix holds, and a corresponding test:startup-error-isolation npm script is wired up in package.json.

Confidence Score: 4/5

Safe to merge. The one-line removal in main.js is clearly correct, and the test script validates the fix. A minor fragility in the test regex is the only thing worth noting.

The core change is a single-line removal that prevents an optional background fetch from clobbering the dictation engine's error state — straightforward and well-motivated. The accompanying test covers the specific regression but uses a non-greedy regex that only inspects the first brace-delimited section of the catch block, leaving a small blind spot if the block is ever extended.

scripts/test-startup-error-isolation.js — the catch-block regex could miss assertions if the catch body grows; worth tightening before the test pattern is copied elsewhere.

Important Files Changed

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
Loading
%%{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
Loading
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*}/);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

@MusicMaster4 MusicMaster4 merged commit 5de8b28 into main Jul 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant