Fixed lint, tests after recent fix

Updated readme
This commit is contained in:
Fahad
2025-06-14 19:31:31 +04:00
parent b41b874e31
commit f1ad06c529
5 changed files with 18 additions and 24 deletions

View File

@@ -256,7 +256,7 @@ Just ask Claude naturally:
- **Something's broken?** → `debug` (root cause analysis, error tracing)
- **Want to understand code?** → `analyze` (architecture, patterns, dependencies)
- **Need comprehensive tests?** → `testgen` (generates test suites with edge cases)
- **Server info?** → `get_version` (version and configuration details)
- **Server info?** → `version` (version and configuration details)
**Auto Mode:** When `DEFAULT_MODEL=auto`, Claude automatically picks the best model for each task. You can override with: "Use flash for quick analysis" or "Use o3 to debug this".
@@ -277,7 +277,7 @@ Just ask Claude naturally:
5. [`debug`](#5-debug---expert-debugging-assistant) - Root cause analysis and debugging
6. [`analyze`](#6-analyze---smart-file-analysis) - General-purpose file and code analysis
7. [`testgen`](#7-testgen---comprehensive-test-generation) - Comprehensive test generation with edge case coverage
8. [`get_version`](#8-get_version---server-information) - Get server version and configuration
8. [`version`](#8-version---server-information) - Get server version and configuration
### 1. `chat` - General Development Chat & Collaborative Thinking
**Your thinking partner - bounce ideas, get second opinions, brainstorm collaboratively**
@@ -463,7 +463,7 @@ suites that cover realistic failure scenarios and integration points that shorte
- Can reference existing test files: `"Generate tests following patterns from tests/unit/"`
- Specific code coverage - target specific functions/classes rather than testing everything
### 8. `get_version` - Server Information
### 8. `version` - Server Information
```
"Get zen to show its version"
```

View File

@@ -189,9 +189,6 @@ class CustomProvider(OpenAICompatibleProvider):
"""
logging.debug(f"Custom provider validating model: '{model_name}'")
# If OpenRouter is available and this looks like a cloud model, defer to OpenRouter
openrouter_available = os.getenv("OPENROUTER_API_KEY") is not None
# Try to resolve through registry first
config = self._registry.resolve(model_name)
if config:

View File

@@ -409,7 +409,7 @@ async def handle_call_tool(name: str, arguments: dict[str, Any]) -> list[TextCon
# Route to utility tools that provide server information
elif name == "version":
logger.info(f"Executing utility tool '{name}'")
result = await handle_get_version()
result = await handle_version()
logger.info(f"Utility tool '{name}' execution completed")
return result
@@ -609,7 +609,7 @@ async def reconstruct_thread_context(arguments: dict[str, Any]) -> dict[str, Any
return enhanced_arguments
async def handle_get_version() -> list[TextContent]:
async def handle_version() -> list[TextContent]:
"""
Get comprehensive version and configuration information about the server.

View File

@@ -335,9 +335,7 @@ class TestClass:
thread_description = "A1-Branch (2-thread chain)"
is_valid_length = chain_length == 2
traversal_validations.append(
(f"{thread_description} has valid chain length", is_valid_length)
)
traversal_validations.append((f"{thread_description} has valid chain length", is_valid_length))
# Also validate we found at least one traversal (shows the system is working)
traversal_validations.append(

View File

@@ -266,7 +266,7 @@ class TestCustomProviderOpenRouterRestrictions:
@patch.dict(os.environ, {"OPENROUTER_ALLOWED_MODELS": "opus,sonnet", "OPENROUTER_API_KEY": "test-key"})
def test_custom_provider_respects_openrouter_restrictions(self):
"""Test that custom provider respects OpenRouter restrictions for cloud models."""
"""Test that custom provider correctly defers OpenRouter models to OpenRouter provider."""
# Clear any cached restriction service
import utils.model_restrictions
@@ -276,11 +276,9 @@ class TestCustomProviderOpenRouterRestrictions:
provider = CustomProvider(base_url="http://test.com/v1")
# Should validate allowed OpenRouter models (is_custom=false)
assert provider.validate_model_name("opus")
assert provider.validate_model_name("sonnet")
# Should not validate disallowed OpenRouter models
# CustomProvider should NOT validate OpenRouter models - they should be deferred to OpenRouter
assert not provider.validate_model_name("opus")
assert not provider.validate_model_name("sonnet")
assert not provider.validate_model_name("haiku")
# Should still validate custom models (is_custom=true) regardless of restrictions
@@ -288,7 +286,7 @@ class TestCustomProviderOpenRouterRestrictions:
@patch.dict(os.environ, {"OPENROUTER_ALLOWED_MODELS": "opus", "OPENROUTER_API_KEY": "test-key"})
def test_custom_provider_openrouter_capabilities_restrictions(self):
"""Test that custom provider's get_capabilities respects OpenRouter restrictions."""
"""Test that custom provider's get_capabilities correctly handles OpenRouter models."""
# Clear any cached restriction service
import utils.model_restrictions
@@ -298,7 +296,8 @@ class TestCustomProviderOpenRouterRestrictions:
provider = CustomProvider(base_url="http://test.com/v1")
# Should work for allowed OpenRouter model
# For OpenRouter models, get_capabilities should still work but mark them as OPENROUTER
# This tests the capabilities lookup, not validation
capabilities = provider.get_capabilities("opus")
assert capabilities.provider == ProviderType.OPENROUTER
@@ -335,7 +334,7 @@ class TestCustomProviderOpenRouterRestrictions:
@patch.dict(os.environ, {"OPENROUTER_ALLOWED_MODELS": "", "OPENROUTER_API_KEY": "test-key"})
def test_custom_provider_empty_restrictions_allows_all_openrouter(self):
"""Test that empty OPENROUTER_ALLOWED_MODELS allows all OpenRouter models."""
"""Test that custom provider correctly defers OpenRouter models regardless of restrictions."""
# Clear any cached restriction service
import utils.model_restrictions
@@ -345,10 +344,10 @@ class TestCustomProviderOpenRouterRestrictions:
provider = CustomProvider(base_url="http://test.com/v1")
# Should validate all OpenRouter models when restrictions are empty
assert provider.validate_model_name("opus")
assert provider.validate_model_name("sonnet")
assert provider.validate_model_name("haiku")
# CustomProvider should NOT validate OpenRouter models - they should be deferred to OpenRouter
assert not provider.validate_model_name("opus")
assert not provider.validate_model_name("sonnet")
assert not provider.validate_model_name("haiku")
class TestRegistryIntegration: