Files
cleveractors-core/features/template_store_coverage.feature
CoreRasurae 284d2a9f00
CI / quality (pull_request) Successful in 37s
CI / lint (pull_request) Successful in 49s
CI / typecheck (pull_request) Successful in 50s
CI / build (pull_request) Successful in 50s
CI / security (pull_request) Successful in 55s
CI / integration_tests (pull_request) Successful in 59s
CI / unit_tests (pull_request) Successful in 3m38s
CI / coverage (pull_request) Successful in 3m35s
CI / status-check (pull_request) Successful in 4s
CI / lint (push) Successful in 33s
CI / quality (push) Successful in 58s
CI / typecheck (push) Successful in 1m1s
CI / security (push) Successful in 1m1s
CI / build (push) Successful in 52s
CI / integration_tests (push) Successful in 1m12s
CI / unit_tests (push) Successful in 3m41s
CI / coverage (push) Successful in 3m35s
CI / status-check (push) Successful in 3s
feat(registry): extend TemplateType and integrate PackageReference into template system
Extend TemplateType enum with TEMPLATE, SKILL, ACTOR, MCP, LSP.
Add optional package_ref field to ComponentReference for registry references.
Create ReferenceResolver with multi-server RegistryClient pool and caching.
Update InstantiationContext for registry-aware resolution with _original_reference.
Extend TemplateRegistry, EnhancedTemplateRegistry, and TemplateStore for 8 types.
Add registry reference detection in instantiate_from_config.
Add GenericTemplate for new package types without specialized template classes.

ISSUES CLOSED: #27
2026-06-10 12:50:38 +01:00

133 lines
5.5 KiB
Gherkin

Feature: Template Store Persistence and Instantiation
As a developer
I want templates to be stored, retrieved, and instantiated from string and dict definitions through the template store
So that template storage, metadata access, and deferred instantiation function correctly
Background:
Given a clean template store test environment
Scenario: Test TemplateStore initialization
When I create a new TemplateStore
Then the template store should be initialized with empty collections
And the template store should have eight template types
Scenario: Test add_template with string definition
Given I have a TemplateStore
When I add a string template definition
Then the template should be stored as raw YAML
And metadata should be extracted successfully
Scenario: Test add_template with dict definition
Given I have a TemplateStore
When I add a dict template definition
Then the template should be converted to YAML string
And metadata should be extracted from dict
Scenario: Test add_template with invalid YAML string
Given I have a TemplateStore
When I add an invalid YAML string template
Then the template should be stored anyway
And a warning should be logged for metadata extraction failure
Scenario: Test get_template with existing template
Given I have a TemplateStore with stored templates
When I get an existing template
Then the raw template string should be returned
Scenario: Test get_template with non-existing template
Given I have a TemplateStore
When I get a non-existing template
Then None should be returned for template
Scenario: Test get_metadata with existing template
Given I have a TemplateStore with stored templates
When I get metadata for an existing template
Then the template metadata should be returned
Scenario: Test get_metadata with non-existing template
Given I have a TemplateStore
When I get metadata for a non-existing template
Then None should be returned for metadata
Scenario: Test instantiate_template with existing template
Given I have a TemplateStore with a templated definition
When I instantiate the template store template with parameters
Then the template should be processed with parameters
And utility functions should be available in context
Scenario: Test instantiate_template with non-existing template
Given I have a TemplateStore
When I try to instantiate a non-existing template
Then a ValueError should be raised with template not found message
Scenario: Test TemplateDefinition with string input
When I create a TemplateDefinition with a string
Then the raw YAML should be stored
And the definition should be parsed correctly
And template syntax should be detected
Scenario: Test TemplateDefinition with dict input
When I create a TemplateDefinition with a dict
Then the dict should be converted to YAML
And the parsed definition should match input
And template syntax should be detected in YAML
Scenario: Test TemplateDefinition with invalid YAML string
When I create a TemplateDefinition with invalid YAML
Then the raw YAML should be stored
And the parsed definition should be empty dict
And template syntax detection should still work
Scenario: Test TemplateDefinition template syntax detection
When I create a TemplateDefinition with Jinja2 syntax
Then template syntax should be automatically detected
And contains_templates should be True
Scenario: Test TemplateDefinition without template syntax
When I create a TemplateDefinition without Jinja2 syntax
Then template syntax should not be detected
And contains_templates should be False
Scenario: Test TemplateDefinition with explicit contains_templates flag
When I create a TemplateDefinition with explicit template flag
Then the explicit flag should be used
And automatic detection should be skipped
Scenario: Test TemplateDefinition get_parameters method
Given I have a TemplateDefinition with parameters
When I call get_parameters
Then the parameters should be returned correctly
Scenario: Test TemplateDefinition get_type method
Given I have a TemplateDefinition with type
When I call get_type
Then the type should be returned correctly
Scenario: Test TemplateDefinition get_type method with no type
Given I have a TemplateDefinition without type
When I call get_type
Then the default type "unknown" should be returned
Scenario: Test TemplateDefinition instantiate without templates
Given I have a TemplateDefinition without Jinja2 templates
When I call instantiate
Then the parsed definition should be returned unchanged
Scenario: Test TemplateDefinition instantiate with templates
Given I have a TemplateDefinition with Jinja2 templates
When I call instantiate with parameters
Then the template should be processed
And utility functions should be available in the context
Scenario: Test TemplateStore add_template with dict type conversions
Given I have a TemplateStore
When I add multiple template types with dict definitions
Then all template types should be converted to YAML correctly
And all metadata should be extracted properly
Scenario: Test comprehensive template store functionality
Given I have a TemplateStore
When I perform comprehensive template store operations
Then all TemplateStore code paths should be exercised
And all TemplateDefinition code paths should be exercised