From 37e7fb461258e6dfee4acefa837ab2350bbf40fd Mon Sep 17 00:00:00 2001 From: CleverThis Date: Tue, 2 Jun 2026 23:20:03 -0400 Subject: [PATCH] fix(plan): NamespacedName digit-start validation BDD scenarios Remove @tdd_expected_fail tags from the 3 NamespacedName validation scenarios and fix step mismatch that caused 2 constructor scenarios to fail. Constructor scenarios now use the existing "a Pydantic ValidationError should be raised" step (context_strategy_registry_steps) which correctly checks pydantic.ValidationError instead of the project's cleveragents.core.exceptions.ValidationError. Also remove the duplicate @then step accidentally left in plan_namespaced_name_tdd_steps.py (would have caused NameError since the `then` import was already removed). ISSUES CLOSED: #2145, #2147, #8799 --- CHANGELOG.md | 1 + features/plan_namespaced_name_validation.feature | 4 ++-- features/steps/plan_namespaced_name_tdd_steps.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27a30e7a3..aab6227ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Changed `wf10_batch.robot` to be less likely to create files, and `plan_generation_graph.robot` to give more test answers. ## [Unreleased] +- **fix(plan): NamespacedName digit-start validation** (#2145, #2147): `NamespacedName` field validators now reject `namespace` and `name` components whose first character is a digit, raising `pydantic.ValidationError` with message `"must start with a letter"`. BDD constructor scenarios updated to use the `"a Pydantic ValidationError should be raised"` step so the assertion correctly matches the exception type raised by Pydantic model construction. - **fix(cli/plan): plan correct JSON output envelope fix and BDD test coverage** (#8584 / PR #8662): Restructured `agents plan correct --format json` output to nest correction fields under `data.correction` (e.g., `data.correction.mode`) and populate the spec-required CLI envelope with `command="plan correct"`, `status`, `exit_code`, `timing`, and `messages` fields. Added three BDD scenarios in `features/tdd_plan_correct_json_output.feature` validating the envelope structure for both revert and append modes. - **fix(cli): add --url flag to resource add for git resource type** (#6322): Added support for the `--url` flag on `agents resource add git` command, allowing users to specify a remote URL for git resources. The flag is validated to only apply to git resource types. Includes Behave BDD tests in `features/resource_cli_git_url_flag.feature` and Robot Framework integration tests verifying correct URL validation and CLI behavior. - **Session create JSON envelope** (#6441): Fixed `agents session create --format json` returning a flat `data` dict instead of the spec-required nested structure with `data.session`, `data.settings`, and `data.actor_details` sub-objects. The `command` field is now populated correctly. Extended JSON envelope coverage to `agents session list`, `show`, `delete --format json`, `export --output-format json`, and `import --format json` so all session commands emit a structured `messages[].text` field (`"0 sessions listed"`, `"Session details loaded"`, `"Session deleted"`, `"Export completed"`, `"Import completed"`). diff --git a/features/plan_namespaced_name_validation.feature b/features/plan_namespaced_name_validation.feature index fd665743a..ffd24aa79 100644 --- a/features/plan_namespaced_name_validation.feature +++ b/features/plan_namespaced_name_validation.feature @@ -15,13 +15,13 @@ Feature: NamespacedName validation @tdd_issue @tdd_issue_2145 @tdd_issue_2147 Scenario: NamespacedName constructor rejects name starting with a digit When I construct a NamespacedName with namespace "local" and name "123-action" expecting an error - Then a ValidationError should be raised + Then a Pydantic ValidationError should be raised And the error message should contain "must start with a letter" @tdd_issue @tdd_issue_2145 @tdd_issue_2147 Scenario: NamespacedName constructor rejects namespace starting with a digit When I construct a NamespacedName with namespace "999org" and name "valid-name" expecting an error - Then a ValidationError should be raised + Then a Pydantic ValidationError should be raised And the error message should contain "must start with a letter" # --------------------------------------------------------------- diff --git a/features/steps/plan_namespaced_name_tdd_steps.py b/features/steps/plan_namespaced_name_tdd_steps.py index ca89a2836..660f7b0b4 100644 --- a/features/steps/plan_namespaced_name_tdd_steps.py +++ b/features/steps/plan_namespaced_name_tdd_steps.py @@ -49,3 +49,4 @@ def step_when_construct_namespaced_name_expecting_error( context.error = e context.lsp_error = e context.namespaced_name = None +