Skip to content

feat(migration): Add standalone BitFun data migration - #2879

Merged
wsp1911 merged 7 commits into
GCWing:mainfrom
wsp1911:legacy-migration-main-integration
Sep 7, 2026
Merged

feat(migration): Add standalone BitFun data migration#2879
wsp1911 merged 7 commits into
GCWing:mainfrom
wsp1911:legacy-migration-main-integration

Conversation

@wsp1911

@wsp1911 wsp1911 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add a standalone Data Migrator for importing legacy BitFun data into OpenBitFun. Desktop first-launch onboarding, migration settings, and the Installer can launch it; the migrator scans the selected data, confirms the scope, imports it offline, and reports the result before returning to Desktop.

  • Add source discovery, migration plans, locking, SQLite snapshots, staging, rollback, and journal recovery.
  • Import settings and credentials, user extensions, workspace and assistant sessions, memory, and remote connection records through their persistence owners.
  • Preserve user-owned configuration and extension content, rehome assistant workspace metadata, and omit rebuildable prompt caches and non-core runtime data.
  • Integrate packaging, localized migration controls, report details, diagnostics, and automatic incremental Migrator builds for Desktop development.

Type and Areas

Type: Feature, bug fix, UI/UX, docs, and tests.

Areas: Rust contracts and persistence services, core migration adapters, Desktop/Tauri, standalone Data Migrator, Web UI settings, Installer, product definitions, and build scripts.

Motivation / Impact

The product rename uses new data locations and some renamed persisted fields. Users need to bring their existing BitFun settings and conversation history forward without manually reconstructing their environment.

Migration keeps the legacy source unchanged and reports target conflicts. Built-in MiniApp code comes from the new installation while its saved user data can be imported. Orphaned parent-session references and expected runtime-file exclusions do not block successful imports. Assistant sessions receive current workspace paths without rewriting historical tool calls.

Development startup prepares the Migrator automatically and handles Windows Job restrictions without requiring a manually configured environment variable.

Verification

Passed during implementation, before the final rebase:

  • cargo test -p openbitfun-core --no-default-features --features legacy-migration --lib legacy_migration:: — 34 tests passed.
  • cargo test -p openbitfun-legacy-migration — 20 tests passed.
  • cargo test -p openbitfun-data-migrator — 6 tests passed.
  • cargo check --manifest-path OpenBitFun-Installer/src-tauri/Cargo.toml — passed.
  • pnpm run check:web and pnpm run i18n:audit — passed.
  • node --test scripts/data-migrator-tauri-build.test.mjs — 5 tests passed.
  • After report and startup refinements, focused workspace-session, extension, engine, and Windows Job retry tests passed; node --check scripts/dev.cjs passed.

After rebasing onto upstream main:

  • node scripts/generate-interactive-capabilities.mjs --check --quiet — passed.
  • git diff 1185658cc..HEAD --check — passed.
  • Conflict resolution preserves upstream lightweight session activity reads and uses the shared stored-turn type; generated registry digests were regenerated.

Manual evidence and limitations:

  • The author tested Windows Dev and Release migration with local legacy data and reported no blocking issue in the Release test. Report presentation and later Dev startup refinements have automated checks but no subsequent UI interaction validation.
  • Desktop migration API tests compiled, but the test executable could not start on the local machine (0xc0000139 / STATUS_ENTRYPOINT_NOT_FOUND); these are not recorded as passing tests.
  • Full runtime suites and packaging were not rerun after the final rebase. Cross-platform installation and the four remote scenarios were not exercised end to end. A focused test covers POSIX remote workspace path normalization.

Reviewer Notes

  • Migration execution is local-only and runs in a separate migration-only delivery profile. Remote Control, Peer Device Mode, and Detached Dispatch cannot initiate migration through these entry points.
  • The source data is never automatically deleted. Existing target conflicts follow domain-specific preservation or remapping rules, with reports and recovery records retained.
  • Review the six commits in order: inventory, engine, import adapters, product integration, import/startup corrections, and report/development workflow refinements.
  • Windows launch resolves fixed-name sibling binaries and validates the file layout; it does not require Authenticode signing of locally built artifacts.
  • Implementation was AI-assisted. Automated and manual verification boundaries are recorded above.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

Establish the persistence inventory and source format used by the
BitFun-to-OpenBitFun importer before implementing data transfers.

- Map legacy settings, credentials, extensions, sessions, memories,
  and remote connection data to their persistence owners.
- Document migration boundaries, implementation stages, and the
  distinction between static inventory and release validation.
- Add a supported-source matrix and versioned fixtures covering
  durable records alongside runtime files that must be excluded.

Provide a common reference for import adapters and recovery checks
without treating the inventory as proof of real-device migration.
Introduce a shared offline importer so product hosts can discover
legacy data and coordinate migration without implementing storage
operations in their UI or command handlers.

- Define migration selections, plans, findings, progress, and reports.
- Discover supported sources and resolve isolated source and target
  roots while keeping legacy data read-only.
- Add locking, staging, journal recovery, cancellation, and rollback
  for domain imports that have not completed validation.
- Snapshot committed SQLite data, including WAL contents, through
  SQLite backup operations instead of copying live database files.
- Register the service crate and dependency boundaries, and cover
  recovery, source preservation, and lock contention with tests.

Keep data conversion in owner adapters while the engine coordinates
storage operations and records recoverable migration state.
Connect the offline engine to the persistence owners of legacy user
content so each domain can convert and validate its own records.

- Import application settings and credentials with target conflict
  handling and product-specific configuration conversion.
- Add import adapters for user skills, agents, and MiniApps.
- Migrate workspace and session records together with coordination
  data, and repair the historical coordination schema v2 layout.
- Expose offline persistence helpers for session and workspace data
  without starting the normal Agent Runtime.
- Add memory, SSH, and Remote Connect import adapters with explicit
  handling of credentials and existing target records.
- Extend fixtures and focused contracts to exercise owner imports,
  persisted metadata, and recovery after interrupted migration.

Keep persistence behavior with its existing owners and limit the
migration delivery profile to the dependencies it actually needs.
Expose migration through a standalone application that can operate
while Desktop is shut down and return users to the product afterward.

- Add the migration-only delivery profile, independent WebView
  identity, typed commands, and scan, confirm, and execute screens.
- Persist handoff requests with nonce, expiry, product, channel, and
  capability checks; accept only a run ID on the command line.
- Resolve sibling executables from product binary names and inspect
  active writers before starting offline migration.
- Add first-launch onboarding, settings status and actions, startup
  notifications, and an Installer entry point.
- Persist onboarding decisions and report references across restarts.
- Build and package the Migrator sidecar with Desktop and Installer,
  including branded binary projections and packaging checks.
- Register local migration operations in the product operation
  registry and provide localized user-facing controls.

Keep migration execution in the standalone host while Desktop and
Installer prepare requests and present migration state.
Migration testing exposed lost configuration fields, stale assistant
workspace context, and launch failures that prevented normal imports.
Preserve core user data and correct the startup and reporting paths.

- Preserve agent profiles, default models, and unknown extension
  content instead of discarding data through narrow conversions.
- Import assistant workspaces and rehome session workspace metadata
  while leaving historical tool calls and turn content unchanged.
- Omit rebuildable prompt caches and non-core data from migration.
- Keep orphaned session relationships from blocking an entire import
  and accept empty legacy SSH workspace records.
- Support long Windows storage paths and retain sanitized failure
  details without exposing user content or credentials.
- Add diagnostic export and recovery coverage, and distinguish
  staged counts from verified results in the migration report.
- Gate onboarding actions until bootstrap is ready and correct
  completion behavior for development and release handoffs.
- Allow the existing opt-in development retry for Windows Job
  breakaway failures and report launch errors without blocking Desktop.
- Remove the Authenticode prerequisite across launch and restart
  paths while retaining fixed-name sibling and file-layout checks.
- Restrict import helper visibility and keep memory test helpers
  out of production builds.

Align the migration inventory and implementation notes with the
reduced scope and the behavior established during migration testing.
@wsp1911
wsp1911 force-pushed the legacy-migration-main-integration branch 4 times, most recently from 15e05af to 5f69981 Compare September 7, 2026 17:38
Successful migrations showed warnings for expected exclusions, while
View Report only refreshed an already displayed summary. Development
startup also required a manually built Migrator and an environment flag.

- Open report details with per-domain results and grouped explanations.
- Treat excluded session paths and orphaned parent relationships as
  informational, and count warnings by their actual severity.
- Exclude normal built-in MiniApp storage imports from conflict counts
  while preserving existing target-conflict handling.
- Simplify migration instructions in English and both Chinese locales.
- Automatically retry denied Windows Job breakaway in Debug builds
  without an environment flag; retain Release launch behavior.
- Incrementally build Data Migrator before Desktop dev and preview
  startup, and stop with an error if preparation fails.

Validation: focused migration tests, Web and locale checks, Migrator
script checks, and dev script syntax checks passed. Application startup
and UI interaction were not exercised.
@wsp1911
wsp1911 force-pushed the legacy-migration-main-integration branch from 5f69981 to d6fa7a7 Compare September 7, 2026 18:07
Windows CI timed out waiting for descendant PIDs in both process-tree
cleanup tests, although the original fixtures passed locally.

- Replace PowerShell and ping fixtures with explicit parent and leaf
  roles in the existing test executable.
- Publish readiness from the running leaf itself and keep subprocesses
  hidden through the shared process command helper.
- Preserve parent-exit coverage, cleanup assertions, and timeout bounds
  without changing production process-tree behavior.

This removes external shell startup and launch dependencies from the
fixture without claiming a confirmed cause for the original CI timeout.

Validation: process-tree tests passed ten consecutive Windows runs;
all five process-runtime integration contracts also passed.
@wsp1911
wsp1911 merged commit 0582b0b into GCWing:main Sep 7, 2026
14 checks passed
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