Files
cleveragents-core/features/domain_repository_protocols.feature
freemo faf7991a13
CI / lint (pull_request) Failing after 21s
CI / typecheck (pull_request) Successful in 52s
CI / security (pull_request) Successful in 1m1s
CI / quality (pull_request) Successful in 34s
CI / coverage (pull_request) Has been skipped
CI / build (pull_request) Successful in 23s
CI / helm (pull_request) Successful in 24s
CI / unit_tests (pull_request) Successful in 6m24s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Successful in 17m20s
CI / integration_tests (pull_request) Successful in 23m6s
CI / status-check (pull_request) Failing after 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Has been skipped
fix(domain): add repository protocol interfaces to domain layer
Implemented domain-level repository protocol interfaces to restore clean
architecture boundaries and enable robust type checks via runtime
structural typing.

- Created domain/repositories package with four protocol interfaces
- Added LifecyclePlanRepositoryProtocol, ActionRepositoryProtocol,
  DecisionRepositoryProtocol, and ProjectRepositoryProtocol
- Updated infrastructure repositories to explicitly inherit protocols
- Added 10 Behave scenarios for protocol compliance verification

ISSUES CLOSED: #2873
2026-04-05 08:43:01 +00:00

79 lines
3.6 KiB
Gherkin

Feature: Domain Repository Protocols
As a developer maintaining the CleverAgents clean architecture
I want domain repository protocols defined in the domain layer
So that application services depend on abstractions, not infrastructure implementations
Background:
Given the domain repository protocols are importable
Scenario: LifecyclePlanRepositoryProtocol is defined in the domain layer
When I inspect the LifecyclePlanRepositoryProtocol
Then it should be a runtime-checkable Protocol
And it should define a "create" method
And it should define a "get" method
And it should define a "update" method
And it should define a "delete" method
And it should define a "list_all" method
Scenario: ActionRepositoryProtocol is defined in the domain layer
When I inspect the ActionRepositoryProtocol
Then it should be a runtime-checkable Protocol
And it should define a "create" method
And it should define a "get_by_id" method
And it should define a "update" method
And it should define a "delete" method
And it should define a "list_all" method
Scenario: DecisionRepositoryProtocol is defined in the domain layer
When I inspect the DecisionRepositoryProtocol
Then it should be a runtime-checkable Protocol
And it should define a "create" method
And it should define a "get" method
And it should define a "get_by_plan" method
And it should define a "get_tree" method
Scenario: ProjectRepositoryProtocol is defined in the domain layer
When I inspect the ProjectRepositoryProtocol
Then it should be a runtime-checkable Protocol
And it should define a "create" method
And it should define a "get" method
And it should define a "update" method
And it should define a "delete" method
Scenario: LifecyclePlanRepository satisfies LifecyclePlanRepositoryProtocol
Given the infrastructure LifecyclePlanRepository class
When I check if it satisfies LifecyclePlanRepositoryProtocol
Then the isinstance check should pass
Scenario: ActionRepository satisfies ActionRepositoryProtocol
Given the infrastructure ActionRepository class
When I check if it satisfies ActionRepositoryProtocol
Then the isinstance check should pass
Scenario: DecisionRepository satisfies DecisionRepositoryProtocol
Given the infrastructure DecisionRepository class
When I check if it satisfies DecisionRepositoryProtocol
Then the isinstance check should pass
Scenario: NamespacedProjectRepository satisfies ProjectRepositoryProtocol
Given the infrastructure NamespacedProjectRepository class
When I check if it satisfies ProjectRepositoryProtocol
Then the isinstance check should pass
Scenario: Domain repository protocols are exported from the domain package
When I import from cleveragents.domain.repositories
Then LifecyclePlanRepositoryProtocol should be available
And ActionRepositoryProtocol should be available
And DecisionRepositoryProtocol should be available
And ProjectRepositoryProtocol should be available
Scenario: Protocol modules are in the domain layer, not infrastructure
When I check the module path of LifecyclePlanRepositoryProtocol
Then the module should be under "cleveragents.domain"
When I check the module path of ActionRepositoryProtocol
Then the module should be under "cleveragents.domain"
When I check the module path of DecisionRepositoryProtocol
Then the module should be under "cleveragents.domain"
When I check the module path of ProjectRepositoryProtocol
Then the module should be under "cleveragents.domain"