Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Migration concurrency overhaul #628

Merged
merged 34 commits into from
Jan 12, 2023
Merged

Conversation

ualch9
Copy link
Member

@ualch9 ualch9 commented Jan 7, 2023

A continuation of #622...

  • New DataMigration view, with a Report view for looking at the results of the migration.
Migration View Migration Report View Show Report
Migration View Migration Report View Migration Report (show report) View

Screenshot 2023-01-06 at 8 26 18 PM

  • If debugMode is on, Migrate Data in settings will always appear.
    • Drag-and-drop a userdefault plist file on the Continue button in the DataMigrationView to perform a test migration.
  • Add OBAKitCore.UnstructuredError for arbitrary string errors.
    • Some error cases don't necessarily warrant an entire error case. Surfacing some sort of error text to the UI is preferred over an unexplained nil or print() and allows us to do better customer support (i.e. from a user screenshot).

  • Rewrote DataMigrator in Swift Concurrency.
  • Replace the DataMigrationBulletin with DataMigrationView, and DataMigrationReportView. It is currently not hooked up to the onboarding sequence.
        // High level implementation details of migration procedure
        //    ┌───────────┐
        //    │   START   │
        //    └─────┬─────┘
        //          ▼
        // ┌─────────────────────────────┐         ╔════════════════════════════╗
        // │ extractor.hasDataToMigrate? │──<NO>──▶︎║ throw .noDataToMigrate     ║
        // └────────┬────────────────────┘         ╚════════════════════════════╝
        //          │ <YES>
        //          ▼
        // ┌───────────────────┐              ╭─────────────────────────────────╮
        // │ Migrate User ID   │┄┄┄┄┄┄┄┄┄┄┄┄┄▶︎│ delegate.migrate(userID:)       │
        // └────────┬──────────┘              ╰─────────────────────────────────╯
        //          ▼
        // ┌───────────────────┐              ╭─────────────────────────────────╮
        // │ Migrate Region ID │┄┄┄┄┄┄┄┄┄┄┄┄┄▶︎│ delegate.migrate(regionID:)     │
        // └────────┬──────────┘              ╰─────────────────────────────────╯
        //          ▼
        // ┌───────────────────────────────────────────┐
        // │ Decode classic-OBA object, then           │
        // | get new-OBA object via APIService:        │
        // │   ╭───────────────────╮  ╮                │
        // │   │ Recent Stops      │  │                │
        // │   ╰───────────────────╯  │                │
        // │   ╭───────────────────╮  │ await until    │
        // │   │ Loose Bookmarks   │  │ all finished   │
        // │   ╰───────────────────╯  │     │          │
        // │   ╭───────────────────╮  │     │          │
        // │   │ Grouped Bookmarks │  │     │          │
        // │   ╰───────────────────╯  ╯     │          │
        // │        ┌───────────────────────┘          │
        // └────────┼──────────────────────────────────┘
        //          │
        //          ▼
        // ┌───────────────────────────────┐
        // │                               │                ╔═══════════════════╗
        // │ Check for any critical errors │ ─<has error>─▶︎ ║ rethrow error     ║
        // │                               │                ╚═══════════════════╝
        // └────────┬──────────────────────┘
        //          │ <no error>
        //          ▼
        // ┌───────────────────────────┐      ╭───────────────────────────────────╮
        // │ Migrate Recent Stops      │┄┄┄┄┄▶︎│ delegate.migrate(recentStop:)     │
        // └────────┬──────────────────┘      ╰───────────────────────────────────╯
        //          ▼
        // ┌───────────────────────────┐      ╭───────────────────────────────────╮
        // │ Migrate Loose Bookmarks   │┄┄┄┄┄▶︎│ delegate.migrate(bookmark:group:) │
        // └────────┬──────────────────┘      ╰───────────────────────────────────╯
        //          ▼
        // ┌───────────────────────────┐      ╭───────────────────────────────────╮
        // │ Migrate Grouped Bookmarks │┄┄┄┄┄▶︎│ delegate.migrate(bookmark:group:) │
        // └────────┬──────────────────┘      ╰───────────────────────────────────╯
        //          ▼
        //    ╔═══════════════╗
        //    ║ return report ║
        //    ╚═══════════════╝

Screen.Recording.2023-01-06.at.1.14.41.PM.mov

@ualch9 ualch9 added this to the 23.2 milestone Jan 7, 2023
@ualch9 ualch9 requested a review from aaronbrethorst January 7, 2023 04:50
@ualch9 ualch9 self-assigned this Jan 7, 2023
@aaronbrethorst
Copy link
Member

@ualch9 this looks awesome, great work! I'll give it a proper review tomorrow.

@ualch9 ualch9 linked an issue Jan 7, 2023 that may be closed by this pull request
Copy link
Member

@aaronbrethorst aaronbrethorst left a comment

Choose a reason for hiding this comment

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

looks great! I noticed a couple strings that look like they need to be wrapped in OBALoc but otherwise I think it's good to go.

@aaronbrethorst
Copy link
Member

@ualch9 looks good! I think this can be merged if you're ready to do so.

@ualch9 ualch9 merged commit 4d21ca6 into asyncify Jan 12, 2023
@ualch9 ualch9 deleted the ualch9/asyncify/data-migration branch January 12, 2023 01:33
@ualch9 ualch9 mentioned this pull request Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update NSKeyedUnarchiver usage in MigrationDataExtractor
2 participants