Files
cleveragents-core/features/plan_lifecycle_service_persistence_coverage.feature
T
freemo 55aee7cf22 fix(test): commit after each add_skill to prevent session GC rollback, and improved coverage.
The step_register_skills_table step called add_skill in a loop but only
committed once at the end. Because SkillRepository.create() obtains a
new session per call and only flushes (never commits), the intermediate
sessions could be garbage-collected before the final commit, rolling
back their transactions on the shared SQLite :memory: connection. Moving
_commit_pending inside the loop ensures each skill is durably committed
before the next session is created.

ISSUES CLOSED: #418
2026-02-24 12:19:04 -05:00

25 lines
1.3 KiB
Gherkin

Feature: PlanLifecycleService persistence fallback coverage
Cover the uncovered persistence-layer fallback paths in
PlanLifecycleService.get_action() (lines 340-341) and
PlanLifecycleService.get_action_by_name() (lines 376-380).
These branches execute when:
- The service has a UnitOfWork (persisted mode)
- The requested action is NOT in the in-memory _actions cache
- The action IS found in the persistence layer via ctx.actions.get_by_name()
Background:
Given a plan lifecycle service with a mock unit of work
Scenario: get_action falls back to persistence layer when not in memory
Given an action "local/db-only-action" exists only in the persistence layer
When I call get_action with "local/db-only-action"
Then the returned action should have namespaced name "local/db-only-action"
And the action "local/db-only-action" should now be cached in memory
Scenario: get_action_by_name falls back to persistence layer when not in memory
Given an action "local/db-only-named" exists only in the persistence layer for name lookup
When I call get_action_by_name with "local/db-only-named"
Then the returned action from name lookup should have namespaced name "local/db-only-named"
And the action "local/db-only-named" should now be cached in memory after name lookup