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
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
134 lines
6.5 KiB
Gherkin
134 lines
6.5 KiB
Gherkin
Feature: Registry Reference Resolver and Generic Template Coverage
|
|
As a developer
|
|
I want the PackageContentResolver to resolve local, ID, and registry references with caching
|
|
So that package references are properly resolved and cached
|
|
|
|
Background:
|
|
Given RRC: I have a clean test environment for reference resolver coverage
|
|
|
|
Scenario: PackageContentResolver resolves LOCAL reference
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When RRC: I resolve a LOCAL package reference
|
|
Then RRC: the result should include _original_reference
|
|
And RRC: the result should have name and type fields
|
|
|
|
Scenario: PackageContentResolver resolves ID reference
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When RRC: I resolve an ID package reference
|
|
Then RRC: the result should include id and type fields
|
|
And RRC: _original_reference should match the ID string
|
|
|
|
Scenario: PackageContentResolver caches resolved references
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When RRC: I resolve a LOCAL reference twice
|
|
Then RRC: the second resolve should return cached result
|
|
And RRC: the cache should contain the reference key
|
|
|
|
Scenario: PackageContentResolver get_client creates and reuses clients
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When RRC: I get a client for a server
|
|
Then RRC: the client should be stored in the clients dict
|
|
And RRC: getting the same server should return the same client
|
|
|
|
Scenario: PackageContentResolver clear_cache removes all cached entries
|
|
Given RRC: I have a PackageContentResolver with cached entries
|
|
When RRC: I clear the cache
|
|
Then RRC: the cache should be empty
|
|
|
|
Scenario: GenericTemplate instantiate returns definition with defaults
|
|
Given RRC: I have a GenericTemplate instance with definition
|
|
When RRC: I instantiate the generic template
|
|
Then RRC: the result should be the definition dict
|
|
And RRC: _original_reference should be None by default
|
|
|
|
Scenario: GenericTemplate instantiate with params applies template vars
|
|
Given RRC: I have a GenericTemplate instance with template variables
|
|
And RRC: I have instantiation params
|
|
When RRC: I instantiate the generic template with params
|
|
Then RRC: the result should contain rendered variables
|
|
|
|
Scenario: PackageContentResolver resolves REGISTRY reference with mock
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When RRC: I resolve a REGISTRY reference with a mocked client
|
|
Then RRC: the result should include _original_reference
|
|
And RRC: the result should contain server and namespace fields
|
|
|
|
Scenario: PackageContentResolver aresolve handles REGISTRY references
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When RRC: I call aresolve on a REGISTRY reference
|
|
Then RRC: the result should contain server and namespace fields
|
|
|
|
Scenario: PackageContentResolver close_all closes all clients
|
|
Given RRC: I have a PackageContentResolver with multiple clients
|
|
When RRC: I call close_all synchronously
|
|
Then RRC: all client connections should be closed
|
|
|
|
Scenario: PackageContentResolver cache evicts oldest entry at max size
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When RRC: I resolve more than max cache size LOCAL references
|
|
Then RRC: the cache should not exceed max size
|
|
And RRC: the oldest entry should be evicted
|
|
|
|
# ── PackageContentResolver aresolve and error paths ──
|
|
|
|
Scenario: PackageContentResolver aresolve handles LOCAL references via async lock
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When FBF: I call aresolve on a LOCAL reference
|
|
Then FBF: the result should have name and type fields
|
|
And FBF: the result should include _original_reference
|
|
|
|
Scenario: PackageContentResolver aresolve handles ID references via async lock
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When FBF: I call aresolve on an ID reference
|
|
Then FBF: the result should include id and type fields
|
|
|
|
Scenario: PackageContentResolver aresolve caches and returns cached results
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When FBF: I call aresolve on a LOCAL reference twice
|
|
Then FBF: the second aresolve should return cached result
|
|
|
|
Scenario: PackageContentResolver resolve rejects incomplete registry reference
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When FBF: I resolve a REGISTRY reference missing server/namespace/name
|
|
Then FBF: the result should be None
|
|
|
|
Scenario: PackageContentResolver resolve rejects missing package_type for REGISTRY
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When FBF: I resolve a REGISTRY reference without package_type
|
|
Then FBF: the result should be None
|
|
|
|
Scenario: PackageContentResolver aresolve rejects incomplete registry reference async
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When FBF: I call aresolve on a REGISTRY reference missing server/namespace/name
|
|
Then FBF: the aresolve result should be None
|
|
|
|
Scenario: PackageContentResolver aresolve rejects missing package_type async
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When FBF: I call aresolve on a REGISTRY reference without package_type
|
|
Then FBF: the aresolve result should be None
|
|
|
|
Scenario: PackageContentResolver resolve detects running event loop
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When FBF: I try to resolve a REGISTRY reference from inside a running event loop
|
|
Then FBF: a RuntimeError should be raised about event loop conflict
|
|
|
|
Scenario: PackageContentResolver close_all handles individual client close exceptions
|
|
Given RRC: I have a PackageContentResolver with clients where one raises on close
|
|
When FBF: I call close_all
|
|
Then FBF: all clients should be closed without raising
|
|
|
|
Scenario: PackageContentResolver resolve returns None for unknown reference type
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When FBF: I resolve a reference with an unknown reference type
|
|
Then FBF: the result should be None
|
|
|
|
Scenario: PackageContentResolver _put_cache moves existing key to end
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When FBF: I call _put_cache with an already existing key
|
|
Then FBF: the key should be moved to the end of the cache
|
|
|
|
Scenario: PackageContentResolver aresolve returns None for unknown reference type
|
|
Given RRC: I have a PackageContentResolver instance
|
|
When FBF: I call aresolve on a reference with an unknown reference type
|
|
Then FBF: the result should be None
|