Skip to content

Conversation

@uragirii
Copy link

@uragirii uragirii commented Feb 8, 2026

Description

  • Adds check to see if you are in Expo CNG to skip the native file patching
  • Checks if ios and android folders are in .gitignore
  • Skips the step and prints a log to show that step is skipped
  • Added Sentry tracking for this
  • As this is my first contribution, please let me know if I missed something
image

AI Disclosure

  • The tests in this PR are written by Claude Code Sonnet 4.5.
  • Actual implemention of the feature is done by me, only *.test.ts files are generated based on my code


return NATIVE_FOLDERS.every((folder) => {
return lines.some((line) => {
const lineWithoutComment = line.split('#')[0].trim();
Copy link
Contributor

Choose a reason for hiding this comment

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

Gitignore parser incorrectly strips mid-line hash characters

Low Severity

The line.split('#')[0] approach treats # anywhere on a line as a comment delimiter. Per the gitignore spec, # only starts a comment when it's the first non-whitespace character on the line — mid-line # is a literal part of the pattern. A gitignore entry like ios # native would be incorrectly parsed as matching ios, even though git treats the entire string (including the #) as a literal pattern. This could cause a false positive for isExpoCNG, leading to native file patching being skipped when it shouldn't be. A simpler approach — checking if the trimmed line starts with # to identify comment lines — would match gitignore semantics correctly.

Fix in Cursor Fix in Web

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

❌ Patch coverage is 72.88136% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.32%. Comparing base (51bb31c) to head (9a7f56c).
⚠️ Report is 56 commits behind head on master.

Files with missing lines Patch % Lines
src/react-native/react-native-wizard.ts 5.88% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1211      +/-   ##
==========================================
+ Coverage   36.26%   37.32%   +1.06%     
==========================================
  Files         144      154      +10     
  Lines       17746    18585     +839     
  Branches     1457     1558     +101     
==========================================
+ Hits         6435     6937     +502     
- Misses      11291    11630     +339     
+ Partials       20       18       -2     
Flag Coverage Δ
unit-tests 37.32% <72.88%> (+1.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Hey @uragirii thanks for opening this PR! I started CI to run our tests and lint jobs. Pretty sure there are still some formatting issues.

From my PoV the actual changes look good. Also gonna ask @antonis to take a look, as my ReactNative/Expo knowledge is very limited :D

@antonis antonis requested review from alwx and antonis February 9, 2026 10:06
if (isExpo && (await isExpoCNG())) {
Sentry.setTag('expo-cng', true);
clack.log.info(
`Detected Expo Continous Native Generation (CNG) setup. Skipping native files patching.`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
`Detected Expo Continous Native Generation (CNG) setup. Skipping native files patching.`,
`Detected Expo Continuous Native Generation (CNG) setup. Skipping native files patching.`,

expect(git.areNativeFoldersInGitignore).not.toHaveBeenCalled();
});

test('handles errors from areNativeFoldersInGitignore gracefully', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

h: Wdyt of catching possible errors like the ones tested here and handling the error gracefully. I would expect that if the detection fails the isExpoCNG function would return false.

Choose a reason for hiding this comment

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

good point, I've wrapped in try catch block so now it should work as expected

Copy link
Author

Choose a reason for hiding this comment

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

oops, used the wrong account here but its still me ;)

Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution @uragirii 🙇 Overall it looks great 🥇

I've left a few comments for possible improvements along with the sentry[bot] feedback.

We could also add a changelog entry. Something like:

  ## Unreleased

  - fix(react-native): Skip native file patching when Expo CNG is detected ([#1211](https://github.com/getsentry/sentry-wizard/pull/1211))

Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

const iOSExists = fs.existsSync('ios');
const androidExists = fs.existsSync('android');

const bothNativeFoldersExist = iOSExists || androidExists;
Copy link
Contributor

Choose a reason for hiding this comment

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

Misleading variable name contradicts OR operator logic

Low Severity

The variable bothNativeFoldersExist is assigned using || (OR), so it's true when either folder exists. The name "both" strongly implies && (AND), meaning both must exist. The actual logic is correct for the function's intent, but a future maintainer reading if (!bothNativeFoldersExist) would naturally interpret it as "if not both exist" (i.e., at most one exists), when it actually means "if neither exists." A name like anyNativeFolderExists would accurately reflect the || semantics.

Fix in Cursor Fix in Web

@uragirii
Copy link
Author

Can someone run the ubuntu test CI again? It failed due to 500 from yarn install

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.

4 participants