Files
cleveragents-core/features/langgraph_state_additional_coverage.feature
T

42 lines
1.9 KiB
Gherkin

Feature: LangGraph state additional coverage
As a developer
I want to exercise uncovered state management branches
So that langgraph/state.py gains higher coverage
Background:
Given the state management system is available
Scenario: Merge mode trims messages beyond retention limit
Given I have a GraphState starting with 49 messages
And I have merge updates containing 5 new messages
When I merge the updates into the state
Then the message list should be trimmed to 50 messages
And the newest message should be retained after trimming
Scenario: Append mode trims messages beyond retention limit
Given the state management system is available
Given I have a GraphState starting with 50 messages
And I have append updates containing 5 new messages
When I append the updates into the state
Then the message list should be trimmed to 50 messages after append
And the newest appended message should be retained after trimming
Scenario: Time travel history is recorded and trimmed
Given I have a StateManager with time travel enabled and history size 2
When I perform 4 sequential state updates with time travel
Then only the two most recent history snapshots should remain
And the earliest snapshots should be discarded
Scenario: Automatic checkpoint is saved at interval
Given I have a StateManager with checkpointing enabled and interval 1
When I perform 2 sequential state updates with checkpointing
Then a checkpoint file should exist in the directory
And checkpoint saving should have been triggered
Scenario: Time travel clamps when steps exceed history
Given I have a StateManager with time travel history of 2 snapshots
When I request time travel 5 steps back
Then time travel should return the earliest available snapshot
And the returned state should reflect the earliest snapshot