Files
cleveragents-core/features/plan_namespaced_name_validation.feature
freemo 33c1e4cd1a test(plan): add TDD issue-capture test for NamespacedName digit-start validation bug
This TDD test captures the buggy behavior where `NamespacedName.validate_namespace()`
and `validate_name()` accept names starting with digits, violating the spec requirement
that namespace and name components must start with a letter (consistent with
`_BARE_NAME_RE` in project.py).

Three failing scenarios demonstrate the bug:
1. parse() accepting namespace starting with digit ("123abc/my-action")
2. constructor accepting name starting with digit (local/"123-action")
3. constructor accepting namespace starting with digit ("999org"/valid-name)

Tagged with @tdd_expected_fail per Bug Fix Workflow.

Implements #2145
Blocks #2147
2026-04-03 13:38:33 -04:00

45 lines
2.3 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 @tdd_expected_fail
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 @tdd_expected_fail
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
And the error message should contain "must start with a letter"
@tdd_issue @tdd_issue_2145 @tdd_issue_2147 @tdd_expected_fail
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
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"