Skip to content

feat(onboarding): add Docker environment migration - #368

Draft
AprilNEA wants to merge 1 commit into
masterfrom
feat/onboarding-migration
Draft

feat(onboarding): add Docker environment migration#368
AprilNEA wants to merge 1 commit into
masterfrom
feat/onboarding-migration

Conversation

@AprilNEA

@AprilNEA AprilNEA commented Aug 9, 2026

Copy link
Copy Markdown
Member

Summary

  • add an optional Docker Desktop / OrbStack migration step to onboarding
  • expose the same flow from Help for existing users
  • preview supported resources before confirmation and block close / quit while migration is executing
  • distinguish no migration source from Docker detection failures

Safety

  • dry-run first, then re-prepare immediately before execution
  • require explicit confirmation for replacements and source container stops
  • retry only transient transport failures with the same plan ID
  • report daemon restart and permanent RPC failures instead of reconnecting forever

Dependency

Draft: do not merge until arcboxlabs/arcbox#575 is merged, a daemon release containing it is published, and arcbox.version is bumped here. The current v0.6.3 daemon does not support safe stream reattachment.

Validation

  • make generate-xcodeproj
  • make lint
  • make test

@greptile-apps

greptile-apps Bot commented Aug 9, 2026

Copy link
Copy Markdown

Greptile Summary

Adds an optional Docker Desktop and OrbStack migration workflow to onboarding and the Help menu, backed by source detection and daemon migration RPCs.

  • Detects supported Docker contexts and previews migratable resources.
  • Re-prepares and executes migration plans with streamed progress and transient reconnection.
  • Adds migration-aware window and termination handling plus focused model and context-selection tests.

Confidence Score: 3/5

This PR should not merge until executable plans preserve the reviewed source-stop confirmation and migration activity is tracked across all simultaneously active windows.

A re-prepared plan can introduce undisclosed source-container stops, and one migration window finishing can prematurely disable close and shutdown protection for another active migration.

Files Needing Attention: ArcBox/Views/Onboarding/OnboardingMigrationModel.swift, ArcBox/App/ApplicationCoordinator.swift

Important Files Changed

Filename Overview
ArcBox/Views/Onboarding/OnboardingMigrationModel.swift Implements preview, plan validation, execution, and reconnection, but omits source-stop blockers from executable-plan matching.
ArcBox/App/ApplicationCoordinator.swift Adds migration windows and shutdown protection, but a single shared Boolean cannot safely represent concurrent migration-capable windows.
ArcBox/Integrations/Docker/DockerContextManager.swift Adds Docker Desktop and OrbStack source discovery with ambiguity and CLI-failure handling.
ArcBox/Views/Onboarding/OnboardingView.swift Integrates migration preview and execution states into first-run and replay onboarding.
Packages/ArcBoxClient/Sources/ArcBoxClient/ArcBoxClient.swift Exposes the generated daemon migration service through the existing client wrapper.
ArcBoxTests/DockerContextManagerTests.swift Covers previous-context selection, malformed output, stale contexts, and ambiguous sources.
ArcBoxTests/OnboardingMigrationModelTests.swift Verifies reconnection-code classification but does not cover executable-plan drift.

Sequence Diagram

sequenceDiagram
  participant User
  participant View as OnboardingView
  participant Model as MigrationModel
  participant Docker as Docker CLI
  participant Daemon as ArcBox daemon
  User->>View: Open migration assistant
  View->>Model: loadPreview()
  Model->>Docker: Detect Docker context/socket
  Docker-->>Model: Migration source
  Model->>Daemon: PrepareMigration(dryRun)
  Daemon-->>Model: Preview and blockers
  Model-->>View: Show resources and confirmations
  User->>Model: Migrate now
  Model->>Daemon: PrepareMigration(executable)
  Daemon-->>Model: Plan ID
  Model->>Daemon: RunMigration(plan ID)
  Daemon-->>Model: Stream progress and terminal event
  Model-->>View: Completed or failed
Loading

Reviews (1): Last reviewed commit: "feat(onboarding): add Docker environment..." | Re-trigger Greptile

Comment on lines +66 to +67
&& response.replacementsRequired == replacementsRequired
&& Set(response.warnings) == Set(warnings)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Executable plan omits stop blockers

When the source gains a running container that uses a migrated volume after preview, matches(_:) accepts the re-prepared plan without comparing its blockers, causing ArcBox to stop source containers without the disclosure and confirmation shown for that action.

Suggested change
&& response.replacementsRequired == replacementsRequired
&& Set(response.warnings) == Set(warnings)
&& response.replacementsRequired == replacementsRequired
&& (!response.plan.blockers.isEmpty) == stopsSourceContainers
&& Set(response.warnings) == Set(warnings)

Comment on lines +424 to +428
private func migrationActivityChanged(_ isExecuting: Bool) {
isMigrationExecuting = isExecuting
guard !isExecuting else { return }
migrationCompletionWaiter?.resume()
migrationCompletionWaiter = nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Shared migration state clears early

If migrations execute concurrently in Getting Started and the dedicated assistant, the first model to finish sets the shared Boolean to false and resumes shutdown, allowing the other window to close or the client and daemon to shut down while its migration remains active.

Knowledge Base Used: App Startup Flow

Comment on lines +1 to +4
import ArcBoxClient
import Foundation
import GRPCCore
import Observation

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Imports violate repository ordering

The new file places ArcBoxClient before the Foundation system-framework import, violating the repository's required import organization and potentially failing its import-order lint check.

Suggested change
import ArcBoxClient
import Foundation
import GRPCCore
import Observation
import Foundation
import Observation
import ArcBoxClient
import GRPCCore

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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.

1 participant