test(filesystem): add regression tests for Docker Linux path handling - #3805
test(filesystem): add regression tests for Docker Linux path handling#3805majiayu000 wants to merge 1 commit into
Conversation
Add tests for issue modelcontextprotocol#3628 where single-letter root directories (/h/, /u/, /d/) on Linux Docker containers were incorrectly converted to Windows drive letter paths (H:\, U:\, D:\). The code fix exists on main via platform detection in normalizePath and convertToWindowsPath. These tests mock process.platform to 'linux' and verify paths are preserved as-is. Signed-off-by: majiayu000 <1835304752@qq.com>
|
@claude review |
|
Claude finished @cliffhall's task in 1m 34s —— View job PR Review
Summary: This is a test-only PR adding regression tests for issue #3628 (Docker Alpine Linux wrongly converting What the PR addsA new
CorrectnessThe tests align with the implementation in
const isUnixPath = p.startsWith('/') && (
p.match(/^\/mnt\/[a-z]\//i) ||
(process.platform !== 'win32') || // <-- on Linux, all /x/ paths bypass conversion
(process.platform === 'win32' && !p.match(/^\/[a-zA-Z]\//))
);
if (p.match(/^\/[a-zA-Z]\//) && process.platform === 'win32') {Both guards require ObservationsGood:
Minor observations (non-blocking):
VerdictLooks good. The tests are correctly written, follow the established mocking pattern, cover the exact regression scenario from the issue, and provide good direct coverage of both the public |
Fixes #3628
Description
Adds regression tests for the Docker/Linux path normalization bug where paths like
/h/username/MCP_Development/datagot wrongly converted toH:\username\MCP_Development\data. The code fix already landed on main (commit c9b0135 added platform detection tonormalizePathandconvertToWindowsPath), but there were no tests covering the exact scenario from the issue.New tests mock
process.platformto'linux'(simulating Docker Alpine) and verify that single-letter root directories (/h/,/u/,/d/) aren't mistaken for Windows drive letters. Uses the same mocking pattern already in the WSL test block.Note: Docker image 1.0.2 still has the bug. It needs rebuilding from current main to pick up the fix.
Server Details
path-utils.test.ts)Motivation and Context
Issue #3628 reports that the filesystem server running in Docker Alpine Linux converts valid Linux paths to Windows-style paths. The fix exists but had no dedicated test coverage for the Docker scenario.
How Has This Been Tested?
cd src/filesystem && npm test— all 149 tests pass (7 test files), including the new regression tests.Breaking Changes
None. Test-only change.
Types of changes
Checklist