Skip to content

Conversation

@transphorm
Copy link
Member

@transphorm transphorm commented Oct 1, 2025

Summary by CodeRabbit

  • New Features

    • Automatically selects the latest available iPhone simulator when launching the iOS app.
  • Bug Fixes

    • Added timeouts and improved error handling to network requests, reducing hangs and improving app stability.
    • Sanitized deep link error logs to avoid exposing sensitive URLs.
    • Improved crypto compatibility and hashing module resolution to prevent potential runtime issues.
  • Chores

    • Incremented iOS build number.
  • Tests

    • Updated test dependencies to improve hashing verifications and type coverage.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 1, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Switches iOS run command to a Node script that auto-selects a simulator. Adds fetch timeouts and error-state resets across protocol store fetchers. Adjusts crypto polyfill to normalize key inputs. Updates Aadhaar mock utilities and circuit input/export naming. Tweaks Metro resolver for @noble/hashes. Minor logging, tests, exports, and version bump.

Changes

Cohort / File(s) Summary
iOS run flow
app/package.json, app/scripts/run-ios-simulator.cjs
Replace direct react-native run with a Node script that picks the latest available iPhone simulator via simctl and runs with a specific scheme; adds error handling and selection logic.
Protocol fetch timeouts
packages/mobile-sdk-alpha/src/stores/protocolStore.ts
Introduces fetchWithTimeout using AbortController; applies across many fetchers; on errors, explicitly resets related state fields to null and logs.
Metro resolver for @noble/hashes
packages/mobile-sdk-demo/metro.config.cjs
Enhances subpath resolution to dynamically discover package root, try multiple candidate paths, and fallback safely; adds robustness and error handling.
Common exports and barrels
common/index.ts, common/src/utils/index.ts
Exposes Environment type and utilities (fetchOfacTrees, generateTEEInputsDiscloseStateless); reorders formatMrz export (no signature change).
Constants and circuit inputs
common/src/constants/constants.ts, common/src/utils/circuits/generateInputs.ts
Swaps names between MAX_PADDED_SIGNED_ATTR_LEN and MAX_PADDED_SIGNED_ATTR_LEN_FOR_TESTS; correspondingly swaps public function names generateCircuitInputsRegister ↔ generateCircuitInputsRegisterForTests.
Crypto polyfill + tests
common/src/polyfills/crypto.ts, common/tests/cryptoHash.test.ts, common/tests/cryptoHmac.test.ts
Broadens HMAC key normalization to handle buffer-like views; tests import noble sha256; formatting-only newline in HMAC test.
Aadhaar mock utilities
common/src/utils/aadhaar/mockData.ts, common/src/utils/passports/genMockIdDoc.ts
Adds computeCommitment and computePackedCommitment; reintroduces convertByteArrayToBigInt; rewrites processQRDataSimple to data-driven extraction and hashing; adjusts imports for mock Aadhaar keys.
App UI and versioning
app/src/screens/prove/ProofRequestStatusScreen.tsx, app/version.json
Sanitizes deep-link error log message; increments iOS build number 175 → 176.
Demo package typings
packages/mobile-sdk-demo/package.json
Adds dev dependency @types/node.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant N as Node Script (run-ios-simulator.cjs)
  participant X as xcrun simctl
  participant RN as react-native CLI

  Dev->>N: yarn ios
  N->>X: simctl list devices available --json
  X-->>N: JSON devices
  N->>N: Select latest available iPhone simulator
  alt Simulator found
    N->>RN: run-ios --scheme OpenPassport --simulator="Name"
    RN-->>Dev: Build/run output
  else None found
    N->>Dev: Log error and exit(1)
  end
Loading
sequenceDiagram
  autonumber
  participant S as ProtocolStore
  participant F as fetchWithTimeout
  participant Net as Network/API
  participant AC as AbortController

  S->>F: fetch(url, opts, timeoutMs)
  F->>AC: start timer
  F->>Net: fetch(url, {signal})
  alt Response before timeout
    Net-->>F: Response
    F->>AC: clear timer
    F-->>S: Parsed data
    S->>S: Update state with data
  else Timeout or error
    F->>AC: abort()
    F-->>S: Throw error
    S->>S: Log and set related state fields to null
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~55 minutes

Possibly related PRs

Suggested labels

codex

Suggested reviewers

  • aaronmgdr
  • remicolin
  • shazarre

Poem

A simulator wakes with a chosen gleam,
Timeouts guard the nets like a silent team.
Hashes find their paths through Metro’s maze,
Aadhaar bits re-pack in data-driven ways.
Constants swap names, circuits change attire—
Build 176 rolls on, a little tighter.

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch justin/address-staging-branch-cr-issues-pr-1169

📜 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 422d0cc and 9b7fbb0.

⛔ Files ignored due to path filters (2)
  • app/ios/Podfile.lock is excluded by !**/*.lock
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (16)
  • app/package.json (1 hunks)
  • app/scripts/run-ios-simulator.cjs (1 hunks)
  • app/src/screens/prove/ProofRequestStatusScreen.tsx (1 hunks)
  • app/version.json (1 hunks)
  • common/index.ts (2 hunks)
  • common/src/constants/constants.ts (1 hunks)
  • common/src/polyfills/crypto.ts (1 hunks)
  • common/src/utils/aadhaar/mockData.ts (3 hunks)
  • common/src/utils/circuits/generateInputs.ts (4 hunks)
  • common/src/utils/index.ts (1 hunks)
  • common/src/utils/passports/genMockIdDoc.ts (1 hunks)
  • common/tests/cryptoHash.test.ts (1 hunks)
  • common/tests/cryptoHmac.test.ts (1 hunks)
  • packages/mobile-sdk-alpha/src/stores/protocolStore.ts (14 hunks)
  • packages/mobile-sdk-demo/metro.config.cjs (1 hunks)
  • packages/mobile-sdk-demo/package.json (1 hunks)

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.

@transphorm transphorm merged commit fd1f008 into dev Oct 1, 2025
19 of 22 checks passed
@transphorm transphorm deleted the justin/address-staging-branch-cr-issues-pr-1169 branch October 1, 2025 23:12
transphorm added a commit that referenced this pull request Oct 2, 2025
chore: address staging branch issues pr #1169 (#1178)
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