action: ActionArgumentSchema validation_pattern not validated as valid regex #10539

Open
opened 2026-04-18 17:07:19 +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 validation_pattern field that accepts any string without validating that it's a valid regex pattern. If an invalid regex is provided, it will cause a runtime error when the pattern is used for validation, rather than failing at schema validation time.

Expected Behavior

The validation_pattern field should validate that the provided string is a valid regex pattern. Invalid regex patterns should be rejected at schema validation time with a clear error message.

Acceptance Criteria

  • ActionArgumentSchema validates validation_pattern as valid regex
  • Invalid regex patterns raise ValidationError at schema validation time
  • Valid regex patterns are accepted
  • Existing tests pass with validation added
  • New tests verify regex validation

Subtasks

  • Add validator to ActionArgumentSchema for validation_pattern field
  • Implement regex compilation check (try re.compile(pattern))
  • Add test cases for valid regex patterns
  • Add test cases for invalid regex patterns
  • Update error messages to show regex compilation error details

Definition of Done

  • ActionArgumentSchema validates validation_pattern as valid regex
  • Invalid regex patterns 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 `validation_pattern` field that accepts any string without validating that it's a valid regex pattern. If an invalid regex is provided, it will cause a runtime error when the pattern is used for validation, rather than failing at schema validation time. ## Expected Behavior The validation_pattern field should validate that the provided string is a valid regex pattern. Invalid regex patterns should be rejected at schema validation time with a clear error message. ## Acceptance Criteria - [ ] ActionArgumentSchema validates validation_pattern as valid regex - [ ] Invalid regex patterns raise ValidationError at schema validation time - [ ] Valid regex patterns are accepted - [ ] Existing tests pass with validation added - [ ] New tests verify regex validation ## Subtasks - [ ] Add validator to ActionArgumentSchema for validation_pattern field - [ ] Implement regex compilation check (try re.compile(pattern)) - [ ] Add test cases for valid regex patterns - [ ] Add test cases for invalid regex patterns - [ ] Update error messages to show regex compilation error details ## Definition of Done - ActionArgumentSchema validates validation_pattern as valid regex - Invalid regex patterns 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#10539
No description provided.