Skip to content

Show CKB data-migration progress and logs in the UI (currently only a static "migrating..." indicator) #3502

Description

@eval-exec

Feature Request

Is your feature request related to a problem?

When the bundled CKB node requires a data migration on startup (e.g. after upgrading to a ckb release with a new DB schema), Neuron shows a static migrating... indicator in the top-right sync-status area for the entire duration. The confirmation dialog estimates 20 ~ 60 min, and during that whole window the user gets no feedback at all — no percentage, no current step, no log output. It is impossible to tell whether the migration is progressing or stuck, which is likely to generate "is my wallet broken?" support reports.

Current behavior

  • migrateCkbData() spawns ckb migrate -C <nodeDataPath> --force with stdio: ['ignore', 'pipe', 'pipe'], but stderr is only written to electron-log and the last chunk is kept as a failure reason. Nothing is forwarded to the renderer:
    • packages/neuron-wallet/src/services/ckb-runner.ts (migrateCkbData, ~L195–218)
  • Migration state has only 4 discrete states — need-migrate | migrating | finish | failed — with no progress payload:
    • packages/neuron-wallet/src/models/subjects/migrate-subject.ts
    • forwarded over the migrate channel in packages/neuron-wallet/src/controllers/app/subscribe.ts
  • The UI replaces the sync status with the static network-status.migrating text:
    • packages/neuron-ui/src/components/SyncStatus/index.tsx (~L119)

What CKB exposes during migration

  • Migration progress bars are rendered by indicatif to the child process's stderr (nervosnetwork/ckb, db-migration/src/lib.rs, ProgressDrawTarget::stderr()), including processed/total counts
  • Info-level migration log lines (e.g. start to run migrate in background: ...) go to both the standard streams and the rotating log file under the node data dir (ckb.toml defaults: log_to_file = true, log_to_stdout = true, filter = info)
  • During a foreground migration no RPC is available, so parsing the child process output is the only viable channel

Proposed solution

Since Neuron already pipes both streams of the ckb migrate child process, the data is already in our hands — it just stops at the main process:

  1. Parse the indicatif progress output (or, as a minimal first step, just the info-level migration log lines) from stderr in migrateCkbData(). Note the progress bars redraw the same line with ANSI control sequences, so the parser needs to strip those before extracting processed/total.
  2. Extend MigrateSubject messages with a progress payload (e.g. { processed, total, percent } and/or the latest log line) and forward it over the existing migrate IPC channel.
  3. In the UI, render the percentage in place of the static migrating... text (e.g. Migrating 42%), optionally with a tooltip / expandable detail view showing the live migration log tail — the same pattern as the existing sync-status tooltip, which already shows cacheTip / bestKnown block numbers and estimated time left (packages/neuron-ui/src/components/SyncStatus/index.tsx, SyncDetail).

Additional context

  • The current flow was built for the v0.35.1 bundled-node data migration; the dialog copy (messages.rebuild-sync) still says "estimated 20 ~ 60min"
  • Related history: feat: Optimize data migration #3321 (feat: Optimize data migration), fix: Show the migrate ckb data dialog #2869 (fix: Show the migrate ckb data dialog)
  • CKB also supports running some migrations in the background (run_in_background); if that path is ever used, node RPC stays up and progress could be surfaced differently — worth keeping the abstraction in mind

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions