Skip to content

[MS-932] Improve CoSync analytics part 1 - add biometricDataSource to Callout event#1217

Merged
BurningAXE merged 5 commits into
mainfrom
MS-932-Improve-CoSync-1-N-event-analytics
Jun 30, 2025
Merged

[MS-932] Improve CoSync analytics part 1 - add biometricDataSource to Callout event#1217
BurningAXE merged 5 commits into
mainfrom
MS-932-Improve-CoSync-1-N-event-analytics

Conversation

@BurningAXE
Copy link
Copy Markdown
Contributor

@BurningAXE BurningAXE commented Jun 9, 2025

JIRA ticket
Will be released in: 2025.2.0

Notable changes

  • Adds a new V3 version of the Callout event which includes biometricDataSource in EnrolmentCalloutEvent, IdentificationCalloutEvent, VerificationCalloutEvent. For consistency V3 versions of EnrolmentLastBiometricsEvent and ConfirmationCalloutEvent have been created although they don't differ from V2 versions
  • No migration has been added because we want any unsynced Callout events to be uploaded as V2 versions (without biometricDataSource) and any newly added Callout events from 2025.2.0 on to be V3 with biometricDataSource. This will create consistency in the backend data where if biometricDataSource is not null we can be sure it was the real value for the session and not a default one set during migration.
  • Code duplication is a feature, not a bug :D since V2 and V3 events are mostly the same but having them as separate classes is cleaner

Testing guidance

  1. (optional) Add logging of upsynced event JSONs (let me know if you want to do this as it requires some workarounds)
  2. Disable network connection and create some sessions with various callouts in a version before this PR
  3. Upgrade to a version with this PR's changes and create another set of various callouts (ideally with and without explicit biometricDataSource)
  4. Turn connection on and verify all events sync properly and appear on the backend (old ones with null biometricDataSource and new ones with correct non-null data)
  5. (optional) Check logs that upsynced event JSONs look correct

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 Jun 9, 2025
@BurningAXE BurningAXE force-pushed the MS-932-Improve-CoSync-1-N-event-analytics branch 7 times, most recently from 4496d9e to 3f6082e Compare June 11, 2025 10:18
@BurningAXE BurningAXE changed the title Ms 932 improve co sync 1 n event analytics [MS-932] Improve CoSync analytics part 1 - add biometricDataSource to Callout event Jun 11, 2025
@BurningAXE BurningAXE marked this pull request as ready for review June 11, 2025 11:25
@BurningAXE BurningAXE requested review from a team, TristramN, alex-vt, alexandr-simprints, luhmirin-s, meladRaouf and ybourgery and removed request for a team June 11, 2025 11:25
@BurningAXE BurningAXE force-pushed the MS-932-Improve-CoSync-1-N-event-analytics branch from 3f6082e to bd9e980 Compare June 12, 2025 15:31
@BurningAXE BurningAXE requested a review from Copilot June 15, 2025 15:14
Copy link
Copy Markdown

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 introduces V3 versions of callout events and payloads to include biometricDataSource, while retaining V2 types for legacy support. It updates the serialization, domain-to-API mappings, and test factories to use the new request types.

  • Add new Api*V3 callout models and payloads with biometricDataSource
  • Rename existing callout classes to *V2 and update mappings in ApiEventPayloadType and ApiEventPayload
  • Extend ActionFactory and update tests to use IdentifyActionRequest, VerifyActionRequest, EnrolLastBiometricActionRequest, and ConfirmIdentityActionRequest

Reviewed Changes

Copilot reviewed 60 out of 60 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
infra/event-sync/src/main/java/.../ApiEnrolmentLastBiometricsCalloutV3.kt New V3 model for last biometrics callout
infra/event-sync/src/main/java/.../ApiEnrolmentLastBiometricsCalloutV2.kt Renamed old callout to V2
infra/event-sync/src/main/java/.../ApiEnrolmentCalloutV3.kt New V3 enrolment callout model
infra/event-sync/src/main/java/.../ApiEnrolmentCalloutV2.kt Renamed old enrolment callout to V2
infra/event-sync/src/main/java/.../ApiConfirmationCalloutV3.kt New V3 confirmation callout model
infra/event-sync/src/main/java/.../ApiConfirmationCalloutV2.kt Renamed old confirmation callout to V2
infra/event-sync/src/main/java/.../ApiCalloutPayloadV3.kt New V3 payload constructors including biometricDataSource
infra/event-sync/src/main/java/.../ApiCalloutPayloadV2.kt Updated V2 payload constructors
infra/event-sync/src/main/java/.../ApiCalloutIntegrationInfo.kt Removed unused integration info enum
infra/event-sync/src/main/java/.../ApiBiometricDataSource.kt New enum and mapping for BiometricDataSource
infra/event-sync/src/main/java/.../ApiEventPayloadType.kt Mapped new V3 event types
infra/event-sync/src/main/java/.../ApiEventPayload.kt Updated domain-to-API payload mapping for V2/V3 callouts
feature/login-check/src/main/java/.../ReportActionRequestEventsUseCase.kt Updated to emit V3 events
feature/login-check/src/test/java/.../ReportActionRequestEventsUseCaseTest.kt Tests updated to use ConfirmIdentityActionRequest
feature/login-check/src/test/java/.../IsUserSignedInUseCaseTest.kt Updated test to use IdentifyActionRequest
feature/login-check/src/test/java/.../ExtractParametersForAnalyticsUseCaseTest.kt Updated to use IdentifyActionRequest
feature/login-check/src/test/java/.../ExtractCrashKeysUseCaseTest.kt Updated to use IdentifyActionRequest
feature/login-check/src/test/java/.../AddAuthorizationEventUseCaseTest.kt Updated to use IdentifyActionRequest
feature/login-check/src/test/java/.../ActionFactory.kt Added new factory methods for identify/verify/enrol-last/confirm
feature/login-check/src/test/java/.../LoginCheckViewModelTest.kt Updated calls to getIdentifyRequest and others
Comments suppressed due to low confidence (3)

feature/login-check/src/test/java/com/simprints/feature/logincheck/usecases/ExtractParametersForAnalyticsUseCaseTest.kt:31

  • [nitpick] Test name refers to 'flow actions' but the implementation now uses getIdentifyRequest. Please update the test name to reflect 'identify actions'.
fun `Logs analytics keys in flow actions`() = runTest {

feature/login-check/src/test/java/com/simprints/feature/logincheck/usecases/ExtractParametersForAnalyticsUseCaseTest.kt:41

  • [nitpick] Test name refers to 'follow up actions' but the implementation now uses getConfirmationRequest. Please update the test name to reflect 'confirmation actions'.
fun `Does not log analytics keys in follow up actions`() = runTest {

feature/login-check/src/test/java/com/simprints/feature/logincheck/LoginCheckViewModelTest.kt:160

  • [nitpick] Test name mentions 'flow action' but now invokes getIdentifyRequest. Rename the test to reflect an 'identify action'.
fun `Triggers login flow if not signed in and flow action`() = runTest {


coVerify {
sessionEventRepository.addOrUpdateEvent(withArg { it is EnrolmentCalloutEvent })
sessionEventRepository.addOrUpdateEvent(withArg { it is EnrolmentCalloutEventV3 })
Copy link

Copilot AI Jun 15, 2025

Choose a reason for hiding this comment

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

In the confirmation action test you assert that an EnrolmentCalloutEventV3 is emitted, but the implementation should only emit a ConfirmationCalloutEventV3. Please remove or correct this assertion.

Suggested change
sessionEventRepository.addOrUpdateEvent(withArg { it is EnrolmentCalloutEventV3 })

Copilot uses AI. Check for mistakes.
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.

Nice catch!

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@BurningAXE BurningAXE merged commit 012185a into main Jun 30, 2025
10 of 12 checks passed
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.

4 participants