UAT: NamespacedName.validate_name silently lowercases action/plan names — spec allows mixed-case [a-zA-Z0-9_-]+ #4671

Open
opened 2026-04-08 17:59:23 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area

NamespacedName domain model — action and plan name normalization

What Was Tested

Code-level analysis of src/cleveragents/domain/models/core/plan.py NamespacedName class.

Expected Behavior (from spec)

The spec (docs/specification.md, Action Configuration Files JSON Schema) defines the name pattern as:

"name": {
  "type": "string",
  "pattern": "^[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+$",
  "description": "Fully qualified action name in <namespace>/<name> format."
}

The pattern [a-zA-Z0-9_-]+ explicitly allows uppercase letters. The spec also shows examples like openai/gpt-4, anthropic/claude-4-sonnet, cleverthis/deploy-action — all lowercase, but the schema allows uppercase.

Actual Behavior (from code)

The NamespacedName.validate_name field validator silently lowercases all names:

# src/cleveragents/domain/models/core/plan.py
@field_validator("name")
@classmethod
def validate_name(cls: type[NamespacedName], v: str) -> str:
    """Validate name format (kebab-case recommended)."""
    if not v.replace("-", "").replace("_", "").isalnum():
        raise ValueError("Name must be alphanumeric with hyphens or underscores")
    return v.lower()  # <-- silently lowercases!

Similarly, validate_namespace also lowercases:

return v.lower()  # <-- silently lowercases namespace too

Impact:

  1. An action created with name MyOrg/MyAction is silently stored as myorg/myaction
  2. The user sees myorg/myaction in output even though they specified MyOrg/MyAction
  3. This is a silent data mutation — no warning is emitted
  4. Inconsistent with ActionConfigSchema.NAMESPACED_NAME_RE which at least raises an error (though with the wrong pattern — see #4605)

Steps to Reproduce

from cleveragents.domain.models.core.plan import NamespacedName

# Silent lowercasing:
nn = NamespacedName.parse("MyOrg/MyAction")
print(str(nn))  # Outputs: "myorg/myaction" (not "MyOrg/MyAction")

# No error raised, but name is silently mutated

Code Location

src/cleveragents/domain/models/core/plan.py:

  • NamespacedName.validate_name (line ~232) — return v.lower()
  • NamespacedName.validate_namespace (line ~221) — return v.lower()

Fix Required

Per the spec, the name pattern is [a-zA-Z0-9_-]+ — mixed case is allowed. The validator should:

  1. Validate the format (alphanumeric + hyphens/underscores)
  2. NOT silently lowercase the value
  3. If lowercase-only is the intended design decision, it should be documented and the spec pattern should be updated — but currently there is a silent mismatch
@field_validator("name")
@classmethod
def validate_name(cls: type[NamespacedName], v: str) -> str:
    """Validate name format."""
    if not v.replace("-", "").replace("_", "").isalnum():
        raise ValueError("Name must be alphanumeric with hyphens or underscores")
    return v  # Do NOT lowercase — spec allows mixed case

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report ### Feature Area `NamespacedName` domain model — action and plan name normalization ### What Was Tested Code-level analysis of `src/cleveragents/domain/models/core/plan.py` `NamespacedName` class. ### Expected Behavior (from spec) The spec (docs/specification.md, Action Configuration Files JSON Schema) defines the name pattern as: ```json "name": { "type": "string", "pattern": "^[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+$", "description": "Fully qualified action name in <namespace>/<name> format." } ``` The pattern `[a-zA-Z0-9_-]+` explicitly allows uppercase letters. The spec also shows examples like `openai/gpt-4`, `anthropic/claude-4-sonnet`, `cleverthis/deploy-action` — all lowercase, but the schema allows uppercase. ### Actual Behavior (from code) The `NamespacedName.validate_name` field validator silently lowercases all names: ```python # src/cleveragents/domain/models/core/plan.py @field_validator("name") @classmethod def validate_name(cls: type[NamespacedName], v: str) -> str: """Validate name format (kebab-case recommended).""" if not v.replace("-", "").replace("_", "").isalnum(): raise ValueError("Name must be alphanumeric with hyphens or underscores") return v.lower() # <-- silently lowercases! ``` Similarly, `validate_namespace` also lowercases: ```python return v.lower() # <-- silently lowercases namespace too ``` **Impact:** 1. An action created with name `MyOrg/MyAction` is silently stored as `myorg/myaction` 2. The user sees `myorg/myaction` in output even though they specified `MyOrg/MyAction` 3. This is a silent data mutation — no warning is emitted 4. Inconsistent with `ActionConfigSchema.NAMESPACED_NAME_RE` which at least raises an error (though with the wrong pattern — see #4605) ### Steps to Reproduce ```python from cleveragents.domain.models.core.plan import NamespacedName # Silent lowercasing: nn = NamespacedName.parse("MyOrg/MyAction") print(str(nn)) # Outputs: "myorg/myaction" (not "MyOrg/MyAction") # No error raised, but name is silently mutated ``` ### Code Location `src/cleveragents/domain/models/core/plan.py`: - `NamespacedName.validate_name` (line ~232) — `return v.lower()` - `NamespacedName.validate_namespace` (line ~221) — `return v.lower()` ### Fix Required Per the spec, the name pattern is `[a-zA-Z0-9_-]+` — mixed case is allowed. The validator should: 1. Validate the format (alphanumeric + hyphens/underscores) 2. **NOT** silently lowercase the value 3. If lowercase-only is the intended design decision, it should be documented and the spec pattern should be updated — but currently there is a silent mismatch ```python @field_validator("name") @classmethod def validate_name(cls: type[NamespacedName], v: str) -> str: """Validate name format.""" if not v.replace("-", "").replace("_", "").isalnum(): raise ValueError("Name must be alphanumeric with hyphens or underscores") return v # Do NOT lowercase — spec allows mixed case ``` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.5.0 milestone 2026-04-08 18:05:39 +00:00
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.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#4671
No description provided.