Files
cleveragents-core/features/actor_registry_persistence.feature
T

141 lines
4.8 KiB
Gherkin

Feature: Actor registry persistence with YAML text retention
As a developer
I want actor registry persistence to store YAML text alongside compiled metadata
So that original actor configs are retained and schema versions are tracked
Scenario: Add actor from YAML text retains original source
Given an actor registry with no configured providers for persistence
When I add actor from YAML text:
"""
name: local/test-actor
provider: openai
model: gpt-4
"""
Then the actor "local/test-actor" should have yaml_text containing "provider: openai"
And the actor "local/test-actor" should have schema_version "1.0"
Scenario: Add actor with explicit schema version
Given an actor registry with no configured providers for persistence
When I add actor from YAML text with schema_version "2.0":
"""
name: local/versioned
provider: anthropic
model: claude-3
"""
Then the actor "local/versioned" should have schema_version "2.0"
Scenario: Add actor with compiled metadata
Given an actor registry with no configured providers for persistence
When I add actor from YAML text with compiled_metadata:
"""
name: local/compiled
provider: openai
model: gpt-4o
"""
Then the actor "local/compiled" should have compiled_metadata key "graph_nodes"
Scenario: Update existing actor preserves YAML text
Given an actor registry with no configured providers for persistence
When I add actor from YAML text:
"""
name: local/updatable
provider: openai
model: gpt-4
"""
And I update actor from YAML text:
"""
name: local/updatable
provider: openai
model: gpt-4-turbo
"""
Then the actor "local/updatable" should have yaml_text containing "gpt-4-turbo"
Scenario: Remove actor by namespaced name
Given an actor registry with no configured providers for persistence
When I add actor from YAML text:
"""
name: local/removable
provider: openai
model: gpt-4
"""
And I remove actor "local/removable" via registry
Then the actor "local/removable" should not exist
Scenario: List actors with namespace filter
Given an actor registry with no configured providers for persistence
When I add actor from YAML text:
"""
name: local/alpha
provider: openai
model: gpt-4
"""
And I add actor from YAML text with update:
"""
name: local/beta
provider: anthropic
model: claude-3
"""
Then listing actors with namespace "local" should return 2 actors
And listing actors with namespace "nonexistent" should return 0 actors
Scenario: Namespaced name auto-prefixing
Given an actor registry with no configured providers for persistence
When I add actor from YAML text:
"""
name: local/auto-prefixed
provider: openai
model: gpt-4
"""
Then the actor "local/auto-prefixed" should exist
Scenario: Get actor by namespaced name
Given an actor registry with no configured providers for persistence
When I add actor from YAML text:
"""
name: local/fetchable
provider: openai
model: gpt-4
"""
Then getting actor "local/fetchable" via registry should return provider "openai"
Scenario: Add actor without name raises validation error
Given an actor registry with no configured providers for persistence
When I attempt to add actor from YAML text without name:
"""
provider: openai
model: gpt-4
"""
Then a validation error should be raised for missing name
Scenario: Add duplicate actor without update raises validation error
Given an actor registry with no configured providers for persistence
When I add actor from YAML text:
"""
name: local/duplicate
provider: openai
model: gpt-4
"""
And I attempt to add duplicate actor from YAML text:
"""
name: local/duplicate
provider: openai
model: gpt-4-turbo
"""
Then a validation error should be raised for duplicate actor
Scenario: Upsert actor via legacy API with yaml_text and schema_version
Given an actor registry with no configured providers for persistence
When I upsert actor "local/legacy-yaml" with yaml_text and schema_version "1.5"
Then the actor "local/legacy-yaml" should have yaml_text containing "legacy yaml content"
And the actor "local/legacy-yaml" should have schema_version "1.5"
Scenario: Default schema version is applied when not specified
Given an actor registry with no configured providers for persistence
When I add actor from YAML text:
"""
name: local/default-version
provider: openai
model: gpt-4
"""
Then the actor "local/default-version" should have schema_version "1.0"