This plan provides a systematic approach to completely remove the legacy HTTPClient compatibility layer from the ExLLM codebase, ensuring no functionality is lost while modernizing the HTTP infrastructure.
Selected for maximum safety and traceability, allowing rollback at any checkpoint if issues arise.
Objective: Map all HTTPClient dependencies and usage patterns
-
Find All References
git grep -n "HTTPClient" > httpclient_references.txt
-
Categorize References
- Test files (can be updated)
- Production code (needs careful migration)
- Documentation (needs updating)
- Configuration files
-
Check Indirect Dependencies
- Search for aliases:
alias.*HTTPClient - Import statements
- Module attributes referencing HTTPClient
- Search for aliases:
-
Create Dependency Map
HTTPClient ├── StreamingCoordinator (verify migration) ├── EnhancedStreamingCoordinator (verify migration) ├── Legacy Tests │ ├── streaming_migration_test.exs │ ├── streaming_performance_test.exs │ └── http_core_streaming_validation_test.exs └── Stream Parsers (check if orphaned)
Objective: Confirm all functionality has migrated to HTTP.Core
- All provider modules use HTTP.Core
- StreamingCoordinator uses HTTP.Core
- EnhancedStreamingCoordinator uses HTTP.Core
- ModelFetcher uses HTTP.Core
- Error handling patterns match between implementations
- All HTTP operations have HTTP.Core equivalents
# Check provider usage
git grep -l "HTTP.Core" lib/ex_llm/providers/
# Verify no direct HTTPClient usage in providers
git grep "HTTPClient" lib/ex_llm/providers/ --include="*.ex"Objective: Update tests to use HTTP.Core directly
-
streaming_migration_test.exs
- Remove HTTPClient vs HTTP.Core comparison tests
- Keep streaming validation tests using only HTTP.Core
-
streaming_performance_test.exs
- Remove legacy_streaming benchmark
- Keep performance tests for HTTP.Core only
-
http_core_streaming_validation_test.exs
- Update to remove HTTPClient references
- Ensure all validations use HTTP.Core
# Run after each file update
mix test <updated_test_file>
# Verify no test regression
mix test --failedObjective: Safely remove all legacy code
-
Test References First
- Remove from test files
- Run
mix testto ensure no breakage
-
Documentation & Comments
- Update any code comments
- Remove from documentation files
-
Unused Modules
- Identify orphaned stream parsers
- Remove if only used by HTTPClient
-
Core Module Removal
- Remove
lib/ex_llm/providers/shared/http_client.ex - Run
mix compile --warnings-as-errors
- Remove
- Commit after each sub-phase
- Tag commits for easy rollback
- Run full test suite between removals
Objective: Ensure complete removal with no regressions
-
git grep HTTPClientreturns no results -
mix compile --warnings-as-errorssucceeds -
mix testpasses all tests -
mix test --include integrationpasses - Documentation updated (CLAUDE.md, README.md)
- No orphaned modules remain
- Remove HTTPClient references from CLAUDE.md
- Update migration notes if any exist
- Add note about HTTP.Core being the standard
| Risk | Mitigation |
|---|---|
| Hidden Dependencies | Use git grep + compile checks |
| Streaming Breakage | Keep streaming tests, verify manually |
| Provider Issues | Test each provider individually |
| Compilation Errors | Feature branch + atomic commits |
- Each phase in separate commit
- Tag before major removals
- Keep branch until merged and stable
# Create feature branch
git checkout -b remove-legacy-httpclient
# Run discovery
git grep -n "HTTPClient" | tee httpclient_references.txt
# Start with least risky changes
mix test test/ex_llm/providers/shared/streaming_migration_test.exs# After each change
mix compile --warnings-as-errors
# After each phase
mix test
# Before PR
mix test --include slow --include integration
mix format --check-formatted
mix credo## Remove Legacy HTTPClient Compatibility Layer
### Summary
Completes the HTTP client migration by removing the deprecated HTTPClient
module and all associated legacy code.
### Changes
- Removed `HTTPClient` module and all references
- Updated tests to use HTTP.Core directly
- Removed migration compatibility tests
- Cleaned up unused stream parser modules
### Testing
- [x] All unit tests pass
- [x] All integration tests pass
- [x] Manually tested streaming with each provider
- [x] No compilation warnings
### Migration Note
All functionality previously provided by HTTPClient is now handled by
HTTP.Core with improved error handling and middleware support.While specific dates aren't set, the phases should be executed in order with verification between each:
- Phase 1: Discovery & Assessment
- Phase 2: Migration Verification
- Phase 3: Test Transformation
- Phase 4: Code Removal
- Phase 5: Final Verification
Each phase should be completed and verified before moving to the next.
The removal is considered complete when:
- All HTTPClient references are removed from the codebase
- All tests pass without any HTTPClient dependencies
- No compilation warnings related to the removal
- All streaming functionality works correctly with HTTP.Core
- Documentation reflects the current state
This plan ensures safe, systematic removal of the legacy HTTPClient layer while maintaining all functionality through the modern HTTP.Core implementation.