Skip to content

refactor(sdk): internalize legacy data migration - #146

Merged
txfei merged 2 commits into
mainfrom
refactor/internalize-sdk-migration
Oct 22, 2026
Merged

txfei merged 2 commits into
mainfrom
refactor/internalize-sdk-migration

Conversation

@txfei

@txfei txfei commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Scope

  • Hy Memory SDK Client: remove migration-only and duplicate raw read methods.
  • MemHub App migration: make stopped-writer startup migration the isolated privileged data-plane access exception.
  • MemHub HTTP raw history: keep the existing endpoint, backed by unified list_memories().

Changes

  • Remove public import_raw / async_import_raw.
  • Remove public import_memory_exact / async_import_memory_exact.
  • Remove public get_raw / async_get_raw and list_raw / async_list_raw.
  • Remove include_raw from get(); exact lookup returns the actual matched layer (raw_id -> l1_raw, fact ID -> fact layer).
  • Make explicit raw listing use list_memories(layers=[\"l1_raw\"]); add generic session/source list filters and include the original source in list/get results. Backend provenance is now retrieval_source instead of overwriting source with vdb/graph.
  • Move exact legacy writes and raw inventory access into hy_sdk_migration.py, which directly accesses SDK stores only while Runtime writers are stopped. Semantic migration writes both vector and graph projections.
  • Backfill a complete same-filesystem staging copy, preserving SDK-only records. Cutover atomically swaps SDK roots, rolls back on pre-commit failure, and recovers interrupted swaps on restart.
  • Refuse to start Runtime while startup migration is deferred or blocked.
  • Keep get_write_outcome() public because it is required by the normal durable write queue, not migration.
  • Keep private SDK access forbidden everywhere except existing Graph projection and this exact offline migration module.

Historical MemHub versions already wrote to the SDK and stored hy_memory_id mappings, so migration still validates existing records internally. This prevents duplicate raw/memory rows without creating public Client APIs.

Verification

  • Focused SDK contracts: 42 passed.
  • Core staging/migration/CLI/architecture target: 50 passed.
  • Earlier full affected Core target: 230 passed.
  • Desktop suite: 473 passed; TypeScript typecheck passed.
  • SDK and Core Ruff checks passed.
  • Core test index remains current (322 files).

alvinfei and others added 2 commits October 22, 2026 20:31
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@txfei
txfei merged commit 26c33ee into main Oct 22, 2026
7 checks passed
@txfei txfei mentioned this pull request Oct 22, 2026
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