Files
cleveragents-core/features/tdd_auto_debug_state_mutation.feature
T
CleverAgents Bot 7feab6d29d
CI / load-versions (pull_request) Successful in 15s
CI / push-validation (pull_request) Successful in 24s
CI / lint (pull_request) Successful in 36s
CI / build (pull_request) Successful in 35s
CI / quality (pull_request) Successful in 55s
CI / typecheck (pull_request) Successful in 57s
CI / security (pull_request) Successful in 1m23s
CI / helm (pull_request) Successful in 38s
CI / unit_tests (pull_request) Successful in 6m41s
CI / docker (pull_request) Successful in 1m29s
CI / integration_tests (pull_request) Successful in 10m47s
CI / coverage (pull_request) Successful in 9m38s
CI / status-check (pull_request) Successful in 7s
test(auto-debug): exercise message content fixtures
2026-06-17 01:43:50 -04:00

79 lines
3.9 KiB
Gherkin

@tdd_issue @tdd_issue_10496
Feature: AutoDebug node functions must not mutate state in-place
As a LangGraph developer
I want AutoDebug node functions to return new state dicts
So that the LangGraph node contract is respected and state isolation is maintained
Background:
Given the auto debug state mutation module is imported
Scenario: _analyze_error does not mutate the original state object
Given an auto debug agent for mutation testing
And an initial auto debug state for mutation testing
When I call _analyze_error and capture the result
Then the returned state should be a different object from the input state
And the original state messages list should be unchanged
Scenario: _analyze_error returns expected keys in partial state dict
Given an auto debug agent for mutation testing
And an initial auto debug state for mutation testing
When I call _analyze_error and capture the result
Then the returned state must contain key "messages"
And the analyze_error update should contain non-empty LLM content
Scenario: _generate_fix does not mutate the original state object
Given an auto debug agent for mutation testing
And a state with an error analysis for mutation testing
When I call _generate_fix and capture the result
Then the returned state should be a different object from the input state
And the original state current_fix should be unchanged
Scenario: _generate_fix returns expected keys in partial state dict
Given an auto debug agent for mutation testing
And a state with an error analysis for mutation testing
When I call _generate_fix and capture the result
Then the returned state must contain key "current_fix"
And the generated fix should contain the LLM JSON content
Scenario: _validate_fix does not mutate the original state object
Given an auto debug agent for mutation testing
And a state with a current fix for mutation testing
When I call _validate_fix and capture the result
Then the returned state should be a different object from the input state
And the original state fix_validated should be unchanged
Scenario: _validate_fix (invalid) returns expected keys in partial state dict
Given an auto debug agent for mutation testing
And a state with a current fix and invalid validation for mutation testing
When I call _validate_fix and capture the result
Then the returned state must contain key "fix_validated"
And the returned state must contain key "attempted_fixes"
And the invalid validation result should come from the LLM JSON content
Scenario: _validate_fix with valid fix consumes LLM JSON content
Given an auto debug agent for mutation testing
And a state with a current fix for mutation testing
When I call _validate_fix and capture the result
Then the returned state must contain key "fix_validated"
And the validation result should come from the LLM JSON content
Scenario: _validate_fix with invalid fix does not mutate attempted_fixes in-place
Given an auto debug agent for mutation testing
And a state with a current fix and invalid validation for mutation testing
When I call _validate_fix and capture the result
Then the returned state should be a different object from the input state
And the original state attempted_fixes list should be unchanged
Scenario: _finalize does not mutate the original state object
Given an auto debug agent for mutation testing
And a state ready for finalization for mutation testing
When I call _finalize and capture the result
Then the returned state should be a different object from the input state
And the original state result should be unchanged
Scenario: _finalize returns expected keys in partial state dict
Given an auto debug agent for mutation testing
And a state ready for finalization for mutation testing
When I call _finalize and capture the result
Then the returned state must contain key "result"