Skip to content

[Due for payment 2026-05-07] [ECUK In-App 3DS] [App] Clean up REASON handling in MultifactorAuthentication module #83036

Closed

Description

@dariusz-biela

Context

In PR #82704, @rafecolton requested improvements to REASON and BACKEND_MESSAGE in VALUES.ts. These were deferred because the refactor touches all MFA files and would have blown up an already large PR.

From the preparatory PR JakubKorytko/Expensify-App#2, only two commits were cherry-picked:

  • feat: map backend error messages to MFA REASON codes
  • refactor: replace numeric HTTP status keys with HTTP_STATUS categories

The rest was not included due to complexity. Full review discussion and closing rationale are in that PR.

Problem

REASON combines too many responsibilities: screen selection, error recovery flow, expo-secure-store exception mapping, and observability. It's passed through dozens of functions via {success: boolean, reason: REASON}, making the code verbose and tightly coupled. Many REASON values have no custom handling and just fall through to the default failure screen.

What needs to be done

Based on @rafecolton's review feedback:

  • Remove success-related values from REASON - it should only represent error/failure states
  • Remove REASON values, backend messages, and response map entries that don't have explicit/custom handling
  • Simplify error grouping: combine errors into SERVER_ERRORS (5xx), CLIENT_ERRORS (4xx), and LOCAL_ERRORS (device-side, no HTTP code)
  • Make backend message matching case-insensitive
  • Review whether TOO_MANY_ATTEMPTS, INVALID_CHALLENGE_TYPE, REGISTRATION_REQUIRED, and INVALID_SIGNED_CHALLENGE still need explicit handling
  • Add tests for different HTTP status codes with the same message and mixed-case matching

All of the above values are defined in src/libs/MultifactorAuthentication/Biometrics/VALUES.ts.

Related links

Issue OwnerCurrent Issue Owner: @dariusz-biela

Activity

  1. rafecolton commented on Mar 19, 2026

    @rafecolton
    Member

    Note to revisit isServerError changes from this thread once this issue gets prioritized

  2. melvin-bot commented on Mar 23, 2026

    @melvin-bot

    This issue has not been updated in over 15 days. @rafecolton, @chuckdries, @dariusz-biela eroding to Monthly issue.

    P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

  3. dariusz-biela commented on Apr 8, 2026

    @dariusz-biela
    ContributorAuthor

    I'm starting to work on this today.

    The solution to this issue isn't obvious, so for now I'll start by researching what we can do about it without breaking the current implementation.

  4. changed the title [-][ECUK In-App 3DS] [App] Clean up `REASON` handling in `MultifactorAuthentication` module[/-] [+][Due for payment 2026-05-07] [ECUK In-App 3DS] [App] Clean up `REASON` handling in `MultifactorAuthentication` module[/+] on Apr 30, 2026
  5. melvin-bot commented on Apr 30, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  6. melvin-bot commented on Apr 30, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.64-31 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-05-07. 🎊

    For reference, here are some details about the assignees on this issue:

  7. rafecolton commented on May 1, 2026

    @rafecolton
    Member

    This one is all set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

DailyKSv2ImprovementItem broken or needs improvement.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions