9753b31c7e
CI / quality (push) Successful in 36s
CI / lint (push) Successful in 38s
CI / typecheck (push) Successful in 49s
CI / security (push) Successful in 51s
CI / integration_tests (push) Successful in 55s
CI / unit_tests (push) Successful in 3m35s
CI / build (push) Successful in 33s
CI / coverage (push) Successful in 3m36s
CI / status-check (push) Successful in 3s
Add 13 BDD scenarios covering previously uncovered code paths: - SAFE_BUILTINS validation (sandbox.py: 0% → 100%) - ConfigurationError re-raise path (config.py: 99.3% → 100%) - CLI hello/main functions (cli.py: 72.7% → 90.9%) - GraphState message truncation (state.py: 98.7% → 100%) - ProgressBarManager update/context rendering (progress.py: 0% → 87.7%) - MessageRouter regex/exact/contains routing (message_router.py: 0% → 59.4%) - RoutingAdapter parse_routing_command (routing_adapter.py) - DynamicRouterNode pattern-based routing (dynamic_router.py) - EnhancedTemplateRegistry unknown template type (enhanced_registry.py: 99.2%) - CompositeAgent null-graph error path (composite.py: 97.8% → 98.6%) Cover routing_adapter.py (17% → 100%): all GOTO/ROUTE patterns, create_routing_node, create_conditional_router, dynamic config conversion. Cover dynamic_router.py (21% → 87%): execute with empty/dict/string messages, extract_message with colon parsing, config creation, graph extension with edge generation. Cover message_router.py (59% → 78%): regex, exact, contains, prefix, suffix match types, invalid regex handling, non-string message, set_state. Exercise Node._prepare_conversation_history with invalid configs, _runtime error paths, _execute_message_router with rules, _execute_agent with current_message and metadata propagation, _execute_function with dynamic_router, and _execute_conditional with content_contains/content_not_contains/content_starts_with and custom condition types. Improves nodes.py from 71.3% to 72.5%. Exercise PureGraphConfig, PureLangGraph init with dict/config, RxPyLangGraphBridge registration/connection/lookup, ReactiveStreamRouter operator creation and condition functions, ReactiveConfigParser config/route/graph parsing, ToolAgent tool execution with JSON, space-separated, single, file_read, progress_bar invocations, and ReactiveCleverAgentsApp init/dispose/visualization.
117 lines
4.9 KiB
Gherkin
117 lines
4.9 KiB
Gherkin
Feature: Graph State Edge Cases for Republish, Merge, and Append Update Modes
|
|
As a developer
|
|
I want graph states to handle non-existent attribute republish, non-dict merge, single-item append, and checkpoint edge cases
|
|
So that state update operations do not fail on unexpected input shapes
|
|
|
|
Background:
|
|
Given the state management system is available
|
|
|
|
Scenario: GraphState REPLACE mode with non-existent attribute
|
|
Given I have a GraphState instance
|
|
And I have updates with non-existent attributes only
|
|
When I update the state with REPLACE mode for nonexistent attributes
|
|
Then non-existent attributes should be ignored
|
|
And hasattr check should be performed for each attribute
|
|
|
|
Scenario: GraphState MERGE mode with non-dict non-list value
|
|
Given I have a GraphState with string metadata
|
|
And I have string updates for merge mode
|
|
When I update the state with MERGE mode for string values
|
|
Then the simple value should replace the existing value
|
|
And line 76 should be executed
|
|
|
|
Scenario: GraphState APPEND mode with single item to list
|
|
Given I have a GraphState with list messages
|
|
And I have single item to append to list field
|
|
When I update the state with APPEND mode for string field
|
|
Then the single item should be set as new value
|
|
And line 85 should be executed for non-list field
|
|
|
|
Scenario: Direct GraphState from_dict method call
|
|
Given I have a complete state dictionary
|
|
When I call GraphState.from_dict class method directly
|
|
Then a new GraphState instance should be created
|
|
And line 100 should be executed
|
|
And all attributes should be properly set
|
|
|
|
Scenario: StateManager history trimming with exact max size
|
|
Given I have a StateManager with time travel enabled
|
|
And I set max history to exactly 2
|
|
When I make exactly 3 state updates
|
|
Then history should be trimmed to 2 entries
|
|
And line 159 should be executed for trimming
|
|
|
|
Scenario: StateManager automatic checkpoint saving
|
|
Given I have a StateManager with checkpointing and small interval
|
|
And I set checkpoint interval to 2
|
|
When I make exactly 2 state updates
|
|
Then checkpoint should be saved automatically
|
|
And line 171 should be executed for checkpoint trigger
|
|
|
|
Scenario: StateManager with no checkpoint directory
|
|
Given I have a StateManager without checkpoint directory
|
|
When I trigger checkpoint saving
|
|
Then _save_checkpoint should return early
|
|
And lines 177-178 should be executed
|
|
|
|
Scenario: StateManager checkpoint loading from file
|
|
Given I have a StateManager with checkpoint directory
|
|
And I have a valid checkpoint file
|
|
When I load checkpoint from the file
|
|
Then state should be restored from checkpoint data
|
|
And lines 195-204 should be executed
|
|
And GraphState.from_dict should be called
|
|
|
|
Scenario: StateManager get latest checkpoint from directory
|
|
Given I have a StateManager with checkpoint directory
|
|
And I have checkpoint files in the directory
|
|
When I get the latest checkpoint from directory
|
|
Then the most recent file should be returned
|
|
And lines 208-215 should be executed
|
|
|
|
Scenario: StateManager get latest checkpoint with no directory
|
|
Given I have a StateManager without checkpoint directory for latest check
|
|
When I get the latest checkpoint with no directory
|
|
Then None should be returned immediately
|
|
And line 209 should be executed
|
|
|
|
Scenario: StateManager time travel with history
|
|
Given I have a StateManager with time travel and history
|
|
And I have made multiple state updates with history
|
|
When I perform time travel operation
|
|
Then state should revert to historical snapshot
|
|
And lines 219-231 should be executed
|
|
And GraphState.from_dict should be called for restoration
|
|
|
|
Scenario: StateManager time travel with steps beyond history
|
|
Given I have a StateManager with limited time travel history
|
|
When I try to time travel beyond available history
|
|
Then it should travel to earliest available state
|
|
And steps should be clamped to history length
|
|
|
|
Scenario: StateManager get state observable method
|
|
Given I have a StateManager
|
|
When I call get_state_observable method
|
|
Then the behavior subject should be returned
|
|
And line 235 should be executed
|
|
|
|
Scenario: StateManager clear history method
|
|
Given I have a StateManager with existing history
|
|
When I call clear_history method
|
|
Then history list should be emptied
|
|
And line 239 should be executed
|
|
|
|
Scenario: StateManager reset with no initial state
|
|
Given I have a StateManager with modified state
|
|
When I call reset with no parameters
|
|
Then state should reset to default GraphState
|
|
And lines 243-248 should be executed
|
|
And state stream should emit reset state
|
|
|
|
Scenario: StateManager reset with custom initial state
|
|
Given I have a StateManager
|
|
And I have a custom GraphState instance
|
|
When I call reset with the custom initial state
|
|
Then state should be set to the custom instance
|
|
And reset operations should be performed
|