Skip to content

[MS-1244] Adding proper migration to updated ENROLMENT_V4 event#1463

Merged
alexandr-simprints merged 8 commits into
release/2025.4.0from
MS-1244-version-hops-incorrect-event-structure-after-sid-updates
Nov 12, 2025
Merged

[MS-1244] Adding proper migration to updated ENROLMENT_V4 event#1463
alexandr-simprints merged 8 commits into
release/2025.4.0from
MS-1244-version-hops-incorrect-event-structure-after-sid-updates

Conversation

@alexandr-simprints
Copy link
Copy Markdown
Contributor

JIRA ticket
Will be released in: 2025.4.0

Root cause analysis (for bugfixes only)

First known affected version: 2025.4.0

When doing version hops from 2024.1.5 to 2025.4.0 without BFSID data sync, the local events are stored with incorrect structure in the final 2025.4.0 SID version. This becomes visible when trying to sync in 2025.4.0, as we begin receiving CORRUPTED_EVENTS messages on the sid-dump-files Slack channel.

The issue was that UpSync worker tried to deserialize old events in the DB to the latest EnrolmentEventV4 class that contains non-null externalCredentialIds array field. This led to JsonParseException since externalCredentialIds filed was missing in old events in the database.

Notable changes

  • Increasing event DB version from 16 to 17
  • Adding migration that adds "externalCredentialIds":[], JSON field to all existing ENROLMENT_V4 events (if doesn't contain already)

Testing guidance

  • Install 2025.3.1
  • Make an enrolment, do not sync
  • Install 2025.4.0
  • Sync from dashboard
  • Verify that sid-dump-files channel on Slack contains no new messages

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)

… but missed in migrations. Adding migrations to introduce empty array for all old events
… but missed in migrations. Adding migration tests
…ScopesForType so that we have a Crashlytics non-fatal recorded in case any event fails to be parsed
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 adds a database migration (version 16 to 17) to fix a bug where old ENROLMENT_V4 events stored before 2025.4.0 are missing the required externalCredentialIds field, causing JSON parsing exceptions during sync operations.

Key Changes:

  • Database version bumped from 16 to 17
  • New migration adds empty externalCredentialIds array to existing ENROLMENT_V4 events that lack this field
  • Changed log level from info to error for JSON unmarshalling failures in sync task

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
EventMigration16to17.kt Implements the migration logic to add externalCredentialIds field to ENROLMENT_V4 events
EventMigration16to17Test.kt Comprehensive test coverage for the new migration
EventRoomDatabase.kt Updates database version to 17 and registers the new migration
EventMigrationTest.kt Updates test to validate migration to version 17
EventUpSyncTask.kt Changes log level from info to error for JSON parsing failures
17.json Schema file for database version 17

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ject class to deserialize the even string, and add missing 'externalCredentialIds' field to the payload
Copy link
Copy Markdown
Contributor

@luhmirin-s luhmirin-s left a comment

Choose a reason for hiding this comment

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

Consider squashing the branch before merging :)

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@BurningAXE BurningAXE left a comment

Choose a reason for hiding this comment

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

Copilot is also right about the documentation :)

@sonarqubecloud
Copy link
Copy Markdown

@alexandr-simprints alexandr-simprints merged commit 65cbd72 into release/2025.4.0 Nov 12, 2025
13 checks passed
@alexandr-simprints alexandr-simprints deleted the MS-1244-version-hops-incorrect-event-structure-after-sid-updates branch November 12, 2025 11:04
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