Files
skill-seekers-reference/tests
yusyus df78aae51f fix(A1.3): Add name and URL format validation to submit_config
Issue: #11 (A1.3 test failures)

## Problem
3/8 tests were failing because ConfigValidator only validates structure
and required fields, NOT format validation (names, URLs, etc.).

## Root Cause
ConfigValidator checks:
- Required fields (name, description, sources/base_url)
- Source types validity
- Field types (arrays, integers)

ConfigValidator does NOT check:
- Name format (alphanumeric, hyphens, underscores)
- URL format (http:// or https://)

## Solution
Added additional format validation in submit_config_tool after ConfigValidator:
1. Name format validation using regex: `^[a-zA-Z0-9_-]+$`
2. URL format validation (must start with http:// or https://)
3. Validates both legacy (base_url) and unified (sources.base_url) formats

## Test Results
Before: 5/8 tests passing, 3 failing
After: 8/8 tests passing 

Full suite: 427 tests passing, 40 skipped 

## Changes Made
- src/skill_seekers/mcp/server.py:
  * Added `import re` at top of file
  * Added name format validation (line 1280-1281)
  * Added URL format validation for legacy configs (line 1285-1289)
  * Added URL format validation for unified configs (line 1291-1296)

- tests/test_mcp_server.py:
  * Updated test_submit_config_validates_required_fields to accept
    ConfigValidator's correct error message ("cannot detect" instead of "description")

## Validation Examples
Invalid name: "React@2024!" →  "Invalid name format"
Invalid URL: "not-a-url" →  "Invalid base_url format"
Valid name: "react-docs" → 
Valid URL: "https://react.dev/" → 

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-21 18:40:50 +03:00
..