Repository navigation
[CI] [FIX] Functionality for Finding Conflicts on Windows - #76
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds 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
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
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 |
|
closes #70 |
There was a problem hiding this comment.
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 | 🟠 MajorPlaywright 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_PATHto 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-depsshould be guarded with a Linux conditional.
npx playwright install-depsinstalls OS-level system packages viaapt-getand is only meaningful on Linux. On Windows it is a no-op and unnecessary, and on WSL it will attempt to useapt-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 settingfail-fast: falseso 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]
|
@coderabbitai it looks like playwright also isn't being cached. Any suggestions? |
There was a problem hiding this comment.
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 | 🟠 MajorPlaywright cache path
~/.cache/ms-playwrightwon'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-playwrightby default, so~/.cache/ms-playwrightwill never match.You can use the
PLAYWRIGHT_BROWSERS_PATHenv var to normalize the path, or resolve it dynamically similar to the npm cache fix.Suggested approach
Set a consistent
PLAYWRIGHT_BROWSERS_PATHenv 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 | 🟠 MajorGate
playwright install-depsto Linux only; Windows requires a separate step.
npx playwright install-depsinstalls system-level browser dependencies and is only supported on Linux. Running it on Windows will fail. Usenpx playwright installon 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
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 1927
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? |
- Short/Long windows path mismatches
This reverts commit 9987c84.
There was a problem hiding this comment.
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 | 🟠 MajorShell injection risk in
git showcommands.The
relativePathis 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 ofexec: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 thegit status/git rev-parsecalls.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 addingfail-fast: falseto 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.logoutput is helpful for CI debugging but will be noisy in production. Consider using a debug flag, VS Code'sLogOutputChannel, 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
| 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); | ||
| } |
There was a problem hiding this comment.
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).
closes #70
Summary by CodeRabbit
Tests
Bug Fixes
Improvements
Chores