-
Notifications
You must be signed in to change notification settings - Fork 1
Description
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 compatRegistry 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:
- Close Register default services in services registry #84: Register default services → DI handles
- Close Improve EmbeddingRegistry: configurable size, dynamic sizing, persistence #100: EmbeddingRegistry improvements → Registry becomes thin layer or eliminated
- Close Integrate Indexer with services registry and implement persistence loading #103: Indexer service integration → DI replaces approach
Update:
- Update Implement provider system for reranker models (mirror embedding system) #109: Reranker provider system → Use DI patterns established
- Update monorepo docs with final architecture
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
- Planning:
plans/DI_IMPLEMENTATION_CHECKLIST.md(Phase 5 section) - Migration strategy:
plans/dependency-injection-architecture-plan.md - Monorepo structure: [Monorepo Phase 3] Organize into clean package structure (9 packages) #204
- Integrated strategy:
INTEGRATED_DI_MONOREPO_STRATEGY.md
Connection to Integrated Strategy
This phase completes the transformation:
- Week 1: DI foundation ([DI Phase 1] Foundation + monorepo prep (tokenizers, daemon, SearchResult) #117)
- Week 2: DI integration, break dependencies ([DI Phase 2] Core migration - Breaking 75% of circular dependencies #118)
- Week 3: Monorepo structure ([Monorepo Phase 3] Organize into clean package structure (9 packages) #204)
- Weeks 4-6: Advanced features ([DI Phase 4] pydantic-ai integration (agents + data sources) #119, [DI Phase 5] Advanced features (health, telemetry, plugins) #120)
- This phase: Final cleanup and v0.4 prep
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