forked from cleveragents/cleveragents-core
3fe7dabb65
Implement RemoteProjectClient for accessing and executing projects hosted on a remote CleverAgents server: - Remote resource selection and server execution request wiring - Project-name resolution for remote namespaces and server aliases - Resolve project with fallback from custom to default namespace - Remote project caching with configurable TTL (default 5 min) - Explicit ResourceNotFoundError when remote project not found - Cache invalidation per-namespace or global - RemoteProject dataclass with project_id, name, namespace, alias, description - Behave scenarios (16 scenarios, 54 steps) - Robot Framework smoke tests - ASV benchmark for request overhead baseline - Reference documentation at docs/reference/server_remote_projects.md ISSUES CLOSED: #338
116 lines
5.3 KiB
Gherkin
116 lines
5.3 KiB
Gherkin
@phase2 @client @remote-project
|
|
Feature: Remote project support
|
|
As a developer
|
|
I want to access and execute projects hosted on a remote server
|
|
So that I can use remote resources and run plans on the server
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Project listing
|
|
# ---------------------------------------------------------------------------
|
|
|
|
Scenario: List remote projects from server
|
|
Given a RemoteProjectClient with mock projects in default namespace
|
|
When I list remote projects in namespace "default"
|
|
Then I should receive 2 remote projects
|
|
And the first remote project name should be "project-alpha"
|
|
|
|
Scenario: List remote projects uses cache on second call
|
|
Given a RemoteProjectClient with mock projects in default namespace
|
|
When I list remote projects in namespace "default"
|
|
And I list remote projects in namespace "default" again
|
|
Then the HTTP client should have been called once for project listing
|
|
|
|
Scenario: List remote projects with force_refresh bypasses cache
|
|
Given a RemoteProjectClient with mock projects in default namespace
|
|
When I list remote projects in namespace "default"
|
|
And I list remote projects with force_refresh
|
|
Then the HTTP client should have been called twice for project listing
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Project resolution
|
|
# ---------------------------------------------------------------------------
|
|
|
|
Scenario: Get project by name
|
|
Given a RemoteProjectClient with mock projects in default namespace
|
|
When I get remote project "project-alpha" in namespace "default"
|
|
Then the resolved project name should be "project-alpha"
|
|
And the resolved project namespace should be "default"
|
|
|
|
Scenario: Get project by alias
|
|
Given a RemoteProjectClient with mock projects with aliases
|
|
When I get remote project "alpha" in namespace "default"
|
|
Then the resolved project name should be "project-alpha"
|
|
|
|
Scenario: Get project not found raises ResourceNotFoundError
|
|
Given a RemoteProjectClient with mock projects in default namespace
|
|
When I get remote project "nonexistent" in namespace "default" expecting error
|
|
Then a ResourceNotFoundError should be raised for remote project
|
|
|
|
Scenario: Get project with empty name raises ValueError
|
|
Given a RemoteProjectClient with mock projects in default namespace
|
|
When I get remote project with empty name
|
|
Then a ValueError should be raised for remote project name
|
|
|
|
Scenario: Resolve project falls back to default namespace
|
|
Given a RemoteProjectClient with mock projects in default namespace
|
|
When I resolve project "project-alpha" in namespace "custom" with fallback
|
|
Then the resolved project name should be "project-alpha"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Execution
|
|
# ---------------------------------------------------------------------------
|
|
|
|
Scenario: Request execution of remote project
|
|
Given a RemoteProjectClient with mock execution endpoint
|
|
When I request execution of remote project "proj-001"
|
|
Then the execution response should contain status "submitted"
|
|
|
|
Scenario: Request execution with plan name
|
|
Given a RemoteProjectClient with mock execution endpoint
|
|
When I request remote project "proj-001" execution using plan "my-plan"
|
|
Then the execution response should contain status "submitted"
|
|
|
|
Scenario: Request execution with empty project_id raises ValueError
|
|
Given a RemoteProjectClient with mock execution endpoint
|
|
When I request execution with empty project_id
|
|
Then a ValueError should be raised for remote project_id
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Cache management
|
|
# ---------------------------------------------------------------------------
|
|
|
|
Scenario: Invalidate cache for specific namespace
|
|
Given a RemoteProjectClient with mock projects in default namespace
|
|
When I list remote projects in namespace "default"
|
|
And I invalidate cache for namespace "default"
|
|
Then the remote project cache size should be 0
|
|
|
|
Scenario: Invalidate all cache
|
|
Given a RemoteProjectClient with mock projects in default namespace
|
|
When I list remote projects in namespace "default"
|
|
And I invalidate all cache
|
|
Then the remote project cache size should be 0
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# RemoteProject attributes
|
|
# ---------------------------------------------------------------------------
|
|
|
|
Scenario: RemoteProject stores all attributes
|
|
Given a RemoteProject with id "rp1" name "test" namespace "ns" alias "t" description "desc"
|
|
Then the remote project project_id should be "rp1"
|
|
And the remote project alias should be "t"
|
|
And the remote project description should be "desc"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Cache TTL
|
|
# ---------------------------------------------------------------------------
|
|
|
|
Scenario: Cache TTL can be configured
|
|
Given a RemoteProjectClient with cache_ttl 60.0
|
|
Then the client cache_ttl should be 60.0
|
|
|
|
Scenario: Resolve project with empty name raises ValueError
|
|
Given a RemoteProjectClient with mock projects in default namespace
|
|
When I resolve project with empty name
|
|
Then a ValueError should be raised for remote resolve name
|