Skip to content

fs: fix glob early return skipping sibling entries#62901

Open
semimikoh wants to merge 1 commit intonodejs:mainfrom
semimikoh:fix-glob-seen-return
Open

fs: fix glob early return skipping sibling entries#62901
semimikoh wants to merge 1 commit intonodejs:mainfrom
semimikoh:fix-glob-seen-return

Conversation

@semimikoh
Copy link
Copy Markdown
Contributor

Summary

  • Remove cache.seen check from children iteration loop in #addSubpatterns (sync) and #iterateSubpatterns (async)
  • The return inside the loop exits the entire method, skipping all remaining siblings
  • The cache.add at the top of each method already prevents reprocessing and infinite recursion

Fixes: #62897

Test plan

  • Run test-fs-glob.mjs multiple times to verify flakiness is resolved
  • Verify the reproduction script from the issue passes consistently

@nodejs-github-bot nodejs-github-bot added fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Apr 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.63%. Comparing base (d080801) to head (cde04e4).
⚠️ Report is 90 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62901      +/-   ##
==========================================
- Coverage   91.55%   89.63%   -1.93%     
==========================================
  Files         355      706     +351     
  Lines      149381   219191   +69810     
  Branches    23364    41989   +18625     
==========================================
+ Hits       136765   196463   +59698     
- Misses      12354    14637    +2283     
- Partials      262     8091    +7829     
Files with missing lines Coverage Δ
lib/internal/fs/glob.js 92.09% <ø> (+5.42%) ⬆️

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

@ZYSzys ZYSzys added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 23, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 23, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fs.glob: return in cache-seen check aborts sibling processing, makes test-fs-glob.mjs flaky

3 participants