feat(migration): add config, state models, and lifecycle infrastructure#1823
feat(migration): add config, state models, and lifecycle infrastructure#1823A0nameless0man wants to merge 3 commits intovolcengine:mainfrom
Conversation
- Add MigrationPhase enum, MigrationState dataclass with serialization - MigrationStateManager (atomic JSON + FileLock persistence) - MigrationStateFile for permanent migration state tracking - EmbeddingConfig.get_target_embedder() for migration target resolution - OpenVikingConfig.embeddings field with @model_validator - Auto-create state file with embeddings["default"] when missing - Dimension mismatch hard-blocks startup (C-9) - 23 tests: state serialization, config migration, backward compat
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
- Use ActiveSide enum for MigrationState.active_side type safety - Fix race condition: hold FileLock for entire read-modify-write cycle in update_current_active and append_history - Use atomic MigrationStateFile.create_initial() instead of non-atomic write_text for initial state file creation - Add return type annotation to get_target_embedder
c4faba9 to
be14b27
Compare
Description
Adds the foundation infrastructure for the blue-green embedding model migration framework: state models, persistence layer, and multi-embedder configuration support. Phase 0 of the migration design.
Related Issue
Type of Change
Changes Made
openviking/storage/migration/__init__.py— Module public API exportsopenviking/storage/migration/state.py— MigrationPhase enum, ActiveSide enum, MigrationState dataclass, MigrationStateManager (atomic FileLock persistence), MigrationStateFile (permanent migration history)openviking_cli/utils/config/open_viking_config.py—embeddings: Dict[str, EmbeddingConfig]field with@model_validatorfor active config resolution,get_target_embedder(), and dimension mismatch hard-block (C-9)openviking_cli/utils/config/embedding_config.py— Removed staleget_target_embedder()tests/migration/conftest.py— Test isolation fixturestests/migration/test_state.py— Serialization, persistence, concurrency, and state file teststests/migration/test_embedding_config_migration.py— Multi-embedder config parsing, active config resolution, backward compatibility teststests/migration/test_init.py— Module import testsTesting
Checklist
Additional Notes
embeddingsis empty, behavior is fully backward compatible