UAT: LspServerConfig.languages field not validated as required (min 1) — spec violation #3409

Open
opened 2026-04-05 16:32:47 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/lsp-server-config-languages-required
  • Commit Message: fix(lsp): enforce languages as required field with min_length=1 in LspServerConfig
  • Milestone: (none — backlog)
  • Parent Epic: #824

Bug Description

LspServerConfig.languages is defined as an optional field with a default empty list, but the specification requires it to be a non-empty list (min 1 language). This allows creating invalid server configurations that will silently fail language-based binding resolution.

Expected Behavior (from spec)

Per docs/specification.md line 20585:

languages | list[string] | Yes | Programming languages this server provides intelligence for (e.g., python, typescript, rust).

And per the informal YAML schema at line 36123:

languages: # Supported languages (required, min 1)

And the Structure Reference table at line 36169:

languages | list | Yes | Programming languages this server supports (min 1). Used for language-based and auto-discovery binding resolution.

Actual Behavior

In src/cleveragents/lsp/models.py lines 92–95:

languages: list[str] = Field(
    default_factory=list,
    description="Programming languages served (e.g. ['python'])",
)

The field has a default of [] (empty list) and no min_length constraint. A server can be registered with no languages, which breaks:

  • Language-based binding resolution (actors binding by language)
  • Auto-discovery binding (actors with lsp: auto: true)
  • The list_servers(language=...) filter (returns servers with no languages when filtering)

Code Location

  • File: src/cleveragents/lsp/models.py
  • Lines 92–95: languages field definition — missing min_length=1 constraint

Steps to Reproduce

from cleveragents.lsp.models import LspServerConfig

# This should raise a validation error but doesn't:
config = LspServerConfig(
    name="local/pyright",
    command="pyright-langserver",
    languages=[],  # Empty — should be rejected
)
print(config.languages)  # []  — no error raised

Impact

  • Language-based LSP binding resolution silently fails for servers with no languages
  • Auto-discovery binding (lsp: auto: true) cannot match servers with empty language lists
  • Invalid configurations can be registered and stored without error

Subtasks

  • Add min_length=1 constraint to languages field in LspServerConfig
  • Remove default_factory=list (field should be required, not optional)
  • Update _validate_languages validator to also reject empty lists
  • Update unit tests to verify empty languages list is rejected
  • Check if any existing test fixtures use empty languages and update them

Definition of Done

  • LspServerConfig(name="local/x", command="x", languages=[]) raises ValidationError
  • LspServerConfig(name="local/x", command="x") (no languages) raises ValidationError
  • All existing tests pass
  • All nox stages pass
  • Coverage >= 97%

Backlog note: This issue was discovered during autonomous operation
on milestone LSP Functional Runtime (Epic #824). It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/lsp-server-config-languages-required` - **Commit Message**: `fix(lsp): enforce languages as required field with min_length=1 in LspServerConfig` - **Milestone**: *(none — backlog)* - **Parent Epic**: #824 ## Bug Description `LspServerConfig.languages` is defined as an optional field with a default empty list, but the specification requires it to be a non-empty list (min 1 language). This allows creating invalid server configurations that will silently fail language-based binding resolution. ## Expected Behavior (from spec) Per `docs/specification.md` line 20585: > `languages` | list[string] | **Yes** | Programming languages this server provides intelligence for (e.g., `python`, `typescript`, `rust`). And per the informal YAML schema at line 36123: > `languages: # Supported languages (required, min 1)` And the Structure Reference table at line 36169: > `languages` | list | **Yes** | Programming languages this server supports (min 1). Used for language-based and auto-discovery binding resolution. ## Actual Behavior In `src/cleveragents/lsp/models.py` lines 92–95: ```python languages: list[str] = Field( default_factory=list, description="Programming languages served (e.g. ['python'])", ) ``` The field has a default of `[]` (empty list) and no `min_length` constraint. A server can be registered with no languages, which breaks: - Language-based binding resolution (actors binding by language) - Auto-discovery binding (actors with `lsp: auto: true`) - The `list_servers(language=...)` filter (returns servers with no languages when filtering) ## Code Location - File: `src/cleveragents/lsp/models.py` - Lines 92–95: `languages` field definition — missing `min_length=1` constraint ## Steps to Reproduce ```python from cleveragents.lsp.models import LspServerConfig # This should raise a validation error but doesn't: config = LspServerConfig( name="local/pyright", command="pyright-langserver", languages=[], # Empty — should be rejected ) print(config.languages) # [] — no error raised ``` ## Impact - Language-based LSP binding resolution silently fails for servers with no languages - Auto-discovery binding (`lsp: auto: true`) cannot match servers with empty language lists - Invalid configurations can be registered and stored without error ## Subtasks - [ ] Add `min_length=1` constraint to `languages` field in `LspServerConfig` - [ ] Remove `default_factory=list` (field should be required, not optional) - [ ] Update `_validate_languages` validator to also reject empty lists - [ ] Update unit tests to verify empty languages list is rejected - [ ] Check if any existing test fixtures use empty languages and update them ## Definition of Done - [ ] `LspServerConfig(name="local/x", command="x", languages=[])` raises `ValidationError` - [ ] `LspServerConfig(name="local/x", command="x")` (no languages) raises `ValidationError` - [ ] All existing tests pass - [ ] All nox stages pass - [ ] Coverage >= 97% > **Backlog note:** This issue was discovered during autonomous operation > on milestone LSP Functional Runtime (Epic #824). It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Backlog (unchanged)
  • Story Points: 2 — S — Add validation for LspServerConfig.languages field.
  • MoSCoW: Should Have — Spec compliance for LSP configuration validation.

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Backlog (unchanged) - **Story Points**: 2 — S — Add validation for LspServerConfig.languages field. - **MoSCoW**: Should Have — Spec compliance for LSP configuration validation. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#824 Epic: LSP Functional Runtime
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3409
No description provided.