Skip to content

[DI Phase 6] Cleanup, registry simplification, and v0.4 breaking changes #121

@bashandbone

Description

@bashandbone

Phase 6: Cleanup, Deprecation & Breaking Changes

Parent Epic: #116
Depends On: #120 (Advanced Features)
Target: v0.3 Late / v0.4 Prep
Risk Level: Low

Finalize migration, deprecate old patterns, simplify/eliminate registry, and prepare for v0.4 breaking changes in the clean monorepo structure.

Strategic Context

After complete transformation:

  • ✅ Phases 1-2: DI system working, dependencies broken
  • ✅ Phase 3: Clean monorepo with 9 packages
  • ✅ Phases 4-5: pydantic-ai + advanced features
  • ✅ Now: Cleanup and prepare for v0.4

Goals

  • Deprecate old pattern with warnings
  • Simplify registry to thin layer (or eliminate entirely)
  • Complete documentation overhaul
  • Establish performance baselines
  • Prepare for v0.4 breaking changes

Implementation Checklist

Deprecation

Add warnings to old patterns:

  • Add deprecation warnings to manual registry access
  • Add deprecation warnings to direct provider instantiation
  • Update all remaining usages to DI
  • Migration guide published
  • Support for user questions

Example warning:

# Old pattern still works but warns
def get_provider_registry():
    warnings.warn(
        "Manual registry access is deprecated. Use DI instead. "
        "See migration guide: https://docs.codeweaver.dev/di-migration",
        DeprecationWarning,
        stacklevel=2
    )
    # Still works for backward compat

Registry Simplification

Decision: Simplify or eliminate?

Option A: Simplify to thin layer

# packages/codeweaver-core/registry.py
class ProviderRegistry:
    """Thin registration layer over DI."""
    
    def register_provider(self, name, cls):
        """Register provider class."""
        self._classes[name] = cls
    
    def get_provider_class(self, name):
        """Get provider class."""
        return self._classes[name]
    
    # NO instantiation logic - that's in DI factories!

Option B: Eliminate entirely

# DI container IS the registry
container.register(
    EmbeddingProvider,
    factory=get_embedding_provider,
    singleton=True
)

Recommendation from analysis: Option B - Let DI replace registry

Tasks:

  • Decide: simplify or eliminate
  • Remove duplicate code
  • Optimize registry performance (if keeping)
  • Update registry tests
  • Document new architecture

Documentation Overhaul

Complete docs:

  • Architecture docs updated
    • DI architecture explanation
    • Monorepo structure guide
    • Package dependency graph
  • Migration guide finalized
    • Old pattern → DI pattern examples
    • Import path changes
    • Testing changes
  • Best practices guide
    • When to use DI
    • Custom provider creation
    • Testing with DI
  • API reference complete
    • All DI APIs documented
    • All package APIs documented
  • Tutorial videos/guides (optional)

Performance & Validation

Final validation:

  • Final performance benchmarking
    • DI overhead measured
    • End-to-end performance
    • Comparison with v0.1
  • Memory profiling
    • Container memory usage
    • Provider instance memory
    • Total system memory
  • Load testing
    • Concurrent request handling
    • Provider pool behavior
    • Resource cleanup
  • Production readiness checklist
    • All tests passing
    • Type checking passing
    • No circular dependencies
    • Documentation complete

Breaking Change Preparation (v0.4)

Plan for v0.4:

  • Document v0.4 breaking changes
    • Remove manual registry access
    • Require DI-based initialization
    • Update import paths (if needed)
  • Communicate migration timeline
    • Announce deprecation schedule
    • Provide 12+ month migration period
    • Offer migration assistance
  • Create migration automation tools (if feasible)
    • Script to convert old imports
    • Code modernization tools
    • Test migration helpers

Monorepo Context

Registry simplification in monorepo:

If keeping registry:

packages/codeweaver-core/
  registry/
    __init__.py
    thin_registry.py  # Minimal registration only

If eliminating registry:

packages/codeweaver-core/
  di/
    __init__.py
    container.py     # Container IS the registry
    # No separate registry package!

Package cleanup:

  • Remove unnecessary cross-package imports
  • Consolidate duplicated logic
  • Optimize package boundaries

Related Issues to Close/Update

Once this phase complete:

Update:

Acceptance Criteria

  • Old pattern deprecated (warnings active)
  • All code uses DI internally
  • Registry simplified or eliminated
  • Documentation complete
  • Performance validated
  • Code review approved
  • v0.4 breaking change plan documented
  • Migration timeline communicated

Success Metrics

Technical:

  • 0 uses of old pattern in new code
  • Registry code reduced by 60%+ (or eliminated)
  • Documentation covers 100% of DI APIs
  • Performance within 5% of baseline

User experience:

  • Clear migration path documented
  • Deprecation warnings helpful
  • 12+ month migration period announced
  • Automation tools available (if feasible)

Timeline for v0.4 Breaking Changes

Recommended schedule:

v0.3 (This phase):

  • Old pattern deprecated with warnings
  • DI fully working and documented
  • Migration guide published

v0.3.x (12+ months):

  • Support both patterns
  • Help users migrate
  • Collect feedback

v0.4 (After 12+ months):

  • Remove old pattern
  • DI-only codebase
  • Clean, simple architecture

Benefits After Complete Transformation

For developers:

  • ✅ 60-70% less boilerplate
  • ✅ 75% fewer circular dependencies
  • ✅ Clean monorepo with 9 packages
  • ✅ Simple, FastAPI-like DI
  • ✅ Easy to test and extend

For users:

  • ✅ Faster builds (monorepo)
  • ✅ Lighter installs (package selection)
  • ✅ Better performance
  • ✅ Clear architecture

For codebase:

  • ✅ No circular dependencies
  • ✅ Clean package boundaries
  • ✅ Scales to 100+ providers
  • ✅ Maintainable long-term

Reference

Connection to Integrated Strategy

This phase completes the transformation:

Total transformation: 2-3 weeks core + 3-4 weeks advanced = 5-7 weeks complete

Result:

  • ✅ Clean, modern architecture
  • ✅ Scales to future growth
  • ✅ Maintainable long-term
  • ✅ No technical debt

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions