Skip to content

feat(mt#528): Deprecate and remove sessiondb configuration block#162

Open
edobry wants to merge 5 commits intomainfrom
task-mt#528
Open

feat(mt#528): Deprecate and remove sessiondb configuration block#162
edobry wants to merge 5 commits intomainfrom
task-mt#528

Conversation

@edobry
Copy link
Owner

@edobry edobry commented Sep 8, 2025

Implement sessiondb to persistence configuration migration

This PR implements a comprehensive migration system to deprecate the legacy sessiondb: configuration in favor of the modern persistence: configuration, completing the configuration unification started in mt#407.

Summary

Provides a complete migration path from legacy sessiondb: configuration to the new unified persistence: configuration, with backward compatibility, clear deprecation warnings, and comprehensive tooling.

Changes

Added

  • Configuration migration utility (src/utils/config-migration.ts)

    • Converts existing sessiondb: blocks to persistence: blocks
    • Handles PostgreSQL and SQLite backend configurations
    • Validates migration equivalence and provides detailed feedback
  • minsky config migrate command (src/commands/config/migrate.ts)

    • Auto-detects configuration files (.minsky/config.yaml, etc.)
    • Provides dry-run mode for safe preview of changes
    • Creates automatic backups before migration
    • Includes validation to ensure migrated configuration works
  • Comprehensive deprecation timeline (docs/sessiondb-deprecation-timeline.md)

    • 3-phase deprecation plan (Soft → Hard → Complete removal)
    • Clear migration instructions and examples
    • Configuration mapping between old and new formats

Changed

  • Enhanced deprecation warnings in PersistenceService and CLI utilities

    • Clear warnings when sessiondb: configuration is detected
    • Actionable instructions directing users to migration command
    • Future-dated warnings about planned removal
  • Updated documentation to use persistence: configuration examples

    • docs/configuration-guide.md - Updated CLI examples and environment variables
    • docs/repository-configuration.md - Migrated all configuration examples

Configuration Mapping

Before (legacy)

  backend: postgres
  connectionString: "postgresql://user:pass@host/db"
    path: "/path/to/sessions.db"

After (modern)

  backend: postgres
    connectionString: "postgresql://user:pass@host/db"
    maxConnections: 10
    connectTimeout: 30000
    dbPath: "/path/to/sessions.db"

Testing

  • Full backward compatibility maintained - existing configurations continue to work
  • Migration utility handles all edge cases (nested configs, legacy fields, etc.)
  • Comprehensive validation ensures no data loss during migration
  • Both configuration formats tested and supported during transition

Usage

# Preview migration changes
minsky config migrate --dry-run

# Perform migration with backup (recommended)  
minsky config migrate

# Validate migrated configuration
minsky config migrate --validate

Breaking Changes

None - this is a pure addition with full backward compatibility. Legacy sessiondb: configurations continue to work with deprecation warnings.

Migration Timeline

  • Phase 1 (Current): Soft deprecation with warnings and migration tooling
  • Phase 2 (Next major release): Hard deprecation - configs fail to start
  • Phase 3 (Future): Complete removal of legacy support

Closes mt#528

- Create configuration migration utility to convert sessiondb: to persistence:
- Add config migrate command with dry-run, backup, and validation options
- Enhance deprecation warnings in persistence service and CLI utilities
- Update core documentation examples to use persistence: configuration
- Create comprehensive deprecation timeline with phased approach

Key features:
- Automatic configuration detection and migration
- PostgreSQL and SQLite backend support with proper schema mapping
- Backward compatibility during transition period
- Clear deprecation warnings with migration instructions
- Extensive validation and error handling

Closes: mt#528
- Consolidate multi-line log.warn calls for better readability
- Update documentation formatting
- Minor code style improvements
- Resolved conflict in formatting-utilities.ts by combining deprecation warnings with persistence display logic
- Includes migration utility, deprecation warnings, documentation updates, and configuration migration timeline
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