After looking deeper into removal og updating synced metadata entries as part of migration (link), I realized we shouldn't remove this code and there is one problem with SyncStoreVersionHandler.
With the current implementation, there is a slight chance of inconsistency in synced metadata entry. In the past, the handler was always setting the value to the storeVersion in the codebase, regardless of whether migration succeeded or not, or if the app was killed in the middle of migrations.
With this fix, we first run migrations, each migration bumps the state version in the database to its version, and after this handler is executed.
The chance of the issue I described is very low because the handler is gated on ReduxPersistGate on native, and in case of migration failure, we call handleReduxMigrationFailure, but worth doing this in a safe way. The code around might change in the future, and this gives us assurance that we have the correct storeVersion in the backup database.
I am also wondering if code in /native_rust_library/build.rs has the same issue, but not sure what the impact of storeVersion in Rust
Depends on D14807