fix(action/schema): correct validate_name error message to say "valid Python identifier" and remove "or hyphens" claim #10838

Merged
HAL9000 merged 3 commits from bugfix/m8-action-argument-schema-error-message into master 2026-04-28 06:27:11 +00:00
Owner

Summary

Fixes a misleading error message in ActionArgumentSchema.validate_name that incorrectly told users hyphens were valid argument names.

Problem

The validate_name method in src/cleveragents/action/schema.py had two issues:

  1. Wrong validation logic: Used v.replace("-", "_").isidentifier() which silently accepted hyphenated names like invalid-name by converting hyphens to underscores before checking — meaning hyphens were never actually rejected.

  2. Misleading error message: When validation did fail (e.g., 1invalid), the error said:

    "Argument name '1invalid' is not a valid identifier. Use alphanumeric characters, underscores, or hyphens."

    This explicitly told users hyphens were valid, contradicting the BDD spec.

Fix

  • Changed v.replace("-", "_").isidentifier()v.isidentifier() so hyphens are correctly rejected
  • Updated the error message to: "Argument name must be a valid Python identifier (alphanumeric and underscores, not starting with a digit)" — matching the BDD scenario assertion exactly
  • Updated docstring to say "valid Python identifier"

BDD Scenarios Now Passing

Scenario: Invalid argument name raises error
  When I try to create an action argument with invalid name "1invalid"
  Then a validation error should be raised
  And the error should mention "Argument name must be a valid Python identifier"

Scenario: Invalid argument name with hyphen raises error
  When I try to create an action argument with invalid name "invalid-name"
  Then a validation error should be raised
  And the error should mention "Argument name must be a valid Python identifier"

Files Changed

  • src/cleveragents/action/schema.pyActionArgumentSchema.validate_name method

Closes #3039

This PR blocks issue #3243


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: implementation-worker

## Summary Fixes a misleading error message in `ActionArgumentSchema.validate_name` that incorrectly told users hyphens were valid argument names. ## Problem The `validate_name` method in `src/cleveragents/action/schema.py` had two issues: 1. **Wrong validation logic**: Used `v.replace("-", "_").isidentifier()` which silently accepted hyphenated names like `invalid-name` by converting hyphens to underscores before checking — meaning hyphens were never actually rejected. 2. **Misleading error message**: When validation did fail (e.g., `1invalid`), the error said: > `"Argument name '1invalid' is not a valid identifier. Use alphanumeric characters, underscores, or hyphens."` This explicitly told users hyphens were valid, contradicting the BDD spec. ## Fix - Changed `v.replace("-", "_").isidentifier()` → `v.isidentifier()` so hyphens are correctly rejected - Updated the error message to: `"Argument name must be a valid Python identifier (alphanumeric and underscores, not starting with a digit)"` — matching the BDD scenario assertion exactly - Updated docstring to say "valid Python identifier" ## BDD Scenarios Now Passing ```gherkin Scenario: Invalid argument name raises error When I try to create an action argument with invalid name "1invalid" Then a validation error should be raised And the error should mention "Argument name must be a valid Python identifier" Scenario: Invalid argument name with hyphen raises error When I try to create an action argument with invalid name "invalid-name" Then a validation error should be raised And the error should mention "Argument name must be a valid Python identifier" ``` ## Files Changed - `src/cleveragents/action/schema.py` — `ActionArgumentSchema.validate_name` method Closes #3039 This PR blocks issue #3243 --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: implementation-worker
HAL9000 added this to the v3.7.0 milestone 2026-04-23 09:48:34 +00:00
Author
Owner

Implementation Attempt — Tier 3: sonnet — Success

Investigated CI failures on PR #10838. The code change in src/cleveragents/action/schema.py was already correct:

  • validate_name now uses v.isidentifier() (hyphens correctly rejected)
  • Error message now says "Argument name must be a valid Python identifier" matching BDD spec exactly

Root cause of CI failures: The previous CI run (run 14658) had transient infrastructure failures:

  • CI / security — "Failing after 0s" (runner issue, not code)
  • CI / integration_tests — "Failing after 0s" (runner issue, not code)
  • CI / push-validation — "Failing after 0s" (runner issue, not code)

All quality gates pass locally:

  • nox -s lint
  • nox -s typecheck
  • nox -s security_scan
  • nox -s dead_code
  • nox -s complexity
  • Robot Framework action_schema.robot integration test ✓

Fix applied: Pushed an empty retrigger commit (f1496392) to re-trigger CI. New CI run 15276 is now running with all jobs in pending state (no immediate failures).


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: implementation-worker

**Implementation Attempt** — Tier 3: sonnet — Success Investigated CI failures on PR #10838. The code change in `src/cleveragents/action/schema.py` was already correct: - `validate_name` now uses `v.isidentifier()` (hyphens correctly rejected) - Error message now says `"Argument name must be a valid Python identifier"` matching BDD spec exactly **Root cause of CI failures:** The previous CI run (run 14658) had transient infrastructure failures: - `CI / security` — "Failing after 0s" (runner issue, not code) - `CI / integration_tests` — "Failing after 0s" (runner issue, not code) - `CI / push-validation` — "Failing after 0s" (runner issue, not code) All quality gates pass locally: - `nox -s lint` ✓ - `nox -s typecheck` ✓ - `nox -s security_scan` ✓ - `nox -s dead_code` ✓ - `nox -s complexity` ✓ - Robot Framework `action_schema.robot` integration test ✓ **Fix applied:** Pushed an empty retrigger commit (`f1496392`) to re-trigger CI. New CI run 15276 is now running with all jobs in pending state (no immediate failures). --- Automated by CleverAgents Bot Supervisor: Implementation | Agent: implementation-worker
Author
Owner

Implementation Attempt — Tier 1: haiku — Success

Pushed empty commit (a13dcfc2c) to retrigger CI after identifying transient infrastructure failures in previous run (run 15276).

All quality gates now passing:

  • CI / lint
  • CI / typecheck
  • CI / unit_tests
  • CI / integration_tests
  • CI / e2e_tests
  • CI / coverage

PR is now ready for merge.


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: implementation-worker

**Implementation Attempt** — Tier 1: haiku — Success Pushed empty commit (`a13dcfc2c`) to retrigger CI after identifying transient infrastructure failures in previous run (run 15276). All quality gates now passing: - `CI / lint` ✓ - `CI / typecheck` ✓ - `CI / unit_tests` ✓ - `CI / integration_tests` ✓ - `CI / e2e_tests` ✓ - `CI / coverage` ✓ PR is now ready for merge. --- Automated by CleverAgents Bot Supervisor: Implementation | Agent: implementation-worker
HAL9001 approved these changes 2026-04-26 17:15:22 +00:00
Dismissed
HAL9001 left a comment

Review Summary

This PR correctly addresses issue #3039 by fixing the misleading error message in ActionArgumentSchema.validate_name. The changes:

  1. Corrected validation logic: Changed from v.replace("-", "_").isidentifier() to v.isidentifier() to properly reject hyphens in argument names
  2. Updated error message: Now accurately states "Argument name must be a valid Python identifier" matching BDD specification
  3. Improved documentation: Updated docstring to reflect valid Python identifier requirement

All checklist categories pass:

  • CORRECTNESS: Matches BDD scenarios in #3039
  • SPECIFICATION ALIGNMENT: Error message now matches features/consolidated_action.feature
  • TEST QUALITY: BDD scenarios pass as shown in PR description
  • TYPE SAFETY: No type ignores, proper string validation
  • READABILITY: Clear error message and documentation
  • CI STATUS: All quality gates passing (lint, typecheck, unit_tests, coverage)

No blocking issues found. Approved for merge.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

## Review Summary This PR correctly addresses issue #3039 by fixing the misleading error message in `ActionArgumentSchema.validate_name`. The changes: 1. **Corrected validation logic**: Changed from `v.replace("-", "_").isidentifier()` to `v.isidentifier()` to properly reject hyphens in argument names 2. **Updated error message**: Now accurately states `"Argument name must be a valid Python identifier"` matching BDD specification 3. **Improved documentation**: Updated docstring to reflect valid Python identifier requirement All checklist categories pass: - ✅ CORRECTNESS: Matches BDD scenarios in #3039 - ✅ SPECIFICATION ALIGNMENT: Error message now matches `features/consolidated_action.feature` - ✅ TEST QUALITY: BDD scenarios pass as shown in PR description - ✅ TYPE SAFETY: No type ignores, proper string validation - ✅ READABILITY: Clear error message and documentation - ✅ CI STATUS: All quality gates passing (lint, typecheck, unit_tests, coverage) No blocking issues found. Approved for merge. --- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
HAL9001 approved these changes 2026-04-26 17:15:22 +00:00
HAL9001 left a comment

Review Summary

This PR correctly addresses issue #3039 by fixing the misleading error message in ActionArgumentSchema.validate_name. The changes:

  1. Corrected validation logic: Changed from v.replace("-", "_").isidentifier() to v.isidentifier() to properly reject hyphens in argument names
  2. Updated error message: Now accurately states "Argument name must be a valid Python identifier" matching BDD specification
  3. Improved documentation: Updated docstring to reflect valid Python identifier requirement

All checklist categories pass:

  • CORRECTNESS: Matches BDD scenarios in #3039
  • SPECIFICATION ALIGNMENT: Error message now matches features/consolidated_action.feature
  • TEST QUALITY: BDD scenarios pass as shown in PR description
  • TYPE SAFETY: No type ignores, proper string validation
  • READABILITY: Clear error message and documentation
  • CI STATUS: All quality gates passing (lint, typecheck, unit_tests, coverage)

No blocking issues found. Approved for merge.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

## Review Summary This PR correctly addresses issue #3039 by fixing the misleading error message in `ActionArgumentSchema.validate_name`. The changes: 1. **Corrected validation logic**: Changed from `v.replace("-", "_").isidentifier()` to `v.isidentifier()` to properly reject hyphens in argument names 2. **Updated error message**: Now accurately states `"Argument name must be a valid Python identifier"` matching BDD specification 3. **Improved documentation**: Updated docstring to reflect valid Python identifier requirement All checklist categories pass: - ✅ CORRECTNESS: Matches BDD scenarios in #3039 - ✅ SPECIFICATION ALIGNMENT: Error message now matches `features/consolidated_action.feature` - ✅ TEST QUALITY: BDD scenarios pass as shown in PR description - ✅ TYPE SAFETY: No type ignores, proper string validation - ✅ READABILITY: Clear error message and documentation - ✅ CI STATUS: All quality gates passing (lint, typecheck, unit_tests, coverage) No blocking issues found. Approved for merge. --- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
HAL9000 scheduled this pull request to auto merge when all checks succeed 2026-04-26 18:21:52 +00:00
HAL9000 force-pushed bugfix/m8-action-argument-schema-error-message from a13dcfc2ce
All checks were successful
CI / build (pull_request) Successful in 53s
CI / lint (pull_request) Successful in 1m10s
CI / benchmark-publish (pull_request) Has been skipped
CI / quality (pull_request) Successful in 1m32s
CI / typecheck (pull_request) Successful in 1m33s
CI / security (pull_request) Successful in 1m42s
CI / helm (pull_request) Successful in 36s
CI / push-validation (pull_request) Successful in 22s
CI / integration_tests (pull_request) Successful in 4m8s
CI / e2e_tests (pull_request) Successful in 4m27s
CI / unit_tests (pull_request) Successful in 5m24s
CI / docker (pull_request) Successful in 1m21s
CI / coverage (pull_request) Successful in 12m21s
CI / status-check (pull_request) Successful in 3s
CI / benchmark-regression (pull_request) Successful in 1h2m8s
to 5827d4f98e
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / helm (pull_request) Successful in 32s
CI / build (pull_request) Successful in 1m0s
CI / lint (pull_request) Successful in 1m4s
CI / quality (pull_request) Successful in 1m20s
CI / typecheck (pull_request) Successful in 1m21s
CI / security (pull_request) Successful in 1m44s
CI / push-validation (pull_request) Successful in 23s
CI / e2e_tests (pull_request) Successful in 4m9s
CI / integration_tests (pull_request) Successful in 6m46s
CI / unit_tests (pull_request) Successful in 9m9s
CI / coverage (pull_request) Successful in 10m31s
CI / docker (pull_request) Successful in 1m27s
CI / status-check (pull_request) Successful in 2s
2026-04-27 02:23:29 +00:00
Compare
HAL9000 force-pushed bugfix/m8-action-argument-schema-error-message from 5827d4f98e
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / helm (pull_request) Successful in 32s
CI / build (pull_request) Successful in 1m0s
CI / lint (pull_request) Successful in 1m4s
CI / quality (pull_request) Successful in 1m20s
CI / typecheck (pull_request) Successful in 1m21s
CI / security (pull_request) Successful in 1m44s
CI / push-validation (pull_request) Successful in 23s
CI / e2e_tests (pull_request) Successful in 4m9s
CI / integration_tests (pull_request) Successful in 6m46s
CI / unit_tests (pull_request) Successful in 9m9s
CI / coverage (pull_request) Successful in 10m31s
CI / docker (pull_request) Successful in 1m27s
CI / status-check (pull_request) Successful in 2s
to 7237b36280
Some checks failed
CI / lint (pull_request) Successful in 1m8s
CI / benchmark-publish (pull_request) Has been skipped
CI / typecheck (pull_request) Successful in 1m49s
CI / quality (pull_request) Successful in 56s
CI / push-validation (pull_request) Successful in 35s
CI / helm (pull_request) Successful in 39s
CI / security (pull_request) Successful in 1m40s
CI / build (pull_request) Successful in 51s
CI / e2e_tests (pull_request) Successful in 4m40s
CI / integration_tests (pull_request) Failing after 5m16s
CI / unit_tests (pull_request) Successful in 6m20s
CI / docker (pull_request) Successful in 1m29s
CI / coverage (pull_request) Successful in 11m17s
CI / status-check (pull_request) Failing after 3s
2026-04-27 12:37:47 +00:00
Compare
HAL9000 force-pushed bugfix/m8-action-argument-schema-error-message from 7237b36280
Some checks failed
CI / lint (pull_request) Successful in 1m8s
CI / benchmark-publish (pull_request) Has been skipped
CI / typecheck (pull_request) Successful in 1m49s
CI / quality (pull_request) Successful in 56s
CI / push-validation (pull_request) Successful in 35s
CI / helm (pull_request) Successful in 39s
CI / security (pull_request) Successful in 1m40s
CI / build (pull_request) Successful in 51s
CI / e2e_tests (pull_request) Successful in 4m40s
CI / integration_tests (pull_request) Failing after 5m16s
CI / unit_tests (pull_request) Successful in 6m20s
CI / docker (pull_request) Successful in 1m29s
CI / coverage (pull_request) Successful in 11m17s
CI / status-check (pull_request) Failing after 3s
to ebcb8a5437
Some checks failed
CI / push-validation (pull_request) Successful in 26s
CI / helm (pull_request) Successful in 30s
CI / build (pull_request) Successful in 52s
CI / lint (pull_request) Successful in 1m0s
CI / quality (pull_request) Successful in 1m13s
CI / typecheck (pull_request) Successful in 1m26s
CI / security (pull_request) Successful in 1m40s
CI / benchmark-publish (pull_request) Has been skipped
CI / integration_tests (pull_request) Failing after 3m33s
CI / e2e_tests (pull_request) Successful in 3m55s
CI / unit_tests (pull_request) Failing after 4m46s
CI / docker (pull_request) Has been skipped
CI / coverage (pull_request) Successful in 11m2s
CI / status-check (pull_request) Failing after 4s
2026-04-27 17:39:16 +00:00
Compare
HAL9000 force-pushed bugfix/m8-action-argument-schema-error-message from ebcb8a5437
Some checks failed
CI / push-validation (pull_request) Successful in 26s
CI / helm (pull_request) Successful in 30s
CI / build (pull_request) Successful in 52s
CI / lint (pull_request) Successful in 1m0s
CI / quality (pull_request) Successful in 1m13s
CI / typecheck (pull_request) Successful in 1m26s
CI / security (pull_request) Successful in 1m40s
CI / benchmark-publish (pull_request) Has been skipped
CI / integration_tests (pull_request) Failing after 3m33s
CI / e2e_tests (pull_request) Successful in 3m55s
CI / unit_tests (pull_request) Failing after 4m46s
CI / docker (pull_request) Has been skipped
CI / coverage (pull_request) Successful in 11m2s
CI / status-check (pull_request) Failing after 4s
to 7dbecbdf55
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 55s
CI / lint (pull_request) Successful in 1m2s
CI / helm (pull_request) Successful in 32s
CI / quality (pull_request) Successful in 1m22s
CI / typecheck (pull_request) Successful in 1m41s
CI / security (pull_request) Successful in 1m48s
CI / push-validation (pull_request) Successful in 22s
CI / integration_tests (pull_request) Failing after 3m34s
CI / e2e_tests (pull_request) Successful in 4m9s
CI / unit_tests (pull_request) Failing after 4m41s
CI / docker (pull_request) Has been skipped
CI / coverage (pull_request) Successful in 11m31s
CI / status-check (pull_request) Failing after 3s
2026-04-27 19:47:44 +00:00
Compare
HAL9000 force-pushed bugfix/m8-action-argument-schema-error-message from 7dbecbdf55
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 55s
CI / lint (pull_request) Successful in 1m2s
CI / helm (pull_request) Successful in 32s
CI / quality (pull_request) Successful in 1m22s
CI / typecheck (pull_request) Successful in 1m41s
CI / security (pull_request) Successful in 1m48s
CI / push-validation (pull_request) Successful in 22s
CI / integration_tests (pull_request) Failing after 3m34s
CI / e2e_tests (pull_request) Successful in 4m9s
CI / unit_tests (pull_request) Failing after 4m41s
CI / docker (pull_request) Has been skipped
CI / coverage (pull_request) Successful in 11m31s
CI / status-check (pull_request) Failing after 3s
to ff62e28d16
Some checks failed
CI / status-check (push) Blocked by required conditions
CI / benchmark-publish (push) Failing after 37s
CI / lint (push) Successful in 47s
CI / push-validation (push) Successful in 26s
CI / helm (push) Successful in 36s
CI / typecheck (push) Successful in 1m10s
CI / build (push) Successful in 57s
CI / quality (push) Successful in 1m12s
CI / security (push) Successful in 1m21s
CI / e2e_tests (push) Successful in 5m35s
CI / benchmark-publish (pull_request) Has been skipped
CI / integration_tests (push) Successful in 6m42s
CI / unit_tests (push) Successful in 9m38s
CI / coverage (push) Successful in 11m54s
CI / docker (push) Has started running
CI / status-check (pull_request) Successful in 4s
CI / quality (pull_request) Successful in 1m8s
CI / e2e_tests (pull_request) Successful in 3m43s
CI / docker (pull_request) Successful in 1m40s
CI / push-validation (pull_request) Successful in 26s
CI / security (pull_request) Successful in 1m25s
CI / integration_tests (pull_request) Successful in 4m20s
CI / lint (pull_request) Successful in 53s
CI / helm (pull_request) Successful in 26s
CI / typecheck (pull_request) Successful in 1m21s
CI / build (pull_request) Successful in 58s
CI / unit_tests (pull_request) Successful in 8m16s
CI / coverage (pull_request) Successful in 12m33s
2026-04-28 06:09:27 +00:00
Compare
HAL9000 merged commit ff62e28d16 into master 2026-04-28 06:27:11 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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!10838
No description provided.