Skip to content

vfs: support recursive readdir in ZipProvider - #66127

Open
pipobscure wants to merge 1 commit into
nodejs:mainfrom
pipobscure:vfs-zip-readdir-recursive
Open

pipobscure wants to merge 1 commit into
nodejs:mainfrom
pipobscure:vfs-zip-readdir-recursive

Conversation

@pipobscure

Copy link
Copy Markdown
Contributor

ZipProvider threw ERR_METHOD_NOT_IMPLEMENTED for readdir() with { recursive: true }, although an archive already stores every member under its full path, so a recursive listing is the same scan of the entry names as a flat one, keeping the whole path below the directory instead of only its first segment.

List every member below the directory, and every directory their paths pass through, whether the archive holds an entry for it or only implies it. Names are relative to the listed directory and joined with /, as MemoryProvider returns them, so VirtualFileSystem reports the right parentPath for each Dirent. A name that is both a member and a directory is listed once, as a directory, as a flat listing already did.

The entries are now collected in a map rather than looked up in an array, so listing a directory no longer takes time quadratic in the number of its children.

@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 19, 2026
@codecov

codecov Bot commented Sep 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.27%. Comparing base (1eacebb) to head (bf32efc).
⚠️ Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66127      +/-   ##
==========================================
- Coverage   90.29%   90.27%   -0.02%     
==========================================
  Files         790      790              
  Lines      272529   272526       -3     
  Branches    52037    52035       -2     
==========================================
- Hits       246074   246025      -49     
- Misses      16908    16952      +44     
- Partials     9547     9549       +2     
Files with missing lines Coverage Δ
lib/internal/vfs/providers/ziparchive.js 97.01% <100.00%> (-0.02%) ⬇️

... and 25 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.

@pipobscure

Copy link
Copy Markdown
Contributor Author

Can someone please restart the lint and add request-ci ? Thanks!

@jasnell jasnell 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 19, 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 Sep 19, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@pipobscure

pipobscure commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

I have no idea what the failing CI test is. I did run all tests on Windows & Linux, so I’m assuming it’s a flake until hearing otherwise. If someone can tell me, I’d appreciate it.

@pipobscure

Copy link
Copy Markdown
Contributor Author

@richardlau can you have a look at CI for me please. Thanks!

@pipobscure

Copy link
Copy Markdown
Contributor Author

@jasnell would you be so kind and give the CI a look / poke. Thanks!

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@pipobscure

Copy link
Copy Markdown
Contributor Author

I’m seeing the same three jobs fail on #66127, #66140 and #66162 and given I ran tests on Linux, Mac and Windows, I’m assuming it’s not related to these PRs. Could someone have a look.

ZipProvider threw ERR_METHOD_NOT_IMPLEMENTED for readdir() with
`{ recursive: true }`, although an archive already stores every member
under its full path, so a recursive listing is the same scan of the
entry names as a flat one, keeping the whole path below the directory
instead of only its first segment.

List every member below the directory, and every directory their paths
pass through, whether the archive holds an entry for it or only implies
it. Names are relative to the listed directory and joined with `/`, as
MemoryProvider returns them, so VirtualFileSystem reports the right
parentPath for each Dirent. A name that is both a member and a
directory is listed once, as a directory, as a flat listing already
did.

The entries are now collected in a map rather than looked up in an
array, so listing a directory no longer takes time quadratic in the
number of its children.

Signed-off-by: Philipp Dunkel <pip@pipobscure.com>
@pipobscure
pipobscure force-pushed the vfs-zip-readdir-recursive branch from a3d787b to bf32efc Compare September 22, 2026 07:56
@pipobscure

Copy link
Copy Markdown
Contributor Author

I have rebased on latest main in order to include:

Which were merged last night and hopefully deflake tests.

If someone can verify them and retrigger CI, I'd appreciate it.

@pipobscure
pipobscure requested a review from jasnell September 22, 2026 10:46

@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

@mcollina mcollina 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 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. vfs Issues and PRs related to the virtual filesystem subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants