Skip to content

Conversation

@transphorm
Copy link
Member

@transphorm transphorm commented Sep 4, 2025

Summary

  • add root babel config and @babel/runtime dependency
  • enable Metro symlink resolution in app and demo app
  • configure Yarn workspaces with nohoist to keep RN deps local

Testing

  • yarn workspaces foreach -p -v --topological-dev --since=HEAD run nice --if-present (fails: Cannot find module '@react-native-picker/picker')
  • yarn lint (fails: Unable to resolve module 'react-native-svg-circle-country-flags')
  • yarn build (fails: build failed in @selfxyz/mobile-sdk-alpha)
  • yarn workspace @selfxyz/contracts build (fails: Hardhat config error)
  • yarn types (fails: Cannot find module 'react-native-svg-circle-country-flags')
  • yarn workspace @selfxyz/mobile-app test (fails: Cannot find module '@react-native-picker/picker')
  • yarn workspace demo-app test *(fails: renders menu buttons)
  • yarn workspace demo-app build (fails: Cannot find module '@react-native-picker/picker')

https://chatgpt.com/codex/tasks/task_b_68b9dd8390f0832db7acf96700d85dd0

Summary by CodeRabbit

  • New Features
    • Configured Metro to support symlinks and non-hierarchical module lookup for smoother monorepo development.
    • Introduced a root Babel configuration for React Native builds.
  • Documentation
    • Expanded demo app guide with clear steps to enable/disable New Architecture and Hermes, noted current defaults, and updated build commands.
  • Chores
    • Increased CI build log verbosity for mobile E2E runs.
    • Adjusted workspace selection in CI to improve dependency builds.
    • Updated workspace hoisting rules and added a runtime dependency to improve React Native compatibility.
  • Tests
    • Updated demo app tests to validate new text-based labels.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 4, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • main
  • dev

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Updates CI workflows to adjust Yarn flags and verbosity, adds Babel config and @babel/runtime, restructures root workspaces with nohoist rules, modifies Metro resolver settings in two apps, refreshes demo-app README, and updates a demo-app test to assert Text content instead of Button titles.

Changes

Cohort / File(s) Summary of Changes
CI workflows
.github/workflows/mobile-e2e.yml, .github/workflows/mobile-sdk-demo-ci.yml
mobile-e2e: removed --silent from two Yarn build steps. mobile-sdk-demo-ci: changed yarn workspaces foreach flags from -At to -R -t for dependency build step.
Metro resolver updates
app/metro.config.cjs, packages/mobile-sdk-alpha/demo-app/metro.config.cjs
Added resolver options: unstable_enableSymlinks: true and disableHierarchicalLookup: true in both Metro configs.
Babel and workspace configuration
babel.config.js, package.json
Added Babel root config with preset module:@react-native/babel-preset. Updated workspaces to object with packages and nohoist; added @babel/runtime dependency.
Demo app documentation
packages/mobile-sdk-alpha/demo-app/README.md
Added sections on New Architecture and Hermes toggles with current settings and updated build commands.
Demo app test update
packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
Switched assertions from Button titles to Text content; removed Button import; verifies presence of specific labeled Text nodes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant GH as GitHub Actions
  participant Yarn as Yarn Workspaces
  Note over GH,Yarn: mobile-sdk-demo-ci "Build dependencies (topological)"
  GH->>Yarn: yarn workspaces foreach -R -t --from demo-app run build:deps
  Yarn-->>GH: Build tasks executed in topo order (selected workspaces)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • remicolin
  • aaronmgdr

Poem

Logs now speak where silence stood,
Symlinks shine through Metro’s wood.
Babel whispers, preset true,
Nohoist guards the RN crew.
Tests read text with brighter eyes—
CI marches, flags revised.
Build on, demo—shipwise skies!

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/verify-fix-for-metro-bundler-issues

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@transphorm
Copy link
Member Author

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 4, 2025

✅ Actions performed

Full review triggered.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
package.json (1)

41-48: Avoid pinning RN/React via both resolutions and root dependencies.

Keeping react/react-native at the root creates an extra copy and fights your goal of keeping RN local to each app/workspace. This duplication is a common cause of Metro/Native module resolution errors (e.g., multiple Reacts).

Action:

  • Keep versions in resolutions to enforce consistency.
  • Remove react and react-native from root dependencies.
  • Ensure each RN app/package declares its own react and react-native dependencies.

This should also help with the reported “Cannot find module '@react-native-picker/picker'” and react-native-svg-circle-country-flags issues once those deps are added to the correct workspaces.

   "dependencies": {
-    "@babel/runtime": "^7.28.3",
-    "react": "^18.3.1",
-    "react-native": "0.76.9"
+    "@babel/runtime": "^7.28.3"
   },
🧹 Nitpick comments (7)
app/metro.config.cjs (1)

213-214: Sync Metro flags with Jest and confirm version support
• Metro-config v0.76.9 includes both resolver.unstable_enableSymlinks and resolver.disableHierarchicalLookup flags (unpkg.com, github.com).
• Mirror these options in your Jest setup to ensure module resolution parity, e.g. in jest.config.js:

module.exports = {
  resolver: "metro-resolver",
  resolverOptions: {
    unstable_enableSymlinks: true,
    disableHierarchicalLookup: true,
  },
  // …
};

Existing declarations of react-native-svg-circle-country-flags in app and @react-native-picker/picker in demo-app satisfy the nohoist requirements.

babel.config.js (1)

5-7: Scope RN Babel preset to mobile workspaces & enable runtime + reanimated plugins
Limit the RN preset to app, packages/mobile-sdk-alpha, and its demo-app to avoid Hardhat/Node-tooling collisions; detected @babel/runtime and react-native-reanimated usage—add corresponding plugins.

 module.exports = {
-  presets: ['module:@react-native/babel-preset'],
-};
+  overrides: [
+    {
+      test: ['./app', './packages/mobile-sdk-alpha', './packages/mobile-sdk-alpha/demo-app'],
+      presets: ['module:@react-native/babel-preset'],
+      plugins: [
+        ['@babel/plugin-transform-runtime', {helpers: true}],
+        'react-native-reanimated/plugin',
+      ],
+    },
+  ],
+};
packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx (1)

12-18: Reduce brittleness: avoid strict equality on Text.children; flatten or use testing-library queries

In RN, Text children can be arrays/fragments/nested nodes; strict === label can miss matches and cause flaky tests. Flatten text or switch to @testing-library/react-native.

Minimal change approach:

-  const textNodes = rendered.root.findAllByType(Text);
-  expect(textNodes.some(node => node.props.children === 'Self Demo App')).toBe(true);
-  ['✅ Generate Mock Data', '⏳ Register Document', '⏳ Prove QR Code'].forEach(label => {
-    expect(textNodes.some(node => node.props.children === label)).toBe(true);
-  });
+  const textNodes = rendered.root.findAllByType(Text);
+  const toText = (n) => {
+    const c = n.props.children;
+    if (Array.isArray(c)) return c.flat(Infinity).join('');
+    return typeof c === 'string' ? c : (c ?? '').toString();
+  };
+  const contents = textNodes.map(toText);
+  expect(contents).toContain('Self Demo App');
+  ['✅ Generate Mock Data', '⏳ Register Document', '⏳ Prove QR Code'].forEach(label => {
+    expect(contents).toContain(label);
+  });

If allowed, prefer:

- import renderer from 'react-test-renderer';
- import { Text } from 'react-native';
+ import { render, screen } from '@testing-library/react-native';
...
- const rendered = renderer.create(<App />);
- const textNodes = rendered.root.findAllByType(Text);
- ...
- rendered.unmount();
+ const { unmount } = render(<App />);
+ expect(screen.getByText('Self Demo App')).toBeTruthy();
+ ['✅ Generate Mock Data', '⏳ Register Document', '⏳ Prove QR Code'].forEach(t => {
+   expect(screen.getByText(t)).toBeTruthy();
+ });
+ unmount();
packages/mobile-sdk-alpha/demo-app/README.md (2)

7-20: Add cache reset steps after toggling New Architecture/Fabric.

Switching Fabric/TM often requires a full native clean; otherwise builds can fail nondeterministically. Please add explicit steps:

  • Android: cd android && ./gradlew clean
  • iOS: cd ios && rm -rf Pods Podfile.lock && pod install (or pod deintegrate && pod install)

This will reduce CI and local flakiness when devs flip the switches.


21-33: Add cache reset steps after toggling Hermes.

Similar to Fabric, toggling Hermes typically requires a clean native rebuild (Gradle clean and Pods reinstall). Adding these commands here will prevent “duplicate symbol” and missing-header issues post-toggle.

package.json (1)

22-40: Add preflight scripts to catch missing RN deps early.

Given current failures:

  • Missing: @react-native-picker/picker
  • Missing: react-native-svg-circle-country-flags

Add a workspace guard script that checks each RN app for required native deps and fails fast with actionable messages. This prevents opaque Metro errors later.

I can generate a small Node script to scan RN imports and verify workspace dependencies; say the word.

.github/workflows/mobile-sdk-demo-ci.yml (1)

26-31: Fail fast if demo-app’s native deps are missing.

To surface the known missing modules earlier, add a quick dependency check before tests/build. This saves CI minutes and yields clearer errors.

Example:

   - name: Run demo app tests
     run: |
-      yarn workspace demo-app test
+      node -e "const p=require('./packages/mobile-sdk-alpha/demo-app/package.json');const d=new Set(Object.keys({...p.dependencies,...p.devDependencies}));const req=['@react-native-picker/picker','react-native-svg-circle-country-flags'];const miss=req.filter(x=>!d.has(x)); if(miss.length){console.error('Missing deps in demo-app:', miss); process.exit(1)}"
+      yarn workspace demo-app test
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 13745d2 and 747c9b1.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (8)
  • .github/workflows/mobile-e2e.yml (2 hunks)
  • .github/workflows/mobile-sdk-demo-ci.yml (1 hunks)
  • app/metro.config.cjs (1 hunks)
  • babel.config.js (1 hunks)
  • package.json (2 hunks)
  • packages/mobile-sdk-alpha/demo-app/README.md (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx (1 hunks)
  • packages/mobile-sdk-alpha/demo-app/metro.config.cjs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{test,spec}.{ts,js,tsx,jsx}

⚙️ CodeRabbit configuration file

**/*.{test,spec}.{ts,js,tsx,jsx}: Review test files for:

  • Test coverage completeness
  • Test case quality and edge cases
  • Mock usage appropriateness
  • Test readability and maintainability

Files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}: Review alpha mobile SDK code for:

  • API consistency with core SDK
  • Platform-neutral abstractions
  • Performance considerations
  • Clear experimental notes or TODOs

Files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
🧠 Learnings (27)
📓 Common learnings
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.210Z
Learning: After review changes, re-run yarn nice, yarn test, yarn types
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.727Z
Learning: Before PRs, ensure yarn build succeeds for all workspaces
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Use yarn scripts: yarn ios/android for builds, yarn test for unit tests, and Fastlane for deployments
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.727Z
Learning: After addressing review feedback, re-run yarn nice, yarn test, yarn types
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Run yarn nice, yarn types, and yarn test before commits and PRs
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.210Z
Learning: yarn nice passes (fixes linting and formatting) before PR
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/jest.config.cjs : Use Jest in the app with a React Native preset configured in app/jest.config.cjs

Applied to files:

  • babel.config.js
📚 Learning: 2025-08-29T15:30:12.210Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.210Z
Learning: Verify iOS build succeeds via yarn ios

Applied to files:

  • .github/workflows/mobile-e2e.yml
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Use yarn scripts: yarn ios/android for builds, yarn test for unit tests, and Fastlane for deployments

Applied to files:

  • .github/workflows/mobile-e2e.yml
  • .github/workflows/mobile-sdk-demo-ci.yml
📚 Learning: 2025-08-29T15:30:12.210Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.210Z
Learning: Verify Android build succeeds via yarn android

Applied to files:

  • .github/workflows/mobile-e2e.yml
📚 Learning: 2025-08-29T15:30:12.210Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.210Z
Learning: From app/ios, run bundle install && bundle exec pod install (or from app run npx pod-install)

Applied to files:

  • .github/workflows/mobile-e2e.yml
📚 Learning: 2025-08-29T15:30:12.210Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.210Z
Learning: Run the app with yarn ios during development as needed

Applied to files:

  • .github/workflows/mobile-e2e.yml
📚 Learning: 2025-08-25T14:25:57.586Z
Learnt from: aaronmgdr
PR: selfxyz/self#951
File: app/src/providers/authProvider.web.tsx:17-18
Timestamp: 2025-08-25T14:25:57.586Z
Learning: The selfxyz/mobile-sdk-alpha/constants/analytics import path is properly configured with SDK exports, Metro aliases, and TypeScript resolution. Import changes from @/consts/analytics to this path are part of valid analytics migration, not TypeScript resolution issues.

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/metro.config.cjs
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/package.json : Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/metro.config.cjs
  • package.json
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/README.md : Document new/updated SDK modules and usage in packages/mobile-sdk-alpha/README.md

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/README.md
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/README.md
  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-29T15:30:12.210Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-08-29T15:30:12.210Z
Learning: Document complex native module changes for AI review

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/README.md
📚 Learning: 2025-08-24T18:55:07.940Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/technical-specification.mdc:0-0
Timestamp: 2025-08-24T18:55:07.940Z
Learning: Applies to package.json : Distribute the SDK via npm/yarn with proper package metadata

Applied to files:

  • package.json
📚 Learning: 2025-06-30T15:51:11.193Z
Learnt from: transphorm
PR: selfxyz/self#636
File: app/android/app/build.gradle:76-76
Timestamp: 2025-06-30T15:51:11.193Z
Learning: For React Native 0.80, the correct JSC version is `io.github.react-native-community:jsc-android:2026004.+`. This version was specifically built with Android NDK r23 to align with React Native 0.80's NDK requirements and prevent compatibility issues. The `2026004` version pattern is the official version for RN 0.80, not an outdated pin.

Applied to files:

  • package.json
📚 Learning: 2025-06-30T15:27:13.795Z
Learnt from: transphorm
PR: selfxyz/self#636
File: app/ios/Podfile:14-14
Timestamp: 2025-06-30T15:27:13.795Z
Learning: React Native 0.80 supports iOS 15.1 as the minimum deployment target, not iOS 16.0. This allows for broader device compatibility while still being compatible with the React Native 0.80 upgrade.

Applied to files:

  • package.json
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Use actual imports from selfxyz/mobile-sdk-alpha in tests

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Do NOT mock selfxyz/mobile-sdk-alpha in tests (avoid jest.mock('selfxyz/mobile-sdk-alpha') and replacing real functions with mocks)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Never use real user PII in tests; use only synthetic, anonymized, or approved test vectors

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Verify extractMRZInfo() using published sample MRZ strings (e.g., ICAO examples)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Write integration tests that exercise the real validation logic (not mocks)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Ensure parseNFCResponse() works with representative, synthetic NFC data

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Test isPassportDataValid() with realistic synthetic passport data (never real user data)

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/tests/setup.ts : Provide Vitest setup file at packages/mobile-sdk-alpha/tests/setup.ts to suppress console noise

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-24T18:52:25.796Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursorrules:0-0
Timestamp: 2025-08-24T18:52:25.796Z
Learning: Applies to tests/src/**/*.{test,spec}.{ts,tsx,js,jsx} : Use renderHook for custom hook testing

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-26T14:41:41.821Z
Learnt from: shazarre
PR: selfxyz/self#936
File: app/src/screens/aesop/PassportOnboardingScreen.tsx:0-0
Timestamp: 2025-08-26T14:41:41.821Z
Learning: When verifying provider hierarchies in React Native apps, always check the main App.tsx file at the app root, not just navigation/index.tsx and layout files, as providers are often configured at the top-level App component.

Applied to files:

  • packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx
📚 Learning: 2025-08-29T15:29:47.727Z
Learnt from: CR
PR: selfxyz/self#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:29:47.727Z
Learning: Before PRs, ensure yarn build succeeds for all workspaces

Applied to files:

  • .github/workflows/mobile-sdk-demo-ci.yml
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to app/package.json : Expose a 'test:build' script in the app's package.json that builds deps, types, performs bundle analysis, and runs tests

Applied to files:

  • .github/workflows/mobile-sdk-demo-ci.yml
🪛 LanguageTool
packages/mobile-sdk-alpha/demo-app/README.md

[grammar] ~37-~37: There might be a mistake here.
Context: ...ttings - New Architecture: Disabled - Hermes: Enabled ## Build Commands Af...

(QB_NEW_EN)

⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build-ios
  • GitHub Check: e2e-ios
🔇 Additional comments (5)
packages/mobile-sdk-alpha/demo-app/__tests__/App.test.tsx (1)

7-7: Import looks fine given the test strategy

Using Text directly is OK here; if you migrate to testing-library, this import becomes unnecessary.

.github/workflows/mobile-e2e.yml (2)

93-93: Good call: surface build:deps logs in CI

Dropping --silent improves diagnosability for monorepo resolution issues.


228-228: Same here for iOS path—keep verbose logs for dependency build

This will help trace Metro/Yarn workspace resolution problems early in the job.

packages/mobile-sdk-alpha/demo-app/README.md (1)

42-47: No action needed: yarn clean script is present in demo-app
The "clean" script is defined in packages/mobile-sdk-alpha/demo-app/package.json, so the documented workflow works as expected.

.github/workflows/mobile-sdk-demo-ci.yml (1)

25-25: Confirm -R -t --from demo-app still builds transitive dependencies.

Previously -A -t --from demo-app guaranteed dependents/dependencies coverage. With -R, selection semantics change in Yarn 4 and may skip some needed builds.

Please verify the actual workspace set before building, and consider adding an explicit list step.

Proposed tweak:

- yarn workspaces foreach -R -t --from demo-app run build
+ yarn workspaces list -R --from demo-app --json
+ yarn workspaces foreach -R -t --from demo-app run build

Expected: the list includes @selfxyz/mobile-sdk-alpha and any internal packages the demo app imports.

Comment on lines 3 to 21
"workspaces": {
"packages": [
"app",
"circuits",
"common",
"contracts",
"packages/*",
"prover/tests",
"sdk/*",
"scripts/tests",
"packages/mobile-sdk-alpha/demo-app"
],
"nohoist": [
"**/react-native",
"**/react-native/**",
"**/@babel/runtime",
"**/@babel/runtime/**"
]
},
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Yarn 4 ignores workspaces.nohoist; use .yarnrc.yml hoisting controls instead.

In Yarn Berry (v2+), nohoist is not supported. With packageManager: "[email protected]", these entries won’t take effect and will undermine the RN-localization intent, causing “Cannot find module …” at runtime.

Action:

  • Remove workspaces.nohoist from package.json.
  • In .yarnrc.yml, set:
    • nodeLinker: node-modules
    • nmHoistingLimits: workspaces (or dependencies if you prefer tighter limits)
    • Optional: pnpMode: loose only if you move to PnP later.

This aligns with RN’s monorepo guidance and Metro symlink resolution.

Apply:

   "workspaces": {
-    "packages": [
+    "packages": [
       "app",
       "circuits",
       "common",
       "contracts",
       "packages/*",
       "prover/tests",
       "sdk/*",
       "scripts/tests",
       "packages/mobile-sdk-alpha/demo-app"
-    ],
-    "nohoist": [
-      "**/react-native",
-      "**/react-native/**",
-      "**/@babel/runtime",
-      "**/@babel/runtime/**"
-    ]
+    ]
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"workspaces": {
"packages": [
"app",
"circuits",
"common",
"contracts",
"packages/*",
"prover/tests",
"sdk/*",
"scripts/tests",
"packages/mobile-sdk-alpha/demo-app"
],
"nohoist": [
"**/react-native",
"**/react-native/**",
"**/@babel/runtime",
"**/@babel/runtime/**"
]
},
"workspaces": {
"packages": [
"app",
"circuits",
"common",
"contracts",
"packages/*",
"prover/tests",
"sdk/*",
"scripts/tests",
"packages/mobile-sdk-alpha/demo-app"
]
},
🤖 Prompt for AI Agents
In package.json around lines 3 to 21, the workspaces.nohoist section is present
but Yarn v2+ (including [email protected]) ignores nohoist, which breaks React Native
module resolution; remove the entire workspaces.nohoist key from package.json
and instead add/update .yarnrc.yml to use node-modules linking and controlled
hoisting by setting nodeLinker: node-modules and nmHoistingLimits: workspaces
(or nmHoistingLimits: dependencies for stricter hoisting), and optionally set
pnpMode: loose only if you later adopt PnP; ensure packageManager remains
correct.

Comment on lines 49 to 53
"dependencies": {
"@babel/runtime": "^7.28.3",
"react": "^18.3.1",
"react-native": "0.76.9"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Place @babel/runtime where it’s actually required (per package).

@babel/runtime should be a direct dependency of each package whose emitted JS uses helpers (async/await, generators). Keeping it only at the root risks accidental breakage if hoisting changes. Recommend adding it to:

  • @selfxyz/mobile-sdk-alpha
  • any RN app packages that compile TS/JS with the RN Babel preset

You can keep the root resolutions pin for consistency across workspaces.

🤖 Prompt for AI Agents
In package.json around lines 49 to 53, @babel/runtime is declared only at the
root but should be a direct dependency of any workspace packages that emit code
using Babel helpers (e.g., @selfxyz/mobile-sdk-alpha and RN app packages using
the RN Babel preset); add @babel/runtime@^7.28.3 (or the pinned resolution
version) to each such package.json dependencies, keep the root resolutions pin
for version consistency, and run yarn/npm install and a workspace build to
verify no hoisting-related runtime failures.

Comment on lines +22 to +23
unstable_enableSymlinks: true,
disableHierarchicalLookup: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Monorepo resolution: good addition; ensure Jest/moduleNameMapper mirrors Metro

Enabling symlinks and disabling hierarchical lookup helps Metro, but Jest (or ts-jest) won’t honor this automatically. Mirror critical aliases/nodeModulesPaths in Jest config to avoid test-time “Cannot find module …” even when Metro works.

If Jest is used here, confirm mappings with:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
fd -a "jest.config.*" packages/mobile-sdk-alpha/demo-app || echo "ℹ️ No Jest config in demo-app; ensure upstream config maps RN deps if tests run here."

Length of output: 148


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo "=== Metro config ==="
sed -n '1,200p' packages/mobile-sdk-alpha/demo-app/metro.config.cjs
echo "=== Jest config ==="
sed -n '1,200p' packages/mobile-sdk-alpha/demo-app/jest.config.cjs

Length of output: 1620


Mirror Metro resolver settings in demo-app/jest.config.cjs
Add moduleDirectories ['node_modules','/../../../node_modules'] and moduleNameMapper aliases for @babel/runtime, react, react-native and @selfxyz/* to match Metro’s extraNodeModules and nodeModulesPaths.

🤖 Prompt for AI Agents
In packages/mobile-sdk-alpha/demo-app/jest.config.cjs (mirror Metro resolver
settings from metro.config.cjs lines ~22-23): add moduleDirectories:
['node_modules','<rootDir>/../../../node_modules'] and add moduleNameMapper
entries that point Jest to the same node_modules used by Metro — e.g. map
^@babel/runtime(.*)$ to '<rootDir>/../../../node_modules/@babel/runtime$1',
^react$ to '<rootDir>/../../../node_modules/react', ^react-native$ to
'<rootDir>/../../../node_modules/react-native', and ^@selfxyz/(.*)$ to
'<rootDir>/../../../node_modules/@selfxyz/$1'; update the existing
jest.config.cjs export to include these keys so Jest resolves modules the same
way Metro does.

@transphorm transphorm closed this Sep 4, 2025
@transphorm transphorm deleted the codex/verify-fix-for-metro-bundler-issues branch September 7, 2025 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants