action: ActionArgumentSchema default value not validated against type field #10538

Open
opened 2026-04-18 17:07:17 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • Commit: Current HEAD
  • Branch: main
  • File: src/cleveragents/action/schema.py
  • Lines: 330-340

Background and Context

The ActionArgumentSchema class has a default field that accepts multiple types (str, int, float, bool, list[str], None) without validating that the default value matches the specified type field. This allows invalid configurations like type="integer" with default="not_an_integer" to pass validation, only to fail at runtime.

Expected Behavior

The default value should be validated to ensure it matches the type specified in the type field. If type="integer", the default must be an integer. If type="string", the default must be a string, etc.

Acceptance Criteria

  • ActionArgumentSchema validates default value against type field
  • Type mismatch between default and type field raises ValidationError
  • All valid type/default combinations are accepted
  • Existing tests pass with validation added
  • New tests verify type validation for default values

Subtasks

  • Add validator to ActionArgumentSchema for default field
  • Implement type checking logic (compare default type with type field)
  • Add test cases for valid type/default combinations
  • Add test cases for invalid type/default combinations
  • Update error messages to be clear about type mismatch

Definition of Done

  • ActionArgumentSchema validates default value against type field
  • Type mismatches are caught at validation time, not runtime
  • All tests pass
  • Code review approved

Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit**: Current HEAD - **Branch**: main - **File**: src/cleveragents/action/schema.py - **Lines**: 330-340 ## Background and Context The ActionArgumentSchema class has a `default` field that accepts multiple types (str, int, float, bool, list[str], None) without validating that the default value matches the specified `type` field. This allows invalid configurations like type="integer" with default="not_an_integer" to pass validation, only to fail at runtime. ## Expected Behavior The default value should be validated to ensure it matches the type specified in the type field. If type="integer", the default must be an integer. If type="string", the default must be a string, etc. ## Acceptance Criteria - [ ] ActionArgumentSchema validates default value against type field - [ ] Type mismatch between default and type field raises ValidationError - [ ] All valid type/default combinations are accepted - [ ] Existing tests pass with validation added - [ ] New tests verify type validation for default values ## Subtasks - [ ] Add validator to ActionArgumentSchema for default field - [ ] Implement type checking logic (compare default type with type field) - [ ] Add test cases for valid type/default combinations - [ ] Add test cases for invalid type/default combinations - [ ] Update error messages to be clear about type mismatch ## Definition of Done - ActionArgumentSchema validates default value against type field - Type mismatches are caught at validation time, not runtime - All tests pass - Code review approved --- **Automated by CleverAgents Bot** Agent: 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#10538
No description provided.