Sync Windows hotfix to release/bi-1.8.x#1568
Sync Windows hotfix to release/bi-1.8.x#1568kanushka wants to merge 15 commits intorelease/bi-1.8.xfrom
Conversation
…g specific errors encountered during directory access.
…cy specifications for various packages
…r both mi-extension and mi-visualizer
… autoinstaller Add pnpm override to force fast-xml-parser to 5.3.7 in rush-plugins and regenerate lockfile using rush update-autoinstaller. Co-authored-by: Cursor <cursoragent@cursor.com>
[Hotfix] Enhance Windows environment detection in BallerinaExtension
|
|
📝 WalkthroughWalkthroughThe PR releases Ballerina extension version 5.8.1 with enhanced Windows environment detection for locating Ballerina distributions, pins fast-xml-parser to 5.3.7 across configurations, and updates documentation accordingly. Changes
Sequence Diagram(s)sequenceDiagram
participant Ext as Ballerina Extension
participant Sys as Windows System
participant Reg as Registry
participant FS as File System
participant Env as Environment
Ext->>Sys: Check if Windows & no ballerinaHome
Ext->>Reg: Query PATH entries for bal.bat
alt bal.bat found in registry
Reg-->>Ext: Return registry PATH
else Not in registry
Ext->>FS: Check common install directories<br/>(LOCALAPPDATA, ProgramFiles, etc.)
FS-->>Ext: Return bin directory path
end
Ext->>Reg: Read Machine & User PATH values
Reg-->>Env: Merge Path entries
Env-->>Ext: Return combined environment
Ext->>Ext: Set distPath for version detection
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ensions into hotfix/windows-fix
There was a problem hiding this comment.
🧹 Nitpick comments (2)
common/config/rush/.pnpmfile.cjs (1)
37-57: Pre-existing duplicate override entries fordiff,eslint, andlodash.Both the
dependenciesanddevDependenciesblocks contain duplicateifchecks fordiff(lines 37–38 & 52–53),eslint(lines 40–41 & 55–56), andlodash(lines 46–47 & 61–62) — mirrored again in thedevDependenciessection. The second occurrence silently overwrites the first with the same value, so there's no functional bug, but it adds confusion and maintenance risk if future bumps only update one of the two occurrences.Also applies to: 88-108
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@common/config/rush/.pnpmfile.cjs` around lines 37 - 57, The diff shows duplicate conditional overrides for packages in the pnpmfile (e.g., duplicate if-blocks checking pkg.dependencies['diff'], ['eslint'], ['lodash'] and the mirrored duplicates in pkg.devDependencies); remove the redundant repeated checks so each package is normalized only once per dependency block (or consolidate into a small helper loop that iterates a map of package->version and applies it to pkg.dependencies and pkg.devDependencies), updating the code around the existing pkg.dependencies and pkg.devDependencies logic (references: pkg.dependencies, pkg.devDependencies, package keys 'diff', 'eslint', 'lodash', 'fast-xml-parser', 'qs') so future bumps only need a single place to change.workspaces/ballerina/ballerina-extension/src/core/extension.ts (1)
2716-2780: Remove the unsubstantiated duplication claim; the dual PowerShell spawns concern is valid.
findWindowsBallerinaPath()is defined only once in this file (line 2716), so the AI-generated summary about duplication is incorrect.However, the concern about dual PowerShell spawns is accurate: during extension activation on Windows,
syncEnvironment()(line 1706) callsgetShellEnvironment()to read environment variables via PowerShell, and thenfindWindowsBallerinaPath()(line 1809) spawns PowerShell again to scan for Ballerina in the registry PATH. Each call has a 10 s timeout, creating potential startup latency. Consider caching or combining these registry reads in a follow-up to reduce activation latency.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@workspaces/ballerina/ballerina-extension/src/core/extension.ts` around lines 2716 - 2780, The review incorrectly claims findWindowsBallerinaPath is duplicated; however the real issue is that syncEnvironment -> getShellEnvironment and findWindowsBallerinaPath both spawn PowerShell (each with a 10s timeout), causing potential double startup latency; update the code to avoid two separate PowerShell calls by consolidating registry PATH reads (or caching the result) so findWindowsBallerinaPath reuses the environment/registry data obtained by getShellEnvironment (or expose a shared helper that performs the single PowerShell invocation and returns PATH entries) and adjust syncEnvironment/getShellEnvironment to use that shared result instead of spawning PowerShell again.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@common/config/rush/.pnpmfile.cjs`:
- Around line 37-57: The diff shows duplicate conditional overrides for packages
in the pnpmfile (e.g., duplicate if-blocks checking pkg.dependencies['diff'],
['eslint'], ['lodash'] and the mirrored duplicates in pkg.devDependencies);
remove the redundant repeated checks so each package is normalized only once per
dependency block (or consolidate into a small helper loop that iterates a map of
package->version and applies it to pkg.dependencies and pkg.devDependencies),
updating the code around the existing pkg.dependencies and pkg.devDependencies
logic (references: pkg.dependencies, pkg.devDependencies, package keys 'diff',
'eslint', 'lodash', 'fast-xml-parser', 'qs') so future bumps only need a single
place to change.
In `@workspaces/ballerina/ballerina-extension/src/core/extension.ts`:
- Around line 2716-2780: The review incorrectly claims findWindowsBallerinaPath
is duplicated; however the real issue is that syncEnvironment ->
getShellEnvironment and findWindowsBallerinaPath both spawn PowerShell (each
with a 10s timeout), causing potential double startup latency; update the code
to avoid two separate PowerShell calls by consolidating registry PATH reads (or
caching the result) so findWindowsBallerinaPath reuses the environment/registry
data obtained by getShellEnvironment (or expose a shared helper that performs
the single PowerShell invocation and returns PATH entries) and adjust
syncEnvironment/getShellEnvironment to use that shared result instead of
spawning PowerShell again.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
common/autoinstallers/rush-plugins/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlcommon/config/rush/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (6)
.trivyignorecommon/autoinstallers/rush-plugins/package.jsoncommon/config/rush/.pnpmfile.cjsworkspaces/ballerina/ballerina-extension/CHANGELOG.mdworkspaces/ballerina/ballerina-extension/package.jsonworkspaces/ballerina/ballerina-extension/src/core/extension.ts
Purpose
Update the
release/bi-1.8.xbranch with the Windows activation hotfix.Changes
Summary by CodeRabbit
Release Notes
Bug Fixes
Chores