Skip to content

vfs: normalize RealFSProvider mkdir return paths - #66221

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
trivikr:vfs-normalize-realfsprovider-mkdir-return-paths
Nov 19, 2026
Merged

nodejs-github-bot merged 2 commits into
nodejs:mainfrom
trivikr:vfs-normalize-realfsprovider-mkdir-return-paths

Conversation

@trivikr

@trivikr trivikr commented Sep 23, 2026

Copy link
Copy Markdown
Member

Fixes: #66220

RealFSProvider.mkdirSync()/mkdir() forwarded the raw fs.mkdirSync() result, which for { recursive: true } is the absolute backing-directory path of the first created directory. VirtualFileSystem#toMountedPath() then joined the mount point with it, producing <mount>/<root>/a instead of <mount>/a, so the returned path failed fs.existsSync().

Reuse the existing #resolvedToVfsPath() helper (as realpath does) to translate the result back to a provider-relative VFS path, matching MemoryProvider.


Assisted-by: opencode

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. vfs Issues and PRs related to the virtual filesystem subsystem. labels Sep 23, 2026
@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 23, 2026
@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.71%. Comparing base (f344e7f) to head (8195526).
⚠️ Report is 180 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66221      +/-   ##
==========================================
- Coverage   90.73%   90.71%   -0.02%     
==========================================
  Files         798      798              
  Lines      279993   280003      +10     
  Branches    53866    53858       -8     
==========================================
- Hits       254047   254005      -42     
- Misses      16229    16284      +55     
+ Partials     9717     9714       -3     
Files with missing lines Coverage Δ
lib/internal/vfs/providers/real.js 95.75% <100.00%> (+0.06%) ⬆️

... and 24 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trivikr trivikr removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 24, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@trivikr
trivikr requested a review from mcollina September 27, 2026 21:12
@trivikr

trivikr commented Oct 25, 2026

Copy link
Copy Markdown
Member Author

cc @mcollina Can you review this?

@trivikr
trivikr force-pushed the vfs-normalize-realfsprovider-mkdir-return-paths branch from 3b52939 to 43b6f0e Compare November 2, 2026 21:27
RealFSProvider.mkdirSync()/mkdir() forwarded the raw fs.mkdirSync()
result, which for { recursive: true } is the absolute backing-directory
path of the first created directory. VirtualFileSystem#toMountedPath()
then joined the mount point with it, producing <mount>/<root>/a instead
of <mount>/a, so the returned path failed fs.existsSync().

Reuse the existing #resolvedToVfsPath() helper (as realpath does) to
translate the result back to a provider-relative VFS path, matching
MemoryProvider.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: opencode
@trivikr
trivikr force-pushed the vfs-normalize-realfsprovider-mkdir-return-paths branch from 43b6f0e to 8195526 Compare November 9, 2026 07:19

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@trivikr trivikr added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. author ready PRs with CI started, the required approvals, and no outstanding review comments. labels Nov 17, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 17, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@jasnell jasnell added the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Nov 18, 2026
@github-actions github-actions Bot removed the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Nov 18, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@mcollina mcollina added the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 19, 2026
@nodejs-github-bot
nodejs-github-bot merged commit d9e18d5 into nodejs:main Nov 19, 2026
83 of 87 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in d9e18d5

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 19, 2026
aduh95 pushed a commit that referenced this pull request Nov 19, 2026
RealFSProvider.mkdirSync()/mkdir() forwarded the raw fs.mkdirSync()
result, which for { recursive: true } is the absolute backing-directory
path of the first created directory. VirtualFileSystem#toMountedPath()
then joined the mount point with it, producing <mount>/<root>/a instead
of <mount>/a, so the returned path failed fs.existsSync().

Reuse the existing #resolvedToVfsPath() helper (as realpath does) to
translate the result back to a provider-relative VFS path, matching
MemoryProvider.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: opencode
PR-URL: #66221
Fixes: #66220
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. needs-ci PRs that need a full CI run. vfs Issues and PRs related to the virtual filesystem subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vfs: recursive mkdir returns backing-directory path for RealFSProvider

4 participants