UAT: NamespacedName in plan.py does not enforce provider namespace restrictions — actions and plans can be created with reserved openai/, anthropic/ namespaces #2939

Open
opened 2026-04-05 02:52:32 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/namespaced-name-provider-namespace-restriction
  • Commit Message: fix(plan): enforce provider namespace restrictions in NamespacedName.validate_namespace()
  • Milestone: v3.7.0
  • Parent Epic: #394

Description

The spec states that built-in LLM actor provider namespaces (openai/, anthropic/, google/, etc.) are reserved and cannot be used for custom entities. The project.py module correctly enforces this via PROVIDER_NAMESPACES frozenset in both parse_namespaced_name() and NamespacedProject.validate_namespace(). However, NamespacedName in plan.py — which is used for Actions and Plans — has no such restriction, allowing actions and plans to be created with provider-reserved namespaces.

Code Locations

  • src/cleveragents/domain/models/core/plan.py, lines 219–228: NamespacedName.validate_namespace() — only checks alphanumeric+hyphens, no provider namespace restriction
  • src/cleveragents/domain/models/core/project.py, lines 51–63: PROVIDER_NAMESPACES frozenset correctly defined but not imported/used in plan.py
  • src/cleveragents/domain/models/core/action.py, line 350: LifecycleAction.namespaced_name uses NamespacedName from plan.py

Expected Behaviour

NamespacedName.validate_namespace() should reject provider-reserved namespaces (openai, anthropic, google, gemini, deepseek, mistral, perplexity, qwen, amazon) with a clear error message, consistent with NamespacedProject.validate_namespace() in project.py.

Actual Behaviour

NamespacedName(namespace="openai", name="my-action") succeeds without error, allowing actions and plans to be created with provider-reserved namespaces.

Steps to Reproduce

from cleveragents.domain.models.core.plan import NamespacedName
# This should raise ValueError but doesn't:
nn = NamespacedName(namespace="openai", name="my-action")
print(nn)  # Prints: openai/my-action — should be rejected

Subtasks

  • Import or duplicate PROVIDER_NAMESPACES in plan.py (or import from project.py)
  • Add provider namespace check to NamespacedName.validate_namespace() with clear error message matching the style used in NamespacedProject.validate_namespace()
  • Add Behave scenarios covering rejection of provider-reserved namespaces for actions and plans
  • Run nox -e typecheck to confirm no type regressions
  • Run nox (all default sessions) and fix any errors

Definition of Done

  • NamespacedName(namespace="openai", name="my-action") raises ValidationError
  • NamespacedName(namespace="anthropic", name="my-plan") raises ValidationError
  • NamespacedName(namespace="local", name="my-action") still succeeds
  • NamespacedName(namespace="myorg", name="my-action") still succeeds
  • Behave scenarios added covering provider namespace rejection for both actions and plans
  • All nox stages pass
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/namespaced-name-provider-namespace-restriction` - **Commit Message**: `fix(plan): enforce provider namespace restrictions in NamespacedName.validate_namespace()` - **Milestone**: v3.7.0 - **Parent Epic**: #394 ## Description The spec states that built-in LLM actor provider namespaces (`openai/`, `anthropic/`, `google/`, etc.) are reserved and cannot be used for custom entities. The `project.py` module correctly enforces this via `PROVIDER_NAMESPACES` frozenset in both `parse_namespaced_name()` and `NamespacedProject.validate_namespace()`. However, `NamespacedName` in `plan.py` — which is used for Actions and Plans — has no such restriction, allowing actions and plans to be created with provider-reserved namespaces. ### Code Locations - `src/cleveragents/domain/models/core/plan.py`, lines 219–228: `NamespacedName.validate_namespace()` — only checks alphanumeric+hyphens, no provider namespace restriction - `src/cleveragents/domain/models/core/project.py`, lines 51–63: `PROVIDER_NAMESPACES` frozenset correctly defined but not imported/used in `plan.py` - `src/cleveragents/domain/models/core/action.py`, line 350: `LifecycleAction.namespaced_name` uses `NamespacedName` from `plan.py` ### Expected Behaviour `NamespacedName.validate_namespace()` should reject provider-reserved namespaces (`openai`, `anthropic`, `google`, `gemini`, `deepseek`, `mistral`, `perplexity`, `qwen`, `amazon`) with a clear error message, consistent with `NamespacedProject.validate_namespace()` in `project.py`. ### Actual Behaviour `NamespacedName(namespace="openai", name="my-action")` succeeds without error, allowing actions and plans to be created with provider-reserved namespaces. ### Steps to Reproduce ```python from cleveragents.domain.models.core.plan import NamespacedName # This should raise ValueError but doesn't: nn = NamespacedName(namespace="openai", name="my-action") print(nn) # Prints: openai/my-action — should be rejected ``` ## Subtasks - [ ] Import or duplicate `PROVIDER_NAMESPACES` in `plan.py` (or import from `project.py`) - [ ] Add provider namespace check to `NamespacedName.validate_namespace()` with clear error message matching the style used in `NamespacedProject.validate_namespace()` - [ ] Add Behave scenarios covering rejection of provider-reserved namespaces for actions and plans - [ ] Run `nox -e typecheck` to confirm no type regressions - [ ] Run `nox` (all default sessions) and fix any errors ## Definition of Done - [ ] `NamespacedName(namespace="openai", name="my-action")` raises `ValidationError` - [ ] `NamespacedName(namespace="anthropic", name="my-plan")` raises `ValidationError` - [ ] `NamespacedName(namespace="local", name="my-action")` still succeeds - [ ] `NamespacedName(namespace="myorg", name="my-action")` still succeeds - [ ] Behave scenarios added covering provider namespace rejection for both actions and plans - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.7.0 milestone 2026-04-05 02:52:45 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Confirmed
  • MoSCoW: Should Have

Valid finding verified during batch triage.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Confirmed - **MoSCoW**: Should Have Valid finding verified during batch triage. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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.

Blocks
#394 Epic: Decision Framework
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#2939
No description provided.