Handle commit result when migrating to Harmony#8311
Merged
CrisBarreiro merged 1 commit intodevelopfrom Apr 17, 2026
Merged
Conversation
CDRussell
approved these changes
Apr 17, 2026
| editor.putStringSet(key, value.filterIsInstance<String>().toSet()) | ||
| } else { | ||
| logcat(WARN) { "Could not migrate $key from $name preferences" } | ||
| return onMigrationFailure(Exception("Could not migrate $key from $name preferences"), name) |
Member
There was a problem hiding this comment.
@CrisBarreiro checking if it's a deliberate change: previously, encountering a Set of non-Strings (or any other unsupported type) was logged as a warning and migration continued; now it aborts the whole migration and returns Result.failure.
I'm not sure under what circumstances we could end up there (if ever?), but if it happened, would it end up re-attempting the migration over and over?
Collaborator
Author
There was a problem hiding this comment.
I don't think we'll ever encounter it, at least not now, but I think re-trying the migration over and over and firing a pixel is better than just silently failing. The first case is actionable, the second one is not
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Task/Issue URL: https://app.asana.com/1/137249556945/project/1212227266948491/task/1214127404690655?focus=true
Description
Steps to test this PR
Feature 1
UI changes
Note
Medium Risk
Touches encrypted SharedPreferences migration and changes error handling/commit semantics; a failure could leave preferences partially migrated or block access to migrated prefs, but behavior is gated behind migration paths with pixel logging.
Overview
Improves encrypted SharedPreferences migration to Harmony by checking the
commit()result and surfacing migration failures instead of blindly assuming writes succeeded.migrateContentsToHarmonynow returns aResultand uses a singleSharedPreferences.Editorto batch writes, markingMIGRATED_TO_HARMONYonly after a successful commit; failures (including unsupported value types) fire the existing migration pixel via a newonMigrationFailurehelper and cause the migration callers to returnnull.Reviewed by Cursor Bugbot for commit 4e51066. Bugbot is set up for automated code reviews on this repo. Configure here.