feat(v1.0): remove legacy MCP mode and complete Phase 10 migration

This commit completes the Phase 10 migration to MCP-only architecture by
removing all legacy mode code paths and configuration options.

**Breaking Changes:**
- Removed `McpMode` enum from configuration system
- Removed `mode` setting from `[mcp]` config section
- MCP architecture is now always enabled (no option to disable)

**Code Changes:**
- Simplified `McpSettings` struct (now a placeholder for future options)
- Updated `McpClientFactory` to remove legacy mode branching
- Always use MCP architecture with automatic fallback to local client
- Added test infrastructure: `MockProvider` and `MockMcpClient` in test_utils

**Documentation:**
- Created comprehensive v0.x → v1.0 migration guide
- Added CHANGELOG_v1.0.md with detailed technical changes
- Documented common issues (cloud model 404s, timeouts, API key setup)
- Included rollback procedures and troubleshooting steps

**Testing:**
- All 29 tests passing
- Fixed agent tests to use new mock implementations
- Updated factory test to reflect new behavior

This completes the 10-phase migration plan documented in .agents/new_phases.md,
establishing Owlen as a production-ready MCP-only TUI application.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-11 00:24:29 +02:00
parent 7534c9ef8d
commit 5e81185df3
7 changed files with 463 additions and 54 deletions

177
docs/CHANGELOG_v1.0.md Normal file
View File

@@ -0,0 +1,177 @@
# Changelog for v1.0.0 - MCP-Only Architecture
## Summary
Version 1.0.0 marks the completion of the MCP-only architecture migration, removing all legacy code paths and fully embracing the Model Context Protocol for all LLM interactions and tool executions.
## Breaking Changes
### 1. Removed Legacy MCP Mode
**What changed:**
- The `[mcp]` section in `config.toml` no longer accepts a `mode` setting
- The `McpMode` enum has been removed from the configuration system
- MCP architecture is now always enabled - no option to disable it
**Migration:**
```diff
# old config.toml
[mcp]
-mode = "legacy" # or "enabled"
# new config.toml
[mcp]
# MCP is always enabled - no mode setting needed
```
**Code changes:**
- `crates/owlen-core/src/config.rs`: Removed `McpMode` enum, simplified `McpSettings`
- `crates/owlen-core/src/mcp/factory.rs`: Removed legacy mode handling from `McpClientFactory`
- All provider calls now go through MCP clients exclusively
### 2. Updated MCP Client Factory
**What changed:**
- `McpClientFactory::create()` no longer checks for legacy mode
- Automatically falls back to `LocalMcpClient` when no external MCP servers are configured
- Improved error messages for server connection failures
**Before:**
```rust
match self.config.mcp.mode {
McpMode::Legacy => { /* use local */ },
McpMode::Enabled => { /* use remote or fallback */ },
}
```
**After:**
```rust
// Always use MCP architecture
if let Some(server_cfg) = self.config.mcp_servers.first() {
// Try remote server, fallback to local on error
} else {
// Use local client
}
```
## New Features
### Test Infrastructure
Added comprehensive mock implementations for testing:
1. **MockProvider** (`crates/owlen-core/src/provider.rs`)
- Located in `provider::test_utils` module
- Provides a simple provider for unit tests
- Implements all required `Provider` trait methods
2. **MockMcpClient** (`crates/owlen-core/src/mcp.rs`)
- Located in `mcp::test_utils` module
- Provides a simple MCP client for unit tests
- Returns mock tool descriptors and responses
### Documentation
1. **Migration Guide** (`docs/migration-guide.md`)
- Comprehensive guide for migrating from v0.x to v1.0
- Step-by-step configuration update instructions
- Common issues and troubleshooting
- Rollback procedures if needed
2. **Updated Configuration Reference**
- Removed references to legacy mode
- Clarified MCP server configuration
- Added examples for local and cloud Ollama usage
## Bug Fixes
- Fixed test compilation errors due to missing mock implementations
- Resolved ambiguous glob re-export warnings (non-critical, test-only)
## Internal Changes
### Configuration System
- `McpSettings` struct now only serves as a placeholder for future MCP-specific settings
- Removed `McpMode` enum entirely
- Default configuration no longer includes mode setting
### MCP Factory
- Simplified factory logic by removing mode branching
- Improved fallback behavior with better error messages
- Test renamed to reflect new behavior: `test_factory_creates_local_client_when_no_servers_configured`
## Performance
No performance regressions expected. The MCP architecture may actually improve performance by:
- Removing unnecessary mode checks
- Streamlining the client creation process
- Better error handling reduces retry overhead
## Compatibility
### Backwards Compatibility
**Breaking:** Configuration files with `mode = "legacy"` will need to be updated:
- The setting is ignored (logs a warning in future versions)
- User config has been automatically updated if using standard path
### Forward Compatibility
The `McpSettings` struct is kept for future expansion:
- Can add MCP-specific timeouts
- Can add connection pooling settings
- Can add server selection strategies
## Testing
All tests passing:
```
test result: ok. 29 passed; 0 failed; 0 ignored
```
Key test areas:
- Agent ReAct pattern parsing
- MCP client factory creation
- Configuration loading and validation
- Mode-based tool filtering
- Permission and consent handling
## Upgrade Instructions
See [Migration Guide](migration-guide.md) for detailed instructions.
**Quick upgrade:**
1. Update your `~/.config/owlen/config.toml`:
```bash
# Remove the 'mode' line from [mcp] section
sed -i '/^mode = /d' ~/.config/owlen/config.toml
```
2. Rebuild Owlen:
```bash
cargo build --release
```
3. Test with a simple query:
```bash
owlen
```
## Known Issues
1. **Warning about ambiguous glob re-exports** - Non-critical, only affects test builds
2. **First inference may be slow** - Ollama loads models on first use (expected behavior)
3. **Cloud model 404 errors** - Ensure model names match Ollama Cloud's naming (remove `-cloud` suffix from model names)
## Contributors
This release completes the Phase 10 migration plan documented in `.agents/new_phases.md`.
## Related Issues
- Closes: Legacy mode removal
- Implements: Phase 10 cleanup and production polish
- References: MCP architecture migration phases 1-10