Files
cleveragents-core/features/uow_lifecycle.feature
2026-02-15 09:04:17 +00:00

67 lines
3.2 KiB
Gherkin

@phase1 @domain @unit_of_work @uow_lifecycle
Feature: UnitOfWork lifecycle repository wiring
As a system operator managing v3 lifecycle entities
I want the UnitOfWork to expose actions and lifecycle_plans repositories
So that transactional persistence works across both repositories atomically
Background:
Given a UnitOfWork backed by an in-memory database for lifecycle tests
# ---------------------------------------------------------------------------
# Repository exposure
# ---------------------------------------------------------------------------
@uow_actions_repo
Scenario: UoW exposes actions repository
When I access the actions repository from the UoW context
Then the actions repository should be an ActionRepository instance
@uow_lifecycle_plans_repo
Scenario: UoW exposes lifecycle_plans repository
When I access the lifecycle_plans repository from the UoW context
Then the lifecycle_plans repository should be a LifecyclePlanRepository instance
# ---------------------------------------------------------------------------
# CRUD via UoW
# ---------------------------------------------------------------------------
@uow_create_action
Scenario: Create action via UoW and retrieve it
When I create an action "local/uow-action" via the UoW transaction
Then the action "local/uow-action" should be retrievable from the actions repository
@uow_create_plan
Scenario: Create plan via UoW and retrieve it
Given an action "local/uow-plan-action" exists via the UoW
When I create a lifecycle plan "01HGZ6FE0AQDYTR4BX00000E01" via the UoW transaction
Then the plan "01HGZ6FE0AQDYTR4BX00000E01" should be retrievable from the lifecycle_plans repository
# ---------------------------------------------------------------------------
# Cross-repository commit
# ---------------------------------------------------------------------------
@uow_commit_persists
Scenario: UoW commit persists changes across repositories
When I create an action "local/commit-action" and a plan "01HGZ6FE0AQDYTR4BX00000E02" in a single UoW transaction
Then the action "local/commit-action" should be retrievable in a new transaction
And the plan "01HGZ6FE0AQDYTR4BX00000E02" should be retrievable in a new transaction
# ---------------------------------------------------------------------------
# Rollback
# ---------------------------------------------------------------------------
@uow_rollback
Scenario: UoW rollback discards changes across repositories
When I create an action "local/rollback-action" and a plan "01HGZ6FE0AQDYTR4BX00000E03" but force a rollback
Then the action "local/rollback-action" should not exist in a new transaction
And the plan "01HGZ6FE0AQDYTR4BX00000E03" should not exist in a new transaction
# ---------------------------------------------------------------------------
# Legacy accessor still works
# ---------------------------------------------------------------------------
@uow_legacy_plans
Scenario: Legacy plans accessor still returns PlanRepository
When I access the legacy plans repository from the UoW context
Then the legacy plans repository should be a PlanRepository instance