Files
cleveragents-core/features/plan_namespaced_name_validation.feature
HAL9000 37e7fb4612 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
2026-06-03 00:24:21 -04:00

45 lines
2.2 KiB
Gherkin

Feature: NamespacedName validation
Verify that NamespacedName enforces spec-required naming rules:
namespace and name components must start with a letter (not a digit).
# ---------------------------------------------------------------
# TDD for issue #2145/#2147: Names must start with a letter
# ---------------------------------------------------------------
@tdd_issue @tdd_issue_2145 @tdd_issue_2147
Scenario: NamespacedName.parse() rejects namespace starting with a digit
When I parse the namespaced name "123abc/my-action" expecting an error
Then a ValueError 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 name starting with a digit
When I construct a NamespacedName with namespace "local" and name "123-action" expecting an error
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 Pydantic ValidationError should be raised
And the error message should contain "must start with a letter"
# ---------------------------------------------------------------
# Positive cases: Valid names (start with letter)
# ---------------------------------------------------------------
Scenario: NamespacedName.parse() accepts namespace starting with a letter
When I parse the namespaced name "abc123/my-action"
Then the parsed namespace should be "abc123"
And the parsed item name should be "my-action"
Scenario: NamespacedName.parse() accepts name starting with a letter
When I parse the namespaced name "local/a123-action"
Then the parsed namespace should be "local"
And the parsed item name should be "a123-action"
Scenario: NamespacedName constructor accepts valid kebab-case names
Given I have a namespaced name with namespace "my-org" and name "my-action"
Then the parsed namespace should be "my-org"
And the parsed item name should be "my-action"