Skip to content

feat: various error handling (21-30)#3260

Open
al-rosenthal wants to merge 36 commits intomainfrom
feat/errors-21-30
Open

feat: various error handling (21-30)#3260
al-rosenthal wants to merge 36 commits intomainfrom
feat/errors-21-30

Conversation

@al-rosenthal
Copy link
Contributor

@al-rosenthal al-rosenthal commented Feb 10, 2026

Summary of Changes

  • added third party keyboard detection. This listens to keyboard open events and will trigger on the first time a keyboard opens
  • added logic for handling account updates (card type changed, status updated)
  • added logic for handling destructive account updates (additional cards)
  • added api rules for login rejection errors (client metadata, token endpoints)
  • added api rules to error tester in settings

Testing Instructions

Keyboard check:

  • on an android device, download a 3rd party keyboard (SwiftKey)
  • Set that as your keyboard
  • Run app
  • Go through onboarding and select PIN authentication
  • See alert warning
    ** This alert should only appear once for the user

Testing Account updated:

  • Once verified, access support tools
  • Client Integrations -> Test Accounts and search for your verified account
  • Select account and press 'Updated BCSC Test Accounts'
  • Modify the card type and press update
  • Reopen app and see alert indicating account information has changed

Testing Account removals

  • User removed, needs to be done from the web portal or another device with the same account activated
  • ID check can be used to remove a card from a device

Testing additional cards

  • Easiest way is to hijack the token response
  • Otherwise you'll need to reach out to team members to setup that scenario

Acceptance Criteria

Replace this text with the acceptance criteria that must be met for this PR to be approved.

Screenshots, videos, or gifs

Replace this text with embedded media for UI changes if they are included in this PR. If there are none, simply enter N/A

Related Issues

Replace this text with tagged issue #'s that are relevant to this PR. If there are none, simply enter N/A

Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
@al-rosenthal al-rosenthal marked this pull request as ready for review February 10, 2026 21:57
@al-rosenthal al-rosenthal requested review from MacDeluca, Copilot and jleach and removed request for jleach February 10, 2026 21:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR expands BCSC-specific error handling and user safety flows by adding third‑party keyboard detection (Android), introducing “account updated” informative alerts driven by token metadata changes, and refining login rejection error handling.

Changes:

  • Added native module APIs + app hook to detect third‑party keyboards and optionally open the keyboard picker on Android.
  • Added credential-metadata comparison + a startup system check to display “Account Updated” alerts when BCSC token metadata changes.
  • Updated error-handling APIs/policies (e.g., emitErrorModal rename, login-rejection policies) and token clearing behavior.

Reviewed changes

Copilot reviewed 35 out of 35 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
packages/bcsc-core/src/index.ts Exposes new keyboard-related native calls from the bcsc-core JS entrypoint.
packages/bcsc-core/src/NativeBcscCore.ts Extends TurboModule spec with keyboard detection/selector APIs.
packages/bcsc-core/ios/BcscCore.swift Adds iOS stubs for keyboard detection/selector behavior.
packages/bcsc-core/android/src/oldarch/BcscCoreSpec.kt Extends old-arch Android native spec with keyboard APIs.
packages/bcsc-core/android/src/main/java/com/bcsccore/BcscCoreModule.kt Implements Android keyboard detection and input-method picker opening.
app/src/store.tsx Adds persisted state for keyboard warning dismissal and account-update metadata/alert reasoning.
app/src/services/system-checks/InformativeBCSCAlertsSystemCheck.ts New system check to show “Account Updated” alert based on stored alert reasoning.
app/src/services/system-checks/InformativeBCSCAlertSystemCheck.test.ts Unit tests for the new “Account Updated” system check behavior.
app/src/screens/Splash.tsx Removes unused error-alert usage from splash initialization dependencies.
app/src/screens/ErrorAlertTest.tsx Updates test screen to use renamed emitErrorModal API.
app/src/localization/pt-br/index.ts Adds new localized strings for additional-card invalidation and new alerts.
app/src/localization/fr/index.ts Adds new localized strings for additional-card invalidation and new alerts.
app/src/localization/en/index.ts Adds new localized strings for additional-card invalidation and new alerts.
app/src/contexts/ErrorAlertContext.tsx Renames emitError to emitErrorModal for clarity and updates provider value.
app/src/contexts/ErrorAlertContext.test.tsx Updates tests for the renamed error emission API.
app/src/bcwallet-theme/features/person-flow/screens/PersonCredentialLoading.tsx Updates app-to-app flow to use emitErrorModal.
app/src/bcsc-theme/navigators/RootStack.tsx Updates state-load error handling to use emitErrorModal.
app/src/bcsc-theme/hooks/useCreateSystemChecks.tsx Adds the new informative “Account Updated” system check and wires alert emitter.
app/src/bcsc-theme/hooks/useCreateSystemChecks.test.tsx Updates system-check list expectations and adds additional device-info mocks.
app/src/bcsc-theme/features/verify/email/EnterEmailScreen.tsx Triggers third-party keyboard warning on mount.
app/src/bcsc-theme/features/verify/email/EnterEmailScreen.test.tsx Wraps screen in ErrorAlertProvider for new warning hook dependencies.
app/src/bcsc-theme/features/verify/ManualSerialScreen.tsx Triggers third-party keyboard warning on mount.
app/src/bcsc-theme/features/verify/ManualSerialScreen.test.tsx Wraps screen in ErrorAlertProvider for new warning hook dependencies.
app/src/bcsc-theme/features/pairing/ManualPairing.tsx Triggers third-party keyboard warning on mount.
app/src/bcsc-theme/features/onboarding/CreatePINScreen.tsx Triggers third-party keyboard warning on mount.
app/src/bcsc-theme/features/onboarding/CreatePINScreen.test.tsx Wraps screen in ErrorAlertProvider for new warning hook dependencies.
app/src/bcsc-theme/features/modal/DeviceInvalidated.tsx Adds destructive invalidation reason handling for additional-card scenario.
app/src/bcsc-theme/contexts/BCSCIdTokenContext.tsx Derives/stores credential metadata from token and emits alert reasoning on change.
app/src/bcsc-theme/api/hooks/usethirdPartyKeyboardWarning.tsx Implements third-party keyboard warning hook using the new native APIs.
app/src/bcsc-theme/api/hooks/useThirdPartyKeyboardWarning.test.ts Adds a test file (currently not testing the intended hook).
app/src/bcsc-theme/api/hooks/useFactoryReset.tsx Switches from direct token mutation to client.clearTokens().
app/src/bcsc-theme/api/hooks/useFactoryReset.test.ts Updates tests to reflect clearTokens() behavior.
app/src/bcsc-theme/api/clientErrorPolicies.ts Adds login-rejection error policies for client metadata and device authorization failures.
app/src/bcsc-theme/api/client.ts Adds clearTokens() helper to reset token state consistently.
app/package.json Renames setup scripts to setup:ios / setup:android and updates setup.

al-rosenthal and others added 5 commits February 10, 2026 14:41
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Al Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 22.60274% with 113 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.79%. Comparing base (1e324f1) to head (35604fb).

Files with missing lines Patch % Lines
app/src/bcsc-theme/api/clientErrorPolicies.ts 10.00% 27 Missing ⚠️
app/src/bcsc-theme/contexts/BCSCIdTokenContext.tsx 0.00% 24 Missing ⚠️
app/src/screens/ErrorAlertTest.tsx 0.00% 23 Missing ⚠️
app/src/store.tsx 0.00% 18 Missing ⚠️
...c-theme/api/hooks/useThirdPartyKeyboardWarning.tsx 55.00% 9 Missing ⚠️
app/src/bcsc-theme/api/client.ts 0.00% 3 Missing ⚠️
app/src/bcsc-theme/navigators/RootStack.tsx 0.00% 3 Missing ⚠️
...es/person-flow/screens/PersonCredentialLoading.tsx 0.00% 2 Missing ⚠️
.../system-checks/InformativeBCSCAlertsSystemCheck.ts 87.50% 2 Missing ⚠️
app/src/bcsc-theme/navigators/OnboardingStack.tsx 0.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
Files with missing lines Coverage Δ
app/src/bcsc-theme/api/hooks/useFactoryReset.tsx 93.18% <100.00%> (ø)
...rc/bcsc-theme/features/modal/DeviceInvalidated.tsx 0.00% <ø> (ø)
.../src/bcsc-theme/features/pairing/ManualPairing.tsx 0.00% <ø> (ø)
app/src/bcsc-theme/hooks/useCreateSystemChecks.tsx 94.59% <100.00%> (ø)
app/src/contexts/ErrorAlertContext.tsx 96.66% <100.00%> (ø)
app/src/errors/errorRegistry.ts 100.00% <ø> (ø)
app/src/localization/en/index.ts 100.00% <ø> (ø)
app/src/localization/fr/index.ts 100.00% <ø> (ø)
app/src/localization/pt-br/index.ts 100.00% <ø> (ø)
app/src/screens/Splash.tsx 0.00% <ø> (ø)
... and 11 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e324f1...35604fb. Read the comment docs.

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

Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
@al-rosenthal al-rosenthal self-assigned this Feb 11, 2026
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
@MacDeluca
Copy link
Contributor

Pulling and testing locally 👍🏼

Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
@MacDeluca
Copy link
Contributor

MacDeluca commented Feb 12, 2026

In progress testing:

Note: From my testing so far, alerts 21 - 23 are rendering the incorrect content (title, description) but the actions and the onPress events are correct.

Alerts:
21: ios ✅ android: ✅
22: ios ✅ android: ✅
23: ios ✅ android: ✅
24: ios ✅ android:
25: ios ✅ android:
26:
27:
28:
29:
30: Third party keyboard ✅

Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
…stacks

Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
Signed-off-by: Alfred Rosenthal <alfred.k.rosenthal@gmail.com>
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
3.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

3 participants