Skip to content

Make :ide work on Windows nodes (v1.64.2) - #143

Merged
gmpassos merged 3 commits into
masterfrom
fix/ide-windows
Oct 21, 2026
Merged

gmpassos merged 3 commits into
masterfrom
fix/ide-windows

Conversation

@gmpassos

Copy link
Copy Markdown
Contributor

Problem

On a Windows node, :ide didn't list the directory and couldn't create files ("touch not recognized").

Cause

RemoteWorkspace ran POSIX commands (ls -Ap, cat, touch, mkdir -p, test, printf | base64 -d) in the node's session shell family. On a PowerShell or cmd node, ls is Get-ChildItem (no -Ap) and touch doesn't exist.

Fix

  • File operations on a PowerShell or cmd node run through PowerShell (shellFamily: powershell), which every Windows has:
    • .NET file APIs, which take paths literally ([, ] and * in names are safe)
    • Test-Path -LiteralPath
    • listings and contents travel as base64 of their UTF-8 bytes, so non-ASCII names and text survive the console code page
    • writes are chunked (≤16,000 base64 characters per command, under the 32,767-character Windows command line); the first chunk creates the file, the rest append
    • no double quotes in the scripts, which would pass through Windows' command-line quoting
    • try/catch that exits 1 with the message on stderr
  • Git Bash nodes keep the POSIX commands, which work there.
  • Windows paths use / (C:/Users/u), which matches git's form so the gutter lines up. resolveRemoteIdeRoot takes D:\proj and \\server\share as absolute. A drive root keeps its slash (C:/), and a share keeps its leading //. The test caught POSIX normalization collapsing //.

Tests

  • test/integration/ide_remote_workspace_test.dart (tagged windows): the real workspace against a real node over a real Hub. On Windows it goes through PowerShell, elsewhere through POSIX. It covers:

    • listing with dot-entries and non-ASCII names
    • creating a file with missing parents, and again (content kept)
    • directories
    • non-ASCII write and read
    • a multi-chunk write, and truncation
    • an empty file
    • a quote, brackets and spaces in a path
    • missing paths and failures
    • exec in the root

    It passes locally through POSIX; CI's Windows job runs the PowerShell path.

  • test/unit/ide/ide_windows_test.dart: root resolution (relative, absolute, shares, drive roots, POSIX unchanged), plus script quoting, no double quotes, failure handling and chunking.

Release

  • 1.64.1 is tagged, so this bumps to 1.64.2 (pubspec.yaml, lib/src/version.dart), with a CHANGELOG entry.

🤖 Generated with Claude Code

The remote workspace ran POSIX commands (ls -Ap, cat, touch, mkdir -p,
test, base64 -d) in the node's session shell; on a PowerShell or cmd node
the file tree stayed empty and creating a file failed ("touch not
recognized").

On such nodes file operations now run through PowerShell with .NET file
APIs (literal paths), base64 for listings and contents (code-page safe),
chunked writes under the 32K command line, no double quotes, exit 1 with
the message on failure. Git Bash nodes keep the POSIX commands.

Windows remote paths use `/` (matching git's form); :ide takes Windows
absolute paths and shares as absolute, and keeps a drive root's slash
and a share's leading //.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.88889% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/src/application/client/ide/ide_app.dart 74.07% 7 Missing ⚠️
...ication/client/ide/workspace/remote_workspace.dart 94.36% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

gmpassos and others added 2 commits October 21, 2026 06:05
- Use Windows path rules for a Windows node's paths (tree, git, terminal,
  agent) whatever the client platform; keep share and drive roots intact.
- Stream writes over stdin into a temporary file, then copy over the
  target: no truncation on failure, no size limit, one process.
- Send PowerShell error messages as UTF-8 bytes.
- Treat a failed exists/isDirectory probe as an error, not "missing".
- Don't take a `//` path as a share on a POSIX node.
- ClientRuntime.execute/executeStreaming take an optional stdin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ws saves

- Git Bash: take `C:\proj` arguments and git's `C:/…` root in `/c/…` form.
- Quote the gutter's git pathspec for the node's shell (cmd, PowerShell).
- Windows save fills the file in place (OpenOrCreate + SetLength) instead of
  File.Copy over it, so Hidden files save and keep their attributes.
- Run POSIX file operations under sh whatever the login shell (fish).
- Decide Windows rules from the cwd/argument, not the shell family (pwsh
  on Linux); resolve or refuse drive-relative `C:x` paths.
- Share posixQuote; derive IdeApp's root and path rules from the tree;
  memoize git status keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gmpassos
gmpassos merged commit fe4d2c7 into master Oct 21, 2026
6 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