Files
cleveragents-core/features/tdd_auto_debug_node_contracts.feature
T
HAL9000 7c24270afc
CI / lint (pull_request) Successful in 1m2s
CI / typecheck (pull_request) Successful in 1m15s
CI / security (pull_request) Successful in 1m14s
CI / push-validation (pull_request) Successful in 39s
CI / build (pull_request) Successful in 57s
CI / helm (pull_request) Successful in 58s
CI / quality (pull_request) Successful in 1m16s
CI / unit_tests (pull_request) Successful in 6m14s
CI / docker (pull_request) Successful in 1m36s
CI / integration_tests (pull_request) Successful in 10m41s
CI / coverage (pull_request) Successful in 14m47s
CI / status-check (pull_request) Successful in 3s
fix(auto_debug): fix LangGraph node contracts and resolve CI failures
- Return state update dict from _analyze_error using iterable unpacking
  so existing messages are preserved (state.get + [new_message]) and the
  RUF005 concatenation lint rule is satisfied
- Remove @tdd_expected_fail from tdd_auto_debug_analyze_error_mutation
  feature now that bug #10494 is resolved
- Add BDD node-contract tests for _generate_fix, _validate_fix, _finalize
  verifying each returns only the changed keys, not the full state
- Fix typer.Exit propagation in actor_run.py and actor.py: widen the
  passthrough except clause from click.exceptions.Exit to
  (click.exceptions.Exit, typer.Exit) so _resolve_actor's typer.Exit(2)
  is not swallowed and re-raised as Exit(3)
- Add typer.Exit to Behave step except clauses in
  actor_run_signature_resolve_steps.py and actor_run_signature_security_steps.py
  so test scenarios capture the exit code instead of erroring
- Fix SQLChatMessageHistory call in memory_service.py: rename kwarg
  connection_string to connection per langchain_community 0.4.x API change

ISSUES CLOSED: #10496
2026-06-14 12:22:44 -04:00

41 lines
2.5 KiB
Gherkin

@tdd_issue @tdd_issue_10496
Feature: AutoDebugAgent LangGraph node contract — _generate_fix, _validate_fix, _finalize
As a developer using LangGraph
I want AutoDebugAgent._generate_fix(), _validate_fix(), and _finalize() to return update dicts
So that LangGraph can correctly merge state without side-effects or double-applied mutations
LangGraph node functions must return a dict containing only the keys that changed,
not the full state object. These tests verify the node contract for the three remaining
AutoDebugAgent nodes beyond _analyze_error (covered by bug #10494 tests).
Scenario: _generate_fix returns an update dict containing only current_fix
Given an AutoDebugAgent with a mock LLM for the node contract test
And a state with an error_analysis message for the node contract test
When _generate_fix is called with the state for the node contract test
Then the generate_fix result should be a plain dict of updates
And the generate_fix result should contain only the current_fix key
And the generate_fix result should not be the same object as the input state
Scenario: _validate_fix returns an update dict with fix_validated True when fix is valid
Given an AutoDebugAgent with a mock LLM returning valid for the node contract test
And a state with a current_fix for the node contract test
When _validate_fix is called with the state for the node contract test
Then the validate_fix result should be a plain dict of updates
And the validate_fix result should contain fix_validated set to True
And the validate_fix result should not be the same object as the input state
Scenario: _validate_fix adds attempted_fixes when fix is invalid
Given an AutoDebugAgent with a mock LLM returning invalid for the node contract test
And a state with a current_fix for the node contract test
When _validate_fix is called with the state for the node contract test
Then the validate_fix result should contain fix_validated set to False
And the validate_fix result should contain the attempted_fixes key
Scenario: _finalize returns an update dict containing only result
Given an AutoDebugAgent with a mock LLM for the node contract test
And a state with fix_validated True and a current_fix for the finalize test
When _finalize is called with the state for the node contract test
Then the finalize result should be a plain dict of updates
And the finalize result should contain only the result key
And the finalize result should not be the same object as the input state