Skip to content

[CI] [FIX] Functionality for Finding Conflicts on Windows - #76

Merged
Avni2000 merged 16 commits into
mainfrom
ci-windows
Feb 11, 2026
Merged

Avni2000 merged 16 commits into
mainfrom
ci-windows

Conversation

@Avni2000

@Avni2000 Avni2000 commented Feb 11, 2026 •

Copy link
Copy Markdown
Owner
  • Integration tests run on windows
  • Fixes multiple Caching problems
  • Correctly finds notebooks with conflicts on Windows

closes #70

Summary by CodeRabbit

  • Tests

    • Integration tests now run on both Linux and Windows with platform-specific execution and improved caching for faster, more reliable CI.
  • Bug Fixes

    • Server startup more reliable: binds to the IPv4 loopback and records port in the OS temp directory for consistent cross-platform behavior.
  • Improvements

    • Enhanced diagnostics and verbose logging across conflict detection, git operations, test harness, and server health checks to aid troubleshooting.
  • Chores

    • CI and tooling updates to modernize workflows and caching.

@coderabbitai

coderabbitai Bot commented Feb 11, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds an OS matrix to the integration-test CI workflow with OS-specific caching and test flows; changes web server to bind 127.0.0.1 and write port file to os.tmpdir(); and adds extensive logging and cross-platform path normalization in git integration, resolver, tests, and test harness code.

Changes

Cohort / File(s) Summary
CI Workflow
​.github/workflows/vscode-integration-test.yml
Replaces single ubuntu runner with an os matrix (ubuntu-latest, windows-latest); updates actions versions; adds OS-specific apt/Xvfb and Playwright install steps; introduces multi-key caching for npm, node_modules, Playwright browsers, and VS Code test resources; computes npm cache dir dynamically; reorders build/test steps per-OS.
Web server
src/web/webServer.ts
Imports os, changes default host to 127.0.0.1, writes port file into os.tmpdir(), and adds console logs for port-file writes and errors.
Git integration & path handling
src/gitIntegration.ts
Adds path normalization helpers (toGitPath, resolveRealPath, normalizeStatusPath, git-relative computations); logs git operations; populates new isUnmerged: boolean in GitFileStatus; updates version/three-way helpers to use normalized git paths.
Resolver & extension command logs
src/resolver.ts, src/extension.ts
Adds verbose debug logs when scanning for conflicted notebooks and inside merge-nb.findConflicts command path; no control-flow changes.
Tests / harness / repo setup
src/tests/testHelpers.ts, src/tests/testHarness.ts, src/tests/repoSetup.ts
Adds extensive diagnostic logging around git commands and merge creation; waitForServer and checkHealth now actively validate server health and log retries/timeouts; test harness logs port discovery and server wait states.
UI test support
src/web/WebConflictPanel.ts
Adds logs in _openInBrowser to indicate server start status and when opening the browser.
Package metadata
package.json
Bumps engines.vscode and @types/vscode references from 1.109.0 to 1.60.0.

Sequence Diagram(s)

sequenceDiagram
  participant CI as CI Matrix
  participant Runner as Runner (OS)
  participant Checkout as Checkout/Actions
  participant Cache as Cache Store
  participant Node as Node/npm
  participant Playwright as Playwright/Browsers
  participant Xvfb as Xvfb (Linux)
  participant Tests as Integration Tests

  CI->>Runner: start job (os: ubuntu/windows)
  Runner->>Checkout: checkout repo & setup actions
  Runner->>Cache: restore npm/node_modules/playwright/vscode caches (OS-specific keys)
  alt cache miss npm
    Runner->>Node: discover npm cache dir, install deps
    Node->>Cache: save npm cache
  end
  alt cache miss playwright
    Runner->>Playwright: install browsers & deps
    Playwright->>Cache: save playwright browser cache (per-OS)
  end
  Runner->>Node: build project
  Runner->>Cache: save build artifacts
  alt os is linux
    Runner->>Xvfb: start Xvfb
    Xvfb->>Tests: run integration tests (uses Xvfb)
  else os is windows
    Runner->>Tests: run integration tests (no Xvfb)
  end
  Tests->>Cache: upload test artifacts / results
  Runner->>CI: complete job
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I hopped through runners, Ubuntu and Win,
I bound to 127.0.0.1 with a grin,
I logged every git step and retry,
Xvfb for Linux, on Windows we fly,
Carrots and caches — hop, build, and spin! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 73.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the main objective: enabling integration tests and conflict detection on Windows. It clearly indicates both the scope ([CI] for workflow changes) and the primary fix (Windows functionality).
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ci-windows

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.

@Avni2000

Copy link
Copy Markdown
Owner Author

closes #70

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
.github/workflows/vscode-integration-test.yml (2)

35-39: ⚠️ Potential issue | 🟠 Major

Playwright browser cache path is Linux-specific; Windows stores browsers elsewhere.

On Windows, Playwright caches browsers under %LOCALAPPDATA%\ms-playwright (i.e. ~/AppData/Local/ms-playwright), not ~/.cache/ms-playwright. The Windows job will never get a cache hit.

You can set PLAYWRIGHT_BROWSERS_PATH to a fixed cross-platform location, or use a conditional path expression:

Suggested change
       - name: Cache Playwright browsers
         uses: actions/cache@v5
         with:
-          path: ~/.cache/ms-playwright
+          path: ${{ runner.os == 'Windows' && '~/AppData/Local/ms-playwright' || '~/.cache/ms-playwright' }}
           key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }}

55-58: ⚠️ Potential issue | 🟠 Major

playwright install-deps should be guarded with a Linux conditional.

npx playwright install-deps installs OS-level system packages via apt-get and is only meaningful on Linux. On Windows it is a no-op and unnecessary, and on WSL it will attempt to use apt-get. Guard this step to run only on Linux to avoid wasting time and potential issues.

Suggested change
-      - name: Install Playwright deps and browsers
+      - name: Install Playwright system deps (Linux)
+        if: runner.os == 'Linux'
         run: |
           npx playwright install-deps
+
+      - name: Install Playwright browsers
+        run: |
           npx playwright install
🤖 Fix all issues with AI agents
In @.github/workflows/vscode-integration-test.yml:
- Around line 27-33: Replace the hardcoded path in the "Cache npm deps" step so
Windows uses the actual npm cache: add a prior step named "Get npm cache
directory" with id npm-cache-dir that runs a bash command to set dir=$(npm
config get cache) into $GITHUB_OUTPUT, ensure that step uses shell: bash, and
then update the "Cache npm deps" step to use the dynamic path from ${{
steps.npm-cache-dir.outputs.dir }} instead of ~/.npm so the cache works
cross-platform.
🧹 Nitpick comments (1)
.github/workflows/vscode-integration-test.yml (1)

10-13: Consider setting fail-fast: false so both OS jobs run to completion.

With the default fail-fast: true, a failure on one OS cancels the other, which makes it harder to assess the state of both platforms simultaneously—especially while stabilizing a newly added Windows target.

Suggested change
     strategy:
+      fail-fast: false
       matrix:
         os: [ubuntu-latest, windows-latest]

@Avni2000

Copy link
Copy Markdown
Owner Author

@coderabbitai it looks like playwright also isn't being cached. Any suggestions?

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
.github/workflows/vscode-integration-test.yml (2)

40-44: ⚠️ Potential issue | 🟠 Major

Playwright cache path ~/.cache/ms-playwright won't hit on Windows.

Same class of issue as the npm cache path that was already fixed: on Windows, Playwright stores browsers under %USERPROFILE%\AppData\Local\ms-playwright by default, so ~/.cache/ms-playwright will never match.

You can use the PLAYWRIGHT_BROWSERS_PATH env var to normalize the path, or resolve it dynamically similar to the npm cache fix.

Suggested approach

Set a consistent PLAYWRIGHT_BROWSERS_PATH env at the job level and reference it in the cache step:

   integration:
+    env:
+      PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright-browsers
     strategy:
       matrix:
         os: [ubuntu-latest, windows-latest]
       - name: Cache Playwright browsers
         uses: actions/cache@v5
         with:
-          path: ~/.cache/ms-playwright
+          path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
           key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }}

60-63: ⚠️ Potential issue | 🟠 Major

Gate playwright install-deps to Linux only; Windows requires a separate step.

npx playwright install-deps installs system-level browser dependencies and is only supported on Linux. Running it on Windows will fail. Use npx playwright install on Windows instead.

Suggested fix
-      - name: Install Playwright deps and browsers
+      - name: Install Playwright system deps and browsers (Linux)
+        if: runner.os == 'Linux'
         run: |
           npx playwright install-deps
           npx playwright install
+
+      - name: Install Playwright browsers (Windows)
+        if: runner.os == 'Windows'
+        run: npx playwright install

@coderabbitai

coderabbitai Bot commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Read the workflow file to examine the caching configuration
cat .github/workflows/vscode-integration-test.yml

Length of output: 1927


@Avni2000, you're correct! The Playwright cache path is hardcoded to ~/.cache/ms-playwright (Line 37), which only works on Linux/macOS. On Windows, Playwright stores browsers in %USERPROFILE%\AppData\Local\ms-playwright.

Here's how to fix it - add a step to dynamically get the Playwright cache directory, similar to what you did for npm:

- name: Get Playwright cache directory
  id: playwright-cache-dir
  shell: bash
  run: |
    if [ "$RUNNER_OS" == "Windows" ]; then
      echo "dir=$USERPROFILE/AppData/Local/ms-playwright" >> "$GITHUB_OUTPUT"
    else
      echo "dir=~/.cache/ms-playwright" >> "$GITHUB_OUTPUT"
    fi

- name: Cache Playwright browsers
  uses: actions/cache@v5
  with:
    path: ${{ steps.playwright-cache-dir.outputs.dir }}
    key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }}

Alternatively, you could use Playwright's environment variable approach:

- name: Cache Playwright browsers
  uses: actions/cache@v5
  with:
    path: |
      ~/.cache/ms-playwright
      ~/AppData/Local/ms-playwright
    key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }}

The first approach is cleaner and more explicit. Would you like me to help plan these changes?

@Avni2000 Avni2000 changed the title [CI] Add windows [CI] [FIX] Functionality for Finding Conflicts on Windows Feb 11, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/gitIntegration.ts (1)

197-202: ⚠️ Potential issue | 🟠 Major

Shell injection risk in git show commands.

The relativePath is interpolated directly into shell command strings. On Unix, double quotes in shell commands still allow $() and backtick expansion. A crafted filename could execute arbitrary commands.

Consider using execFile (which bypasses shell interpretation) instead of exec:

Proposed fix (example for getBaseVersion)
-        const { stdout } = await execAsync(`git show :1:"${relativePath}"`, { 
-            cwd: gitRoot,
-            encoding: 'utf8',
-            maxBuffer: 10 * 1024 * 1024
-        });
+        const { stdout } = await execFileAsync('git', ['show', `:1:${relativePath}`], { 
+            cwd: gitRoot,
+            encoding: 'utf8',
+            maxBuffer: 10 * 1024 * 1024
+        });

Add at the top of the file:

import { execFile } from 'child_process';
const execFileAsync = promisify(execFile);

Apply the same pattern to getcurrentVersion, getincomingVersion, and the git status/git rev-parse calls.

Also applies to: 220-225, 242-247

🤖 Fix all issues with AI agents
In @.github/workflows/vscode-integration-test.yml:
- Around line 63-69: The Playwright cache step uses `${{ env.USERPROFILE }}`
which doesn't resolve system env vars so the Windows cache path never matches;
add a preparatory step (e.g., "Get Playwright cache directory" with id
`playwright-cache-dir`) that detects RUNNER_OS and emits an output `dir` (via
GITHUB_OUTPUT) pointing to the correct ms-playwright cache
(`%LOCALAPPDATA%/ms-playwright` on Windows, `$HOME/.cache/ms-playwright` on
others), then replace the OS-specific cache steps (`playwright-cache-windows` /
`playwright-cache-linux`) with a single cache step `playwright-cache` that uses
`path: ${{ steps.playwright-cache-dir.outputs.dir }}` and keep the same cache
key so downstream steps reference `steps.playwright-cache`.

In `@src/gitIntegration.ts`:
- Around line 63-71: normalizeStatusPath currently only unescapes \" and \\ but
git --porcelain can emit C-style escapes (e.g., \t, \n, \r) and octal sequences
like \303\251 for non-ASCII bytes; update normalizeStatusPath to fully unescape
git-quoted paths by implementing a decode function (e.g., decodeGitQuoted or
unescapeGitPath) that handles common escape sequences (\a,\b,\f,\n,\r,\t, \v),
unescapes \" and \\, and converts octal byte sequences (\[0-7]{1,3}) into the
corresponding bytes then decodes them as UTF-8 before passing to toGitPath;
replace the inline replace calls in normalizeStatusPath with a call to this
decoder (refer to normalizeStatusPath and toGitPath to locate where to plug it
in).
🧹 Nitpick comments (2)
.github/workflows/vscode-integration-test.yml (1)

8-12: Consider adding fail-fast: false to the matrix strategy.

With the default fail-fast: true, a failure on one OS cancels the other job. For cross-platform debugging, you typically want both to complete so you can see all failures at once.

Suggested change
     strategy:
+      fail-fast: false
       matrix:
         os: [ubuntu-latest, windows-latest]
src/gitIntegration.ts (1)

98-108: Consider gating verbose logging behind a debug flag.

The extensive console.log output is helpful for CI debugging but will be noisy in production. Consider using a debug flag, VS Code's LogOutputChannel, or checking an environment variable so this doesn't flood output for end users.

Also applies to: 112-123, 125-128, 152-163, 167-172

Comment thread src/gitIntegration.ts
Comment on lines +63 to +71
function normalizeStatusPath(statusPath: string): string {
let normalized = statusPath.trim();

if (normalized.startsWith('"') && normalized.endsWith('"')) {
normalized = normalized.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}

return toGitPath(normalized);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

normalizeStatusPath doesn't handle all git-quoted escape sequences.

Git's --porcelain output can also produce octal escapes (e.g., \303\251 for é) and other sequences like \t, \n for paths with special characters. Currently only \" and \\ are unescaped. This is a minor edge case since notebook filenames rarely contain such characters, but worth noting.

🤖 Prompt for AI Agents
In `@src/gitIntegration.ts` around lines 63 - 71, normalizeStatusPath currently
only unescapes \" and \\ but git --porcelain can emit C-style escapes (e.g., \t,
\n, \r) and octal sequences like \303\251 for non-ASCII bytes; update
normalizeStatusPath to fully unescape git-quoted paths by implementing a decode
function (e.g., decodeGitQuoted or unescapeGitPath) that handles common escape
sequences (\a,\b,\f,\n,\r,\t, \v), unescapes \" and \\, and converts octal byte
sequences (\[0-7]{1,3}) into the corresponding bytes then decodes them as UTF-8
before passing to toGitPath; replace the inline replace calls in
normalizeStatusPath with a call to this decoder (refer to normalizeStatusPath
and toGitPath to locate where to plug it in).

@Avni2000
Avni2000 merged commit 2880aac into main Feb 11, 2026
2 checks passed
@Avni2000
Avni2000 deleted the ci-windows branch March 1, 2026 01:39
@coderabbitai coderabbitai Bot mentioned this pull request Mar 1, 2026
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.

Investigate if checking git UU on windows works

1 participant