Skip to content

Backend/SV: Differentiate failures due to birthdate vs gender mismatch#9182

Open
tristanlabelle wants to merge 9 commits into
developfrom
claude/issue-9174-20260624-2220
Open

Backend/SV: Differentiate failures due to birthdate vs gender mismatch#9182
tristanlabelle wants to merge 9 commits into
developfrom
claude/issue-9174-20260624-2220

Conversation

@tristanlabelle

@tristanlabelle tristanlabelle commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Users were confused from the message saying that their passport date of birth or gender mismatched their profile, so add enumerants that differentiate those cases and update notifications.

To avoid duplicating more test code, I refactored the IRIS callback mocking logic (see changes to existing tests).

Also fixes GetStrongVerificationAttemptStatus returning UNKNOWN in the duplicate status case.

With help from Claude Code

Closes #9174.

Testing

Added tests.

Backend checklist

  • Added tests for any new code or added a regression test if fixing a bug
  • Run the backend locally and it works
  • Added migrations if there are any database changes, rebased onto develop if necessary for linear migration history

For maintainers

  • Maintainers can push commits to my branch
  • Maintainers can merge this PR for me

github-actions Bot and others added 2 commits June 24, 2026 22:28
Strong Verification failures that came from a birthdate or gender
mismatch all emitted a single combined reason, so users couldn't tell
which field actually failed. Add SV_FAIL_REASON_WRONG_BIRTHDATE and
SV_FAIL_REASON_WRONG_GENDER and, in the failure branch, evaluate
matches_birthdate/matches_gender separately to pick a specific reason,
keeping the combined reason only when both mismatch. Split the email
and push notification copy accordingly.

Co-authored-by: Tristan Labelle <tristanlabelle@users.noreply.github.com>
@tristanlabelle tristanlabelle changed the title Backend: split SV failure reasons for birthdate vs gender mismatch Backend/SV: Differentiate failures due to birthdate vs gender mismatch Jun 25, 2026
@CouchersBot

CouchersBot commented Jun 25, 2026

Copy link
Copy Markdown
Member

Web (Vercel)

View the Vercel web preview for this branch.

Backend

Schema Schema diff Sample emails

Other

Protos Backend coverage

@tristanlabelle
tristanlabelle marked this pull request as ready for review June 25, 2026 17:34
@tristanlabelle
tristanlabelle requested a review from aapeliv as a code owner June 25, 2026 17:34
@tristanlabelle
tristanlabelle requested a review from a team June 25, 2026 17:34

@aapeliv aapeliv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fine as-is if you have verified this works; added some comments

StrongVerificationAttemptStatus.in_progress_waiting_on_user_in_app: account_pb2.STRONG_VERIFICATION_ATTEMPT_STATUS_IN_PROGRESS_WAITING_ON_USER_IN_APP,
StrongVerificationAttemptStatus.in_progress_waiting_on_backend: account_pb2.STRONG_VERIFICATION_ATTEMPT_STATUS_IN_PROGRESS_WAITING_ON_BACKEND,
StrongVerificationAttemptStatus.failed: account_pb2.STRONG_VERIFICATION_ATTEMPT_STATUS_FAILED,
StrongVerificationAttemptStatus.duplicate: account_pb2.STRONG_VERIFICATION_ATTEMPT_STATUS_FAILED,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what happened here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The API was returning UNKNOWN as the status in this case. In the test I expected FAILED. It seemed like an oversight?

The semantics are not super clear as to whether it's querying that the verification attempt succeeded (they provided a legit passport), in which case this api should return SUCCESS, or that it resulted in obtaining a strong verification, in this case it makes sense to return FAILED.

SV_FAIL_REASON_UNKNOWN = 0;
// birthdate doesn't match profile or gender
// both birthdate and gender don't match the profile
SV_FAIL_REASON_WRONG_BIRTHDATE_OR_GENDER = 1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

then should this be renamed to AND? and also should we update the translation strings?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That makes sense. I was wondering if to make it into a more generic failure but handling three cases is still manageable.

@tristanlabelle

Copy link
Copy Markdown
Contributor Author

@aapeliv

fine as-is if you have verified this works;

Anything I can do to verify Strong Verification on top of the tests I added/updated?

@aapeliv

aapeliv commented Jun 30, 2026

Copy link
Copy Markdown
Member

@aapeliv

fine as-is if you have verified this works;

Anything I can do to verify Strong Verification on top of the tests I added/updated?

i guess you can't on dev. once it's on stage you can test there though.

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.

Strong Verification failure message can't tell users whether birthdate or gender mismatched

3 participants