Skip to content

Quality: Fix recursive directory traversal to properly find all files#697

Open
andoan16 wants to merge 1 commit intofacebook:mainfrom
andoan16:contribai/improve/quality/fix-recursive-directory-traversal-to-pro
Open

Quality: Fix recursive directory traversal to properly find all files#697
andoan16 wants to merge 1 commit intofacebook:mainfrom
andoan16:contribai/improve/quality/fix-recursive-directory-traversal-to-pro

Conversation

@andoan16
Copy link
Copy Markdown

✨ Code Quality

Problem

The dirFiles function in Runner.js has a bug in its recursive directory traversal. When a directory is passed, it should recursively find all files in all subdirectories. The current implementation likely has an issue where the acc.remaining counter isn't properly managed during recursion, causing the callback to fire prematurely before all subdirectories have been fully explored. Additionally, the getFiles function that processes the initial paths array needs to properly handle directories by recursing into them.

Severity: high
File: src/Runner.js

Solution

The dirFiles function in Runner.js has a bug in its recursive directory traversal. When a directory is passed, it should recursively find all files in all subdirectories. The current implementation likely has an issue where the acc.remaining counter isn't properly managed during recursion, causing the callback to fire prematurely before all subdirectories have been fully explored. Additionally, the getFiles function that processes the initial paths array needs to properly handle directories by recursing into them.

Changes

  • src/Runner.js (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced


🤖 About this PR

This pull request was generated by ContribAI, an AI agent
that helps improve open source projects. The change was:

  1. Discovered by automated code analysis
  2. Generated by AI with context-aware code generation
  3. Self-reviewed by AI quality checks

If you have questions or feedback about this PR, please comment below.
We appreciate your time reviewing this contribution!

Closes #479

…nd all files

The `dirFiles` function in Runner.js has a bug in its recursive directory traversal. When a directory is passed, it should recursively find all files in all subdirectories. The current implementation likely has an issue where the `acc.remaining` counter isn't properly managed during recursion, causing the callback to fire prematurely before all subdirectories have been fully explored. Additionally, the `getFiles` function that processes the initial paths array needs to properly handle directories by recursing into them.

Affected files: Runner.js

Signed-off-by: andoan16 <33853760+andoan16@users.noreply.github.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 11, 2026

⚠️ No Changeset found

Latest commit: f4f0351

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 11, 2026

@andoan16 is attempting to deploy a commit to the Meta Open Source Team on Vercel.

A member of the Team first needs to authorize it.

@meta-cla
Copy link
Copy Markdown

meta-cla bot commented Apr 11, 2026

Hi @andoan16!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

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.

My files are randomly skipped

1 participant