Skip to content

Fix codegen for projects in hidden folders - #55259

Closed
dinisnunes1 wants to merge 1 commit into
react:mainfrom
dinisnunes1:fix-codegen-with-dotted-path
Closed

Fix codegen for projects in hidden folders#55259
dinisnunes1 wants to merge 1 commit into
react:mainfrom
dinisnunes1:fix-codegen-with-dotted-path

Conversation

@dinisnunes1

Copy link
Copy Markdown
Contributor

Summary:

Fixes #55243

Fixes an issue where iOS codegen fails when the React Native project is located inside a hidden folder (a folder starting with ., such as ~/.jenkins/workspace/ or /.buildkite/builds/).

The issue was reported for React Native 0.79.4, but the bug affects all subsequent versions including the current main branch.

The findFilesWithExtension function was checking if the entire absolute path contained /. to skip hidden folders. This caused false positives when the project workspace itself was under a hidden folder, resulting in all files being incorrectly filtered out and codegen producing empty results.

The fix changes the check to only look at the current filename being iterated (file.startsWith('.')) rather than the full path, while preserving the existing .pnpm exception.

Changelog:

[iOS] [Fixed] - Fix codegen failing when project is inside a hidden folder

Test Plan:

Added unit tests for findFilesWithExtension that verify:

  • Hidden files/folders are still correctly skipped
  • The .pnpm folder exception still works
  • Projects under hidden folders (e.g., /.jenkins/workspace/) now work correctly

Run tests with:

yarn jest packages/react-native/scripts/codegen/__tests__/generate-artifacts-executor-test.js --testNamePattern="findFilesWithExtension"

All 3 tests pass. The critical test works when project is under a hidden folder fails without the fix (returns empty array) and passes with the fix.

Example of the codegen failing on a dotted path 🔴

Screenshot 2026-01-21 at 09 54 21

Example of the codegen crawling working on a dotted path - with the fix ✅

Screenshot 2026-01-21 at 10 15 56

@meta-cla

meta-cla Bot commented Jan 21, 2026

Copy link
Copy Markdown

Hi @dinisnunes1!

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!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 21, 2026
@meta-cla

meta-cla Bot commented Jan 21, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Jan 21, 2026
@meta-codesync

meta-codesync Bot commented Jan 21, 2026

Copy link
Copy Markdown

@cortinico has imported this pull request. If you are a Meta employee, you can view this in D91122133.

@meta-codesync meta-codesync Bot closed this in a12b442 Jan 21, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @dinisnunes1 in a12b442

When will my fix make it into a release? | How to file a pick request?

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jan 21, 2026
@meta-codesync

meta-codesync Bot commented Jan 21, 2026

Copy link
Copy Markdown

@cortinico merged this pull request in a12b442.

react-native-bot pushed a commit that referenced this pull request Jan 22, 2026
Summary:
Fixes #55243

Fixes an issue where iOS codegen fails when the React Native project is located inside a hidden folder (a folder starting with `.`, such as `~/.jenkins/workspace/` or `/.buildkite/builds/`).

The issue was reported for React Native 0.79.4, but the bug affects all subsequent versions including the current main branch.

The `findFilesWithExtension` function was checking if the entire absolute path contained `/.` to skip hidden folders. This caused false positives when the project workspace itself was under a hidden folder, resulting in all files being incorrectly filtered out and codegen producing empty results.

The fix changes the check to only look at the current filename being iterated (`file.startsWith('.')`) rather than the full path, while preserving the existing `.pnpm` exception.

## Changelog:

[iOS] [Fixed] - Fix codegen failing when project is inside a hidden folder

Pull Request resolved: #55259

Test Plan:
Added unit tests for `findFilesWithExtension` that verify:
 - Hidden files/folders are still correctly skipped
 - The `.pnpm` folder exception still works
 - Projects under hidden folders (e.g., `/.jenkins/workspace/`) now work correctly

Run tests with:
```bash
yarn jest packages/react-native/scripts/codegen/__tests__/generate-artifacts-executor-test.js --testNamePattern="findFilesWithExtension"
```

All 3 tests pass. The critical test `works when project is under a hidden folder` fails without the fix (returns empty array) and passes with the fix.

### Example of the codegen failing on a dotted path 🔴
<img width="970" height="609" alt="Screenshot 2026-01-21 at 09 54 21" src="https://github.com/user-attachments/assets/247576c4-ce06-4656-93d7-06e880e779e3" />

- [`pod install` logs on Github Actions](https://github.com/dinisnunes1/.react-native-codegen-dotted-paths/actions/runs/21204831248/job/60998728238)
- [example based on the Reproducer repo](dinisnunes1/.react-native-codegen-dotted-paths@main...test-dotted-path-codegen)

### Example of the codegen crawling working on a dotted path - with the fix ✅
<img width="938" height="700" alt="Screenshot 2026-01-21 at 10 15 56" src="https://github.com/user-attachments/assets/f36ef04d-e5ca-454e-907f-9af1fcd0a6d9" />

- [`pod install` logs on Github Actions](https://github.com/dinisnunes1/.react-native-codegen-dotted-paths/actions/runs/21205599303/job/61001213856)
- [example based on the Reproducer repo - branch with RN `0.83.1` patched](dinisnunes1/.react-native-codegen-dotted-paths@main...test-codegen-fix)

Reviewed By: cipolleschi

Differential Revision: D91122133

Pulled By: cortinico

fbshipit-source-id: 762564c874d5081521811e3a20d850a89861b99f
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @dinisnunes1 in 4733593

When will my fix make it into a release? | How to file a pick request?

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Codegen] Hidden folder detection skips all files when workspace path contains hidden directory (e.g. ~/.jenkins/)

3 participants