UAT: NamespacedName and ParsedName do not reject server:local/name format — local/ namespace with server prefix should be invalid per spec #2972

Open
opened 2026-04-05 03:00:14 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/namespaced-name-reject-server-local
  • Commit Message: fix(domain): reject server:local/ combination in NamespacedName and ParsedName
  • Milestone: v3.7.0
  • Parent Epic: #399

Background

The spec states that the local/ namespace is "reserved for local-only items" that "exist only on the current machine." This means local/ entities are inherently local and cannot be associated with a server. However, neither NamespacedName in plan.py nor ParsedName/parse_namespaced_name() in project.py reject the combination of a server prefix with the local/ namespace (e.g., prod:local/my-action).

Current Behavior

from cleveragents.domain.models.core.plan import NamespacedName
# This should raise ValueError but doesn't:
nn = NamespacedName.parse("prod:local/my-action")
print(nn.server)     # "prod"
print(nn.namespace)  # "local"
# No error raised — invalid combination accepted

Affected code locations:

  • src/cleveragents/domain/models/core/plan.py: NamespacedName.parse("prod:local/my-action") succeeds, returning server="prod", namespace="local", name="my-action" — no validation error
  • src/cleveragents/domain/models/core/project.py: parse_namespaced_name("prod:local/my-project") succeeds, returning ParsedName(server="prod", namespace="local", name="my-project") — no validation error
  • src/cleveragents/domain/models/core/project.py: ParsedName.is_local returns False when server is not None, even if namespace == "local" — this is correct detection but no validation prevents the combination

Expected Behavior

Any name with server:local/... format should be rejected with a clear ValueError explaining that local/ namespace entities cannot be server-qualified.

  • NamespacedName.parse("prod:local/my-action") raises ValueError
  • parse_namespaced_name("prod:local/my-project") raises ValueError
  • NamespacedName.parse("local/my-action") still succeeds (no server prefix — valid)
  • NamespacedName.parse("prod:myorg/my-action") still succeeds (non-local namespace with server — valid)

Subtasks

  • Add cross-field validation to NamespacedName (model_validator) that rejects server + local combination
  • Add cross-field validation to ParsedName (model_validator) that rejects server + local combination
  • Update parse_namespaced_name() to reject server:local/name format
  • Add Behave scenarios covering rejection of server:local/name format
  • Run nox -e typecheck to confirm no type regressions
  • Run nox (all default sessions), fix any errors

Definition of Done

  • NamespacedName.parse("prod:local/my-action") raises ValueError
  • parse_namespaced_name("prod:local/my-project") raises ValueError
  • NamespacedName.parse("local/my-action") still succeeds (no server prefix)
  • NamespacedName.parse("prod:myorg/my-action") still succeeds (non-local namespace with server)
  • Behave scenarios added covering the new validation
  • All nox stages pass
  • Coverage >= 97%

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

## Metadata - **Branch**: `fix/namespaced-name-reject-server-local` - **Commit Message**: `fix(domain): reject server:local/ combination in NamespacedName and ParsedName` - **Milestone**: v3.7.0 - **Parent Epic**: #399 ## Background The spec states that the `local/` namespace is "reserved for local-only items" that "exist only on the current machine." This means `local/` entities are inherently local and cannot be associated with a server. However, neither `NamespacedName` in `plan.py` nor `ParsedName`/`parse_namespaced_name()` in `project.py` reject the combination of a server prefix with the `local/` namespace (e.g., `prod:local/my-action`). ## Current Behavior ```python from cleveragents.domain.models.core.plan import NamespacedName # This should raise ValueError but doesn't: nn = NamespacedName.parse("prod:local/my-action") print(nn.server) # "prod" print(nn.namespace) # "local" # No error raised — invalid combination accepted ``` **Affected code locations:** - `src/cleveragents/domain/models/core/plan.py`: `NamespacedName.parse("prod:local/my-action")` succeeds, returning `server="prod"`, `namespace="local"`, `name="my-action"` — no validation error - `src/cleveragents/domain/models/core/project.py`: `parse_namespaced_name("prod:local/my-project")` succeeds, returning `ParsedName(server="prod", namespace="local", name="my-project")` — no validation error - `src/cleveragents/domain/models/core/project.py`: `ParsedName.is_local` returns `False` when `server is not None`, even if `namespace == "local"` — this is correct detection but no validation prevents the combination ## Expected Behavior Any name with `server:local/...` format should be rejected with a clear `ValueError` explaining that `local/` namespace entities cannot be server-qualified. - `NamespacedName.parse("prod:local/my-action")` raises `ValueError` - `parse_namespaced_name("prod:local/my-project")` raises `ValueError` - `NamespacedName.parse("local/my-action")` still succeeds (no server prefix — valid) - `NamespacedName.parse("prod:myorg/my-action")` still succeeds (non-local namespace with server — valid) ## Subtasks - [ ] Add cross-field validation to `NamespacedName` (model_validator) that rejects `server + local` combination - [ ] Add cross-field validation to `ParsedName` (model_validator) that rejects `server + local` combination - [ ] Update `parse_namespaced_name()` to reject `server:local/name` format - [ ] Add Behave scenarios covering rejection of `server:local/name` format - [ ] Run `nox -e typecheck` to confirm no type regressions - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done - [ ] `NamespacedName.parse("prod:local/my-action")` raises `ValueError` - [ ] `parse_namespaced_name("prod:local/my-project")` raises `ValueError` - [ ] `NamespacedName.parse("local/my-action")` still succeeds (no server prefix) - [ ] `NamespacedName.parse("prod:myorg/my-action")` still succeeds (non-local namespace with server) - [ ] Behave scenarios added covering the new validation - [ ] 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 03:00:25 +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
#399 Epic: Post-MVP Server & Clients
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#2972
No description provided.