Skip to content

refactor: extract shared migration operations - #2

Merged
TheViniAlmeida merged 1 commit into
nextfrom
refactor/shared-operations
Oct 10, 2026
Merged

TheViniAlmeida merged 1 commit into
nextfrom
refactor/shared-operations

Conversation

@TheViniAlmeida

Copy link
Copy Markdown
Owner

Migration orchestration currently lives inside the CLI, preventing the terminal UI and local web app from using the same source-selection, conversion and installation rules. This extracts a typed run_operation API while the CLI keeps parsing, structural inspect/catalog commands, JSON output and exit codes.

  • Add content-free request/result/progress contracts and observational callbacks that cannot turn a successful native import into a duplicate retry.
  • Validate catalog-selected OpenCode/Kilo directory and database identity before export; reject noncanonical stores, same-ID siblings and unsafe hardlinks, while preserving safe directory aliases.
  • Snapshot environment per operation and pass it to native subprocesses, default homes/state paths, catalog-selected stores, OMP buckets and Mastra project probes, without mutating process environment.
  • Report confirmed native imports followed by local verification/finalization failure as NativeImportPartialError/needs_reconcile, including Hermes confirmation before parsing.
  • Preserve supported CLI routes, defaults, collision checks and dry-run behavior. Two documented corrections: native Hermes free-form diagnostics are omitted for privacy; noncanonical MASTRA_DB_PATH filenames fail before accidentally opening a sibling database. Internal adapter scratch directories retain their existing private process policy.

Validation: Ruff lint/format and diff checks passed; complete suite 1,689 passed, 55 skipped. The run includes real OpenCode 2.0.22 tests. Installed wheel/sdist and both entrypoints passed; an additional real 2.0.22 core smoke exercised import, catalog-selected cross-store transfer and dry run under two isolated HOME/XDG profiles, preserving message text/roles and leaving source/process environment unchanged. Independent review approved with 105 focused tests and an additional 83-test store-guard review, zero skips. The test counts overlap and are not summed.

Unavailable historical exact clients/opt-in real-store gates account for skips. Stock 2.0.23, native Windows and the complete historical native-client matrix were not executed locally. No real sessions, supplier credits, new dependencies, persisted profiles, TUI or global installation changes are included. This is the F2A foundation for the subsequent profiles/TUI milestones.

@TheViniAlmeida
TheViniAlmeida merged commit 09ef484 into next Oct 10, 2026
23 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