Skip to content

[MS-1545] Increment attempt number on face recapture - #1791

Open
meladRaouf wants to merge 1 commit into
mainfrom
bugfix/record-face-capture-attempts
Open

[MS-1545] Increment attempt number on face recapture#1791
meladRaouf wants to merge 1 commit into
mainfrom
bugfix/record-face-capture-attempts

Conversation

@meladRaouf

@meladRaouf meladRaouf commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

MS-1545
Will be released in: version

Root cause analysis (for bugfixes only)

First known affected version: v2021.3.0

  • Found while investigating why FaceCaptureEvent.attemptNb was always 0 in analytics, regardless of how many times a user retook their face capture.
  • Root cause: FaceCaptureViewModel.attemptNumber used to be incremented as a side-effect of a canRetry property getter (get() = attemptNumber++ < maxRetries), used by a dedicated retry-limit screen. That screen (RetryFragment, canRetry, handleRetry()) was removed in commit 8fd088e4e4 ("test removing retry flow", 2021-06-10), but the attemptNumber field was kept (still read when building FaceCaptureEvents) without anything left to increment it. It has been stuck at its initial value since.

Notable changes

  • FaceCaptureViewModel.recapture() now increments attemptNumber on every recapture (covers the confirmation screen's decline/back-press/retake actions and the "no face detected" auto-retry).
  • LiveFeedbackViewModel.showValidationErrorAndReset() now also increments the attempt count on a failed spoof-check retry, so each retry gets a distinct attemptNb instead of collapsing into one.
  • attemptNumber is now backed by SavedStateHandle so it survives process death, and encapsulated with a private setter (only mutable via recapture()/internal reset) instead of a public mutable field.
  • initFaceBioSdk resets the per-step state (attemptNumber, initialised) when a new capture step starts for a different face SDK, since FaceCaptureViewModel is Activity-scoped and can be reused across multiple face-capture steps (e.g. a project configured with more than one face SDK).
  • Removed a stale/misleading default (LiveFeedbackViewModel.attemptNumber = 1) that was always overwritten before use.

Testing guidance

  • FaceCaptureViewModelTest: verifies attemptNumber increments on recapture(), survives being restored from a SavedStateHandle, and resets when a capture step starts for a different SDK.
  • LiveFeedbackViewModelTest: verifies a failed spoof-check retry reports an incrementing attempt number via SimpleCaptureEventReporter.addCaptureEvents.
  • Manually: run a face capture flow, decline/retake at the confirmation screen a few times, and confirm the synced FaceCaptureEvent.attemptNb increments per retry instead of staying at 0.

Additional work checklist

  • Effect on other features and security has been considered
  • Design document marked as "In development" (if applicable)
  • External (Gitbook) and internal (Confluence) Documentation is up to date (or ticket created)
  • Test cases in Testiny are up to date (or ticket created)
  • Other teams notified about the changes (if applicable)

@cla-bot cla-bot Bot added the ... label Aug 17, 2026

@luhmirin-s luhmirin-s left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comments are a bit excessive, IMO.

@meladRaouf
meladRaouf force-pushed the bugfix/record-face-capture-attempts branch from 1ba532d to ca44ced Compare August 17, 2026 13:22
@meladRaouf
meladRaouf requested review from BurningAXE, alex-vt, alexandr-simprints and luhmirin-s and a lite review from Copilot August 17, 2026 13:22
@meladRaouf
meladRaouf marked this pull request as ready for review August 17, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants