MOBILE-230: Fix sync operation error delivery and date-migration hour cycle#728
Merged
Conversation
Contributor
|
Collaborator
|
Обновляй ветку через rebase, чтобы история линейная получалась |
justSmK
requested changes
Jun 26, 2026
added 4 commits
June 29, 2026 14:05
Previously, passing an invalid JSON string to executeSyncOperation(json:completion:) caused the operation to be silently dropped on eventQueue without ever invoking the completion handler. This violated the public contract (completion always arrives on the main thread, either as .success or .failure). Fix: deliver .failure(.internalError(.parsing)) on the main thread when JSON validation fails, matching the delivery pattern used by MBEventRepository.send<T> for all other error paths. Test: syncInvalidJSONDeliversFailureOnMain asserts the completion is called as .failure on the main thread, and will fail (timeout ~10s) rather than hang if the regression recurs.
…c overloads All three executeSyncOperation overloads now call completion(.failure(.validationError(...))) on the main thread when an invalid operation name is passed, matching the DoD requirement. The invalid-JSON branch in enqueueSyncEvent is unified through the same failSyncOperation helper, so both client-side validation paths produce a consistent .validationError with a ValidationMessage describing the failure location. Added test: syncInvalidNameDeliversFailureOnMain pins the regression for the name path.
Locale.current encodes the device 12h/24h setting as an @Hours= keyword, so appending a second hours= produced a duplicate that ICU resolved to the first occurrence — defeating the override and leaving every legacy formatter on the device's own hour cycle. Strip any pre-existing hours/hc keyword before forcing the cycle so values written under the opposite cycle parse.
Parameterize failSyncOperation location so invalid JSON reports operationBody instead of operationSystemName, fix the misleading .parsing doc comment, and assert the error type and location in tests.
714d7c0 to
9e214fa
Compare
justSmK
approved these changes
Jun 29, 2026
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.
Description
Three related MOBILE-230 fixes around sync operations and the date-format migration.
Sync operations (
Mindbox.swift)executeSyncOperationno longer drops the completion handler when the operation body is invalid JSON — the caller now always gets a result..validationErroracross all sync overloads, instead of failing silently.Date-format migration (
DateFormatMigration.swift)Locale.currentas an@hours=keyword, so appending a secondhours=produced a duplicate (…@hours=h12;hours=h23) that ICU resolves to the first occurrence — silently defeating the override and leaving every candidate on the device's own hour cycle.hours/hckeyword is stripped before forcing the cycle (other keywords like language/region/calendar preserved), so legacy values written under the opposite hour cycle parse and migrate correctly.Type of Change
Test Procedure
MindboxOperationsTestsfor the sync-operation error paths.DateFormatMigrationTests(11 tests) — including the previously-failingrunConvertsLegacyInstallationDateWrittenIn24hFormat()— now pass.