Skip to content

Fix Windows Development Build Issues#1657

Open
ThisuraGallage wants to merge 2 commits intowso2:release/bi-1.8.xfrom
ThisuraGallage:fix-windows-dev-setup
Open

Fix Windows Development Build Issues#1657
ThisuraGallage wants to merge 2 commits intowso2:release/bi-1.8.xfrom
ThisuraGallage:fix-windows-dev-setup

Conversation

@ThisuraGallage
Copy link

@ThisuraGallage ThisuraGallage commented Mar 10, 2026

Purpose

Windows compatibility fixes for dev setup.

  • webview-utils.ts: Use template literals instead of path.join for dev server URLs to
    prevent Windows backslash corruption
  • download-choreo-cli.js: Use double quotes in tar command for compatibility with cmd.exe
    and PowerShell

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

UI Component Development

Specify the reason if following are not followed.

  • Added reusable UI components to the ui-toolkit. Follow the intructions when adding the componenent.
  • Use ui-toolkit components wherever possible. Run npm run storybook from the root directory to view current components.
  • Matches with the native VSCode look and feel.

Manage Icons

Specify the reason if following are not followed.

  • Added Icons to the font-wso2-vscode. Follow the instructions.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed the CLI download process so archive extraction correctly handles file paths with spaces.
  • Chores

    • Improved development-mode resource URL handling to make local extension assets resolve more reliably during development.

@CLAassistant
Copy link

CLAassistant commented Mar 10, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2308acba-32d8-46d5-8ac7-ec049b7f8ad6

📥 Commits

Reviewing files that changed from the base of the PR and between 8942a20 and 681dfed.

📒 Files selected for processing (1)
  • workspaces/ballerina/ballerina-extension/src/utils/webview-utils.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • workspaces/ballerina/ballerina-extension/src/utils/webview-utils.ts

📝 Walkthrough

Walkthrough

Replaced dev-mode CSS/JS URL construction in the webview util to resolve via new URL(..., devHost). Also adjusted tar extraction quoting to use double quotes around archive and extract paths in the CLI download script.

Changes

Cohort / File(s) Summary
Webview URL construction
workspaces/ballerina/ballerina-extension/src/utils/webview-utils.ts
Dev-mode CSS/JS URLs now use new URL(..., devHost).toString() for absolute URL resolution; non-dev paths continue to use webView.asWebviewUri unchanged.
CLI script quoting
workspaces/wso2-platform/wso2-platform-extension/scripts/download-choreo-cli.js
Tar extraction command updated to use double quotes around archivePath and tmpExtractDir to preserve paths with spaces.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped through code with nimble paws,
URLs fixed their curious flaws;
Quotes went double, tar sings free,
Tiny hops, big harmony.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description includes a Purpose section with specific details about the fixes, but most other required template sections (Goals, Approach, User stories, Release note, Documentation, Testing, Security checks, etc.) are left as empty placeholders. Complete the remaining template sections: provide Goals, Approach, Release notes, Documentation, Security checks, Test environment details, and other applicable sections to meet the repository's PR documentation standards.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix Windows Development Build Issues' directly aligns with the PR's purpose of resolving Windows compatibility problems in the development setup.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use oxc to improve the quality of JavaScript and TypeScript code reviews.

Add a configuration file to your project to customize how CodeRabbit runs oxc.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
workspaces/ballerina/ballerina-extension/src/utils/webview-utils.ts (1)

141-141: Consider using join() consistently for the file path.

The manual concatenation with sep works but is inconsistent with the approach on line 133.

♻️ Optional simplification
-    const filePath = join((extension.ballerinaExtInstance.context as ExtensionContext).extensionPath, 'resources', 'jslibs') + sep + componentName + '.js';
+    const filePath = join((extension.ballerinaExtInstance.context as ExtensionContext).extensionPath, 'resources', 'jslibs', `${componentName}.js`);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@workspaces/ballerina/ballerina-extension/src/utils/webview-utils.ts` at line
141, The filePath construction manually concatenates sep instead of using
path.join consistently; update the assignment of filePath (the const named
filePath in webview-utils.ts) to build the full path using join(...) for all
segments (extension.ballerinaExtInstance.context as
ExtensionContext).extensionPath, 'resources', 'jslibs', and componentName +
'.js' so it uses join for cross-platform correctness and consistency with the
earlier usage on line 133.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@workspaces/ballerina/ballerina-extension/src/utils/webview-utils.ts`:
- Line 141: The filePath construction manually concatenates sep instead of using
path.join consistently; update the assignment of filePath (the const named
filePath in webview-utils.ts) to build the full path using join(...) for all
segments (extension.ballerinaExtInstance.context as
ExtensionContext).extensionPath, 'resources', 'jslibs', and componentName +
'.js' so it uses join for cross-platform correctness and consistency with the
earlier usage on line 133.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5a186009-7847-422a-8051-bb5c37295794

📥 Commits

Reviewing files that changed from the base of the PR and between 2dbfa3d and 8942a20.

📒 Files selected for processing (2)
  • workspaces/ballerina/ballerina-extension/src/utils/webview-utils.ts
  • workspaces/wso2-platform/wso2-platform-extension/scripts/download-choreo-cli.js

@axewilledge axewilledge requested a review from Copilot March 10, 2026 07:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Windows compatibility fixes for dev setup by preventing Windows path separators/backslash issues in dev URLs and improving tar extraction quoting.

Changes:

  • Construct dev-mode resource URLs via template literals instead of path.join to avoid \ in URLs on Windows.
  • Quote tar arguments with double quotes to work in cmd.exe/PowerShell when paths include spaces.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
workspaces/wso2-platform/wso2-platform-extension/scripts/download-choreo-cli.js Updates tar extraction command quoting for Windows shell compatibility.
workspaces/ballerina/ballerina-extension/src/utils/webview-utils.ts Replaces join() URL construction with template-literal URLs in dev mode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

try {
if (platform.ext === '.tar.gz') {
execSync(`tar -xzf '${archivePath}' -C '${tmpExtractDir}'`, { stdio: 'inherit' });
execSync(`tar -xzf "${archivePath}" -C "${tmpExtractDir}"`, { stdio: 'inherit' });
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

Using execSync with interpolated paths can break when archivePath or tmpExtractDir contains double quotes, and it also increases command-injection risk if those values are ever influenced externally. Prefer execFileSync('tar', ['-xzf', archivePath, '-C', tmpExtractDir], { stdio: 'inherit' }) (or spawnSync) to avoid shell parsing/quoting issues entirely.

Copilot uses AI. Check for mistakes.
const filePath = join((extension.ballerinaExtInstance.context as ExtensionContext).extensionPath, 'resources', 'jslibs', 'themes', 'ballerina-default.min.css');
return [
(isDevMode && !disableComDebug) ? join(devHost, 'themes', 'ballerina-default.min.css')
(isDevMode && !disableComDebug) ? `${devHost}/themes/ballerina-default.min.css`
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

If devHost is configured with a trailing slash (e.g., http://localhost:port/), this will produce a double-slash URL (...//themes/...). Consider normalizing devHost (trim trailing /) once, or use new URL('/themes/ballerina-default.min.css', devHost).toString() to build a correct URL robustly.

Copilot uses AI. Check for mistakes.
const filePath = join((extension.ballerinaExtInstance.context as ExtensionContext).extensionPath, 'resources', 'jslibs') + sep + componentName + '.js';
return [
(isDevMode && !disableComDebug) ? join(devHost, componentName + '.js')
(isDevMode && !disableComDebug) ? `${devHost}/${componentName}.js`
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

Same URL-joining issue as above: a trailing slash in devHost will yield ...//<component>.js, and special characters in componentName aren’t URL-encoded. Consider using new URL(\/${componentName}.js`, devHost).toString()(and ensurecomponentName` is a safe path segment) for consistent URL construction.

Copilot uses AI. Check for mistakes.
@ThisuraGallage ThisuraGallage changed the title Fix Windows path issues Fix Windows path issues in development build Mar 10, 2026
@ThisuraGallage ThisuraGallage changed the title Fix Windows path issues in development build Fix Windows Development Build Issues Mar 10, 2026
@kanushka
Copy link
Contributor

This change will break on other operating systems. We should use URL join utils instead of adding direct paths.

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.

4 participants