BUG: [validation] Missing Validation for Actor Roles in CLI add/update Commands #3758

Open
opened 2026-04-05 22:31:20 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/actor-role-validation-cli
  • Commit Message: fix(cli): validate actor role in add and update commands
  • Milestone: (backlog — no milestone assigned)
  • Parent Epic: #392

Background

The _print_role_warnings function in src/cleveragents/cli/commands/actor.py (lines 501–505) prints non-fatal warnings for role compatibility issues but does not prevent the user from creating or updating an actor with an invalid role. This means an invalid role can be persisted, leading to unexpected runtime behavior.

def _print_role_warnings(config_blob: dict[str, Any]) -> None:
    """Print non-fatal role compatibility warnings for actor configs."""
    for warning in actor_role_warnings(config_blob):
        console.print(f"[yellow]Warning:[/yellow] {warning}")

The add and update CLI commands call _print_role_warnings but never call a corresponding validation function that raises on invalid roles, leaving a gap between warning and enforcement.

Subtasks

  • Identify or implement an actor_role_is_valid / validate_actor_role function in the actor domain layer
  • Update the add command in actor.py to call role validation before persisting, raising a ValidationError on invalid roles
  • Update the update command in actor.py to call role validation before persisting, raising a ValidationError on invalid roles
  • Write BDD unit test scenarios (Behave/Gherkin) covering: valid role accepted, invalid role rejected with ValidationError
  • Write Robot Framework integration test covering the CLI actor add and actor update commands with an invalid role
  • Ensure all nox stages pass

Definition of Done

  • add command raises ValidationError (or equivalent CLI error) when an invalid actor role is supplied
  • update command raises ValidationError (or equivalent CLI error) when an invalid actor role is supplied
  • BDD unit test scenarios written and passing
  • Robot Framework integration test written and passing
  • All nox stages pass
  • Coverage >= 97%

Backlog note: This issue was discovered during autonomous operation
on milestone v3.2.0. 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: Bug Hunting | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/actor-role-validation-cli` - **Commit Message**: `fix(cli): validate actor role in add and update commands` - **Milestone**: *(backlog — no milestone assigned)* - **Parent Epic**: #392 ## Background The `_print_role_warnings` function in `src/cleveragents/cli/commands/actor.py` (lines 501–505) prints non-fatal warnings for role compatibility issues but does not prevent the user from creating or updating an actor with an invalid role. This means an invalid role can be persisted, leading to unexpected runtime behavior. ```python def _print_role_warnings(config_blob: dict[str, Any]) -> None: """Print non-fatal role compatibility warnings for actor configs.""" for warning in actor_role_warnings(config_blob): console.print(f"[yellow]Warning:[/yellow] {warning}") ``` The `add` and `update` CLI commands call `_print_role_warnings` but never call a corresponding validation function that raises on invalid roles, leaving a gap between warning and enforcement. ## Subtasks - [ ] Identify or implement an `actor_role_is_valid` / `validate_actor_role` function in the actor domain layer - [ ] Update the `add` command in `actor.py` to call role validation before persisting, raising a `ValidationError` on invalid roles - [ ] Update the `update` command in `actor.py` to call role validation before persisting, raising a `ValidationError` on invalid roles - [ ] Write BDD unit test scenarios (Behave/Gherkin) covering: valid role accepted, invalid role rejected with `ValidationError` - [ ] Write Robot Framework integration test covering the CLI `actor add` and `actor update` commands with an invalid role - [ ] Ensure all nox stages pass ## Definition of Done - [ ] `add` command raises `ValidationError` (or equivalent CLI error) when an invalid actor role is supplied - [ ] `update` command raises `ValidationError` (or equivalent CLI error) when an invalid actor role is supplied - [ ] BDD unit test scenarios written and passing - [ ] Robot Framework integration test written and passing - [ ] All nox stages pass - [ ] Coverage >= 97% > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.2.0. 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: Bug Hunting | 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.

Blocks
#392 Epic: Actor YAML & Compiler
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3758
No description provided.