UAT: Inconsistent skill name validation pattern — SkillConfigSchema enforces lowercase-only but Skill domain model allows uppercase #3814

Open
opened 2026-04-06 06:34:31 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: bugfix/skill-name-validation-pattern-inconsistency
  • Commit Message: fix(skills): align SkillConfigSchema name pattern with Skill domain model and schema YAML
  • Milestone: Backlog (no milestone — see backlog note below)
  • Parent Epic: Orphan — no Skill System Epic exists; requires manual linking

Backlog note: This issue was discovered during autonomous operation
on milestone v3.7.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.

Background and Context

During UAT testing of the Skill System, an inconsistency was discovered between the name validation regex used in SkillConfigSchema (schema layer) and the Skill domain model. The formal schema definition in docs/schema/skill.schema.yaml uses a case-insensitive pattern (^[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+$), but the two Python layers disagree with each other — one is lowercase-only, the other allows uppercase.

Current Behavior

There is an inconsistency between two layers:

1. SkillConfigSchema (schema layer) — lowercase-only:

# src/cleveragents/skills/schema.py
NAMESPACED_NAME_RE = re.compile(r"^[a-z0-9][a-z0-9_-]*/[a-z0-9][a-z0-9_-]*$")

This rejects names like Local/Test-Skill or MyOrg/my-skill.

2. Skill domain model — allows uppercase:

# src/cleveragents/domain/models/core/skill.py
_SKILL_NAME_PATTERN = re.compile(r"^[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+$")

This accepts names like Local/Test-Skill or MyOrg/my-skill.

Verified by testing:

from cleveragents.domain.models.core.skill import Skill
from cleveragents.skills.schema import SkillConfigSchema

# Domain model accepts uppercase
skill = Skill(name='Local/Test-Skill', description='Test')
print(skill.name)  # 'Local/Test-Skill' — accepted!

# Schema rejects uppercase
try:
    s = SkillConfigSchema.from_yaml('name: Local/Test-Skill\ndescription: Test')
except Exception as e:
    print(type(e).__name__)  # ValidationError — rejected!

Expected Behavior

The docs/schema/skill.schema.yaml defines the name pattern as:

name:
  type: string
  required: true
  pattern: "^[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+$"

Both SkillConfigSchema.NAMESPACED_NAME_RE and Skill._SKILL_NAME_PATTERN should use the same regex, consistent with the formal schema YAML definition.

Impact

  • Skills can be created directly via the domain model with uppercase names that the CLI would reject
  • The docs/schema/skill.schema.yaml uses the case-insensitive pattern, suggesting the domain model is correct and the schema layer is too restrictive
  • This inconsistency can lead to skills being stored in the database with names that cannot be referenced via the CLI
  • Violates the single-source-of-truth principle for validation rules

Code Locations

  • src/cleveragents/skills/schema.pyNAMESPACED_NAME_RE constant (line ~34)
  • src/cleveragents/domain/models/core/skill.py_SKILL_NAME_PATTERN constant (line ~37)
  • docs/schema/skill.schema.yamlname.pattern field

Subtasks

  • Determine the canonical pattern: review docs/schema/skill.schema.yaml and team convention to decide whether names should be case-insensitive ([a-zA-Z0-9_-]) or lowercase-only ([a-z0-9_-])
  • Update NAMESPACED_NAME_RE in src/cleveragents/skills/schema.py to match the canonical pattern
  • Update _SKILL_NAME_PATTERN in src/cleveragents/domain/models/core/skill.py to match the canonical pattern (if different from current)
  • Update docs/schema/skill.schema.yaml name.pattern field if the decision is lowercase-only
  • Add/update unit tests in Behave: add scenarios covering both valid and invalid name formats for SkillConfigSchema and Skill
  • Add/update unit tests to assert both layers reject the same set of invalid names and accept the same set of valid names
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • SkillConfigSchema.NAMESPACED_NAME_RE and Skill._SKILL_NAME_PATTERN use identical regex patterns.
  • The pattern in both Python files matches the pattern declared in docs/schema/skill.schema.yaml.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage >= 97%.

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

## Metadata - **Branch**: `bugfix/skill-name-validation-pattern-inconsistency` - **Commit Message**: `fix(skills): align SkillConfigSchema name pattern with Skill domain model and schema YAML` - **Milestone**: Backlog (no milestone — see backlog note below) - **Parent Epic**: Orphan — no Skill System Epic exists; requires manual linking > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.7.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ## Background and Context During UAT testing of the Skill System, an inconsistency was discovered between the name validation regex used in `SkillConfigSchema` (schema layer) and the `Skill` domain model. The formal schema definition in `docs/schema/skill.schema.yaml` uses a case-insensitive pattern (`^[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+$`), but the two Python layers disagree with each other — one is lowercase-only, the other allows uppercase. ## Current Behavior There is an inconsistency between two layers: **1. `SkillConfigSchema` (schema layer) — lowercase-only:** ```python # src/cleveragents/skills/schema.py NAMESPACED_NAME_RE = re.compile(r"^[a-z0-9][a-z0-9_-]*/[a-z0-9][a-z0-9_-]*$") ``` This rejects names like `Local/Test-Skill` or `MyOrg/my-skill`. **2. `Skill` domain model — allows uppercase:** ```python # src/cleveragents/domain/models/core/skill.py _SKILL_NAME_PATTERN = re.compile(r"^[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+$") ``` This accepts names like `Local/Test-Skill` or `MyOrg/my-skill`. **Verified by testing:** ```python from cleveragents.domain.models.core.skill import Skill from cleveragents.skills.schema import SkillConfigSchema # Domain model accepts uppercase skill = Skill(name='Local/Test-Skill', description='Test') print(skill.name) # 'Local/Test-Skill' — accepted! # Schema rejects uppercase try: s = SkillConfigSchema.from_yaml('name: Local/Test-Skill\ndescription: Test') except Exception as e: print(type(e).__name__) # ValidationError — rejected! ``` ## Expected Behavior The `docs/schema/skill.schema.yaml` defines the name pattern as: ```yaml name: type: string required: true pattern: "^[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+$" ``` Both `SkillConfigSchema.NAMESPACED_NAME_RE` and `Skill._SKILL_NAME_PATTERN` should use the same regex, consistent with the formal schema YAML definition. ## Impact - Skills can be created directly via the domain model with uppercase names that the CLI would reject - The `docs/schema/skill.schema.yaml` uses the case-insensitive pattern, suggesting the domain model is correct and the schema layer is too restrictive - This inconsistency can lead to skills being stored in the database with names that cannot be referenced via the CLI - Violates the single-source-of-truth principle for validation rules ## Code Locations - `src/cleveragents/skills/schema.py` — `NAMESPACED_NAME_RE` constant (line ~34) - `src/cleveragents/domain/models/core/skill.py` — `_SKILL_NAME_PATTERN` constant (line ~37) - `docs/schema/skill.schema.yaml` — `name.pattern` field ## Subtasks - [ ] Determine the canonical pattern: review `docs/schema/skill.schema.yaml` and team convention to decide whether names should be case-insensitive (`[a-zA-Z0-9_-]`) or lowercase-only (`[a-z0-9_-]`) - [ ] Update `NAMESPACED_NAME_RE` in `src/cleveragents/skills/schema.py` to match the canonical pattern - [ ] Update `_SKILL_NAME_PATTERN` in `src/cleveragents/domain/models/core/skill.py` to match the canonical pattern (if different from current) - [ ] Update `docs/schema/skill.schema.yaml` `name.pattern` field if the decision is lowercase-only - [ ] Add/update unit tests in Behave: add scenarios covering both valid and invalid name formats for `SkillConfigSchema` and `Skill` - [ ] Add/update unit tests to assert both layers reject the same set of invalid names and accept the same set of valid names - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - `SkillConfigSchema.NAMESPACED_NAME_RE` and `Skill._SKILL_NAME_PATTERN` use identical regex patterns. - The pattern in both Python files matches the pattern declared in `docs/schema/skill.schema.yaml`. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage >= 97%. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
Author
Owner

⚠️ Orphan Issue — Manual Linking Required

This issue has no parent Epic to link to. A search of all open Type/Epic issues found no dedicated Skill System Epic. This issue cannot be linked via Forgejo's dependency system until a suitable parent Epic is created or identified.

Action required by project owner: Please either:

  1. Create a new Skill System / Schema Validation Epic and link this issue as a child (this issue should block the parent Epic), or
  2. Link this issue to an existing Epic that covers skill schema and domain model consistency work.

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

⚠️ **Orphan Issue — Manual Linking Required** This issue has no parent Epic to link to. A search of all open `Type/Epic` issues found no dedicated Skill System Epic. This issue cannot be linked via Forgejo's dependency system until a suitable parent Epic is created or identified. **Action required by project owner:** Please either: 1. Create a new Skill System / Schema Validation Epic and link this issue as a child (this issue should **block** the parent Epic), or 2. Link this issue to an existing Epic that covers skill schema and domain model consistency work. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
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#3814
No description provided.