c491f0e6ea
- _validate_fix exception handler defaults to False (not True), preventing crashed LLM validators from passing unvalidated fixes. - Added positive test assertions verifying returned partial-state dicts contain expected keys (messages, current_fix, fix_validated, attempted_fixes, result). This closes a coverage blind spot where an empty return dict would silently pass immutability tests. ISSUES CLOSED: #10496
69 lines
3.4 KiB
Gherkin
69 lines
3.4 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"
|
|
|
|
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"
|
|
|
|
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"
|
|
|
|
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"
|