Skip to content

Conversation

@aaronmgdr
Copy link
Contributor

@aaronmgdr aaronmgdr commented Oct 3, 2025

fixes types

Summary by CodeRabbit

  • New Features
    • Exposed MRZ utilities (extraction, formatting, scanning).
    • Added NFC scanning and response parsing.
    • Added document name extraction and passport data validation.
    • Introduced web scanner shim for browser environments.
    • Provided mock document generators for development.
    • Added a new SDK entry point and exposed context/provider hooks and QR code screen.
  • Refactor
    • Deprecated certain client helpers in favor of newer APIs.
    • Cleaned up imports and reordered public exports.
  • Chores
    • Added CI type-checking step.
    • Adjusted lint script arguments.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

Walkthrough

Adds a CI “Check App Types” step to mobile workflow. Reworks mobile-sdk-alpha public exports: converts a value export to a type-only export, introduces multiple new re-exports (MRZ, NFC, mocks, validation, web shim, entry), marks client exports deprecated, and reorders exports. Minor lint script tweak and a screen import cleanup.

Changes

Cohort / File(s) Summary of Changes
CI Workflow
.github/workflows/mobile-ci.yml
Added “Check App Types” step running yarn types in app during build-deps, positioned after prettier and before license header check.
SDK Public API Surface
packages/mobile-sdk-alpha/src/index.ts
Converted provingMachineCircuitType from value export to type-only; added/reordered exports for MRZ utilities, NFC utilities, mock generators, document validation, web scanner shim, entry, context hooks, QR code screen; added deprecation comment for createSelfClient/createListenersMap.
SDK Tooling Script
packages/mobile-sdk-alpha/package.json
Changed lint script order from eslint --fix . to eslint . --fix.
App Screen Import Cleanup
app/src/screens/document/ConfirmBelongingScreen.tsx
Removed usePrepareDocumentProof import from onboarding-confirm-identification; retained only getPreRegistrationDescription. No functional changes in component logic noted.

Sequence Diagram(s)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

codex

Suggested reviewers

  • remicolin

Poem

New types take flight, the bots now check,
Exports align—no dangling spec.
MRZ, NFC join the show,
Deprecated paths softly let go.
Lint steps shuffle, screens stay clean—
CI hums on, precise and keen. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and concisely summarizes the primary change—adding a missing TypeScript type check to the app’s CI—without extraneous detail or ambiguity, making it easy for reviewers to understand the main focus of the pull request at a glance.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch aaronmgdr/app-type-check

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f2fcee and ee21982.

📒 Files selected for processing (4)
  • .github/workflows/mobile-ci.yml (1 hunks)
  • app/src/screens/document/ConfirmBelongingScreen.tsx (1 hunks)
  • packages/mobile-sdk-alpha/package.json (1 hunks)
  • packages/mobile-sdk-alpha/src/index.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/mobile-ci.yml
🧰 Additional context used
📓 Path-based instructions (8)
packages/mobile-sdk-alpha/package.json

📄 CodeRabbit inference engine (.cursor/rules/mobile-sdk-migration.mdc)

packages/mobile-sdk-alpha/package.json: Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint
Enable tree shaking for the SDK (e.g., ensure 'sideEffects' is correctly set in package.json and exports are ESM-friendly)

Files:

  • packages/mobile-sdk-alpha/package.json
packages/mobile-sdk-alpha/**/package.json

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/package.json: Ensure package exports are properly configured
Verify package conditions are valid (e.g., exports conditions)

Files:

  • packages/mobile-sdk-alpha/package.json
**/*.{js,ts,tsx,jsx,sol,nr}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{js,ts,tsx,jsx,sol,nr}: NEVER log sensitive data including PII (names, DOB, passport numbers, addresses), credentials, tokens, API keys, private keys, or session identifiers.
ALWAYS redact/mask sensitive fields in logs using consistent patterns (e.g., ***-***-1234 for passport numbers, J*** D*** for names).

Files:

  • app/src/screens/document/ConfirmBelongingScreen.tsx
  • packages/mobile-sdk-alpha/src/index.ts
app/**/*.{ts,tsx}

📄 CodeRabbit inference engine (app/AGENTS.md)

Type checking must pass before PRs (yarn types)

Files:

  • app/src/screens/document/ConfirmBelongingScreen.tsx
app/src/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

app/src/**/*.{ts,tsx,js,jsx}: Review React Native TypeScript code for:

  • Component architecture and reusability
  • State management patterns
  • Performance optimizations
  • TypeScript type safety
  • React hooks usage and dependencies
  • Navigation patterns

Files:

  • app/src/screens/document/ConfirmBelongingScreen.tsx
packages/mobile-sdk-alpha/src/index.ts

📄 CodeRabbit inference engine (.cursor/rules/mobile-sdk-migration.mdc)

Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts

Files:

  • packages/mobile-sdk-alpha/src/index.ts
packages/mobile-sdk-alpha/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/*.{ts,tsx}: Use strict TypeScript type checking across the codebase
Follow ESLint TypeScript-specific rules
Avoid introducing circular dependencies

Files:

  • packages/mobile-sdk-alpha/src/index.ts
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/src/index.ts
🧠 Learnings (9)
📓 Common learnings
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-09-22T11:10:57.879Z
Learning: Applies to app/**/*.{ts,tsx} : Type checking must pass before PRs (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: Applies to packages/mobile-sdk-alpha/**/package.json : Ensure package exports are properly configured
📚 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/**/package.json : Ensure package exports are properly configured

Applied to files:

  • packages/mobile-sdk-alpha/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/package.json : Expose a 'test:build' script in the SDK's package.json that runs build, test, types, and lint

Applied to files:

  • packages/mobile-sdk-alpha/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/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/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/**/package.json : Verify package conditions are valid (e.g., exports conditions)

Applied to files:

  • packages/mobile-sdk-alpha/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/**/*.{ts,tsx} : Follow ESLint TypeScript-specific rules

Applied to files:

  • packages/mobile-sdk-alpha/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 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:

  • packages/mobile-sdk-alpha/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: Run yarn nice, yarn types, and yarn test before commits and PRs

Applied to files:

  • packages/mobile-sdk-alpha/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/src/index.ts : Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts

Applied to files:

  • packages/mobile-sdk-alpha/src/index.ts
⏰ 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). (4)
  • GitHub Check: analyze-ios
  • GitHub Check: e2e-ios
  • GitHub Check: build-deps
  • GitHub Check: analyze-android
🔇 Additional comments (7)
packages/mobile-sdk-alpha/package.json (1)

85-85: LGTM!

The argument reordering in the lint script is functionally equivalent and does not impact behavior.

app/src/screens/document/ConfirmBelongingScreen.tsx (1)

15-15: LGTM!

Removing the unused usePrepareDocumentProof import cleans up the import surface and aligns with the PR's type-checking improvements.

packages/mobile-sdk-alpha/src/index.ts (5)

54-54: LGTM!

Converting provingMachineCircuitType to a type-only export is appropriate for ensuring type safety and aligns with TypeScript best practices.


69-69: LGTM!

Adding ProvingStateType as an exported type appropriately extends the public API surface for type consumers.


71-77: LGTM!

The new exports for QRCodeScreen, SdkEvents, context providers, and SelfMobileSdk entry appropriately expand the public API surface and align with the guideline to re-export new SDK modules.


88-89: LGTM!

The deprecation comment for createListenersMap and createSelfClient is clear and provides migration guidance. This is good practice for maintaining backward compatibility while steering users toward newer patterns.


93-112: LGTM!

The new utility exports (MRZ, document utils, mock generators, validation, NFC, web shims, QR, scanner adapters) appropriately expand the SDK's public API surface and align with the guideline to re-export new SDK modules via the index.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

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: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 318b83f and 379ba66.

📒 Files selected for processing (3)
  • .github/workflows/mobile-ci.yml (1 hunks)
  • app/src/screens/prove/ConfirmBelongingScreen.tsx (1 hunks)
  • packages/mobile-sdk-alpha/src/index.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,ts,tsx,jsx,sol,nr}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{js,ts,tsx,jsx,sol,nr}: NEVER log sensitive data including PII (names, DOB, passport numbers, addresses), credentials, tokens, API keys, private keys, or session identifiers.
ALWAYS redact/mask sensitive fields in logs using consistent patterns (e.g., ***-***-1234 for passport numbers, J*** D*** for names).

Files:

  • app/src/screens/prove/ConfirmBelongingScreen.tsx
  • packages/mobile-sdk-alpha/src/index.ts
app/**/*.{ts,tsx}

📄 CodeRabbit inference engine (app/AGENTS.md)

Type checking must pass before PRs (yarn types)

Files:

  • app/src/screens/prove/ConfirmBelongingScreen.tsx
app/src/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

app/src/**/*.{ts,tsx,js,jsx}: Review React Native TypeScript code for:

  • Component architecture and reusability
  • State management patterns
  • Performance optimizations
  • TypeScript type safety
  • React hooks usage and dependencies
  • Navigation patterns

Files:

  • app/src/screens/prove/ConfirmBelongingScreen.tsx
packages/mobile-sdk-alpha/src/index.ts

📄 CodeRabbit inference engine (.cursor/rules/mobile-sdk-migration.mdc)

Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts

Files:

  • packages/mobile-sdk-alpha/src/index.ts
packages/mobile-sdk-alpha/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/*.{ts,tsx}: Use strict TypeScript type checking across the codebase
Follow ESLint TypeScript-specific rules
Avoid introducing circular dependencies

Files:

  • packages/mobile-sdk-alpha/src/index.ts
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/src/index.ts
.github/workflows/**/*.{yml,yaml}

📄 CodeRabbit inference engine (AGENTS.md)

.github/workflows/**/*.{yml,yaml}: In GitHub Actions workflows, use shared composite caching actions from .github/actions (cache-yarn, cache-bundler, cache-gradle, cache-pods)
Do not call actions/cache directly; rely on the shared composite caching actions
When using cache actions, optionally pass cache-version (often with GH_CACHE_VERSION and tool version) for stable keys

Files:

  • .github/workflows/mobile-ci.yml
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-09-22T11:10:57.879Z
Learning: Applies to app/**/*.{ts,tsx} : Type checking must pass before PRs (yarn types)
📚 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/src/index.ts : Re-export new SDK modules via packages/mobile-sdk-alpha/src/index.ts

Applied to files:

  • packages/mobile-sdk-alpha/src/index.ts
📚 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/**/*.{ts,tsx} : Use strict TypeScript type checking across the codebase

Applied to files:

  • packages/mobile-sdk-alpha/src/index.ts
📚 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/src/index.ts
📚 Learning: 2025-09-22T11:10:57.879Z
Learnt from: CR
PR: selfxyz/self#0
File: app/AGENTS.md:0-0
Timestamp: 2025-09-22T11:10:57.879Z
Learning: Applies to app/**/*.{ts,tsx} : Type checking must pass before PRs (yarn types)

Applied to files:

  • .github/workflows/mobile-ci.yml
📚 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 committing, run repository checks (yarn nice, yarn lint, yarn build, contracts build, yarn types)

Applied to files:

  • .github/workflows/mobile-ci.yml
📚 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: Run yarn nice, yarn types, and yarn test before commits and PRs

Applied to files:

  • .github/workflows/mobile-ci.yml
🪛 GitHub Actions: Mobile SDK CI
packages/mobile-sdk-alpha/src/index.ts

[error] 106-106: sort-exports/sort-exports: Expected provingMachineCircuitType before parseNFCResponse.

🪛 GitHub Actions: Workspace CI
packages/mobile-sdk-alpha/src/index.ts

[error] 106-106: sort-exports/sort-exports: Expected provingMachineCircuitType before parseNFCResponse

🪛 GitHub Check: lint
packages/mobile-sdk-alpha/src/index.ts

[failure] 106-106:
Expected provingMachineCircuitType before parseNFCResponse

🪛 GitHub Check: workspace-lint
packages/mobile-sdk-alpha/src/index.ts

[failure] 106-106:
Expected provingMachineCircuitType before parseNFCResponse

⏰ 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). (5)
  • GitHub Check: android-build-test
  • GitHub Check: e2e-ios
  • GitHub Check: build-deps
  • GitHub Check: analyze-ios
  • GitHub Check: analyze-android
🔇 Additional comments (2)
.github/workflows/mobile-ci.yml (1)

89-91: LGTM! Type checking enforced in CI.

This addition ensures TypeScript type correctness is validated before merge, preventing type regressions. The step placement after formatting and before license checks is appropriate.

Based on learnings.

app/src/screens/prove/ConfirmBelongingScreen.tsx (1)

15-15: Removal of usePrepareDocumentProof is safe: ripgrep shows no references in ConfirmBelongingScreen.tsx; the import cleanup is correct.

@aaronmgdr aaronmgdr force-pushed the aaronmgdr/app-type-check branch from 5f2fcee to ee21982 Compare October 3, 2025 10:46
@aaronmgdr aaronmgdr merged commit 187fc18 into dev Oct 3, 2025
27 of 28 checks passed
@aaronmgdr aaronmgdr deleted the aaronmgdr/app-type-check branch October 3, 2025 12:27
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.

2 participants