TEST-INFRA: [coverage-gaps] Add test coverage for PureLangGraph execution logic #3785

Open
opened 2026-04-06 06:18:27 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: test/coverage-gaps-pure-langgraph
  • Commit Message: test(langgraph): add test coverage for PureLangGraph execution logic
  • Milestone: N/A — backlog (see note below)
  • Parent Epic: #1678

Backlog note: This issue was discovered during autonomous operation
on milestone v3.7.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.

Background and Context

The file src/cleveragents/langgraph/pure_graph.py has critically low test coverage at 38.30%. The existing tests only cover basic instantiation of the PureLangGraph class, leaving the core graph execution logic entirely untested. Since PureLangGraph is the runtime primitive that composes Actors into LangGraph-based execution pipelines (per the specification's Actor model), untested execution logic represents a significant reliability risk.

Current and Expected Behavior

Current: Only PureLangGraph class instantiation is covered by tests. All execution, traversal, edge evaluation, parallel execution, error handling, state management, and cycle detection paths are uncovered (38.30% coverage).

Expected: All critical execution paths are covered by unit and/or Behave tests, bringing coverage for this file to ≥97% in line with the project-wide coverage gate.

Uncovered Logic

The following key areas are completely untested:

  • Graph Execution: The execute and _execute_from_node methods — core logic for traversing the graph, executing nodes, and managing graph state.
  • Edge Conditions: _evaluate_edge_condition — critical for ensuring conditional branching works correctly.
  • Parallel Execution: Logic for executing multiple nodes in parallel.
  • Error Handling: Paths for missing nodes, node execution errors, and other failure modes.
  • State Management: Interaction with StateManager during graph execution.
  • Cycle Detection: _detect_cycles logic.

Subtasks

  • Analyse src/cleveragents/langgraph/pure_graph.py to enumerate all uncovered branches and methods
  • Write unit tests (pytest) for execute and _execute_from_node — basic linear graph
  • Write unit tests for _evaluate_edge_condition — conditional branching (taken / not taken)
  • Write unit tests for parallel node execution paths
  • Write unit tests for cycle detection (_detect_cycles)
  • Write unit tests for error handling paths (missing node, node execution exception)
  • Write unit tests for StateManager interaction during execution
  • Add Behave scenario: basic graph execution with start and end node
  • Add Behave scenario: graph with conditional edge
  • Add Behave scenario: graph with a cycle (expect detection/error)
  • Add Behave scenario: graph where a node raises an exception
  • Verify coverage for pure_graph.py ≥ 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage for src/cleveragents/langgraph/pure_graph.py ≥ 97%.

Automated by CleverAgents Bot
Supervisor: Test Infrastructure | Agent: ca-new-issue-creator

## Metadata - **Branch**: `test/coverage-gaps-pure-langgraph` - **Commit Message**: `test(langgraph): add test coverage for PureLangGraph execution logic` - **Milestone**: N/A — backlog (see note below) - **Parent Epic**: #1678 > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.7.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ## Background and Context The file `src/cleveragents/langgraph/pure_graph.py` has critically low test coverage at **38.30%**. The existing tests only cover basic instantiation of the `PureLangGraph` class, leaving the core graph execution logic entirely untested. Since `PureLangGraph` is the runtime primitive that composes Actors into LangGraph-based execution pipelines (per the specification's Actor model), untested execution logic represents a significant reliability risk. ## Current and Expected Behavior **Current:** Only `PureLangGraph` class instantiation is covered by tests. All execution, traversal, edge evaluation, parallel execution, error handling, state management, and cycle detection paths are uncovered (38.30% coverage). **Expected:** All critical execution paths are covered by unit and/or Behave tests, bringing coverage for this file to ≥97% in line with the project-wide coverage gate. ## Uncovered Logic The following key areas are completely untested: - **Graph Execution**: The `execute` and `_execute_from_node` methods — core logic for traversing the graph, executing nodes, and managing graph state. - **Edge Conditions**: `_evaluate_edge_condition` — critical for ensuring conditional branching works correctly. - **Parallel Execution**: Logic for executing multiple nodes in parallel. - **Error Handling**: Paths for missing nodes, node execution errors, and other failure modes. - **State Management**: Interaction with `StateManager` during graph execution. - **Cycle Detection**: `_detect_cycles` logic. ## Subtasks - [ ] Analyse `src/cleveragents/langgraph/pure_graph.py` to enumerate all uncovered branches and methods - [ ] Write unit tests (pytest) for `execute` and `_execute_from_node` — basic linear graph - [ ] Write unit tests for `_evaluate_edge_condition` — conditional branching (taken / not taken) - [ ] Write unit tests for parallel node execution paths - [ ] Write unit tests for cycle detection (`_detect_cycles`) - [ ] Write unit tests for error handling paths (missing node, node execution exception) - [ ] Write unit tests for `StateManager` interaction during execution - [ ] Add Behave scenario: basic graph execution with start and end node - [ ] Add Behave scenario: graph with conditional edge - [ ] Add Behave scenario: graph with a cycle (expect detection/error) - [ ] Add Behave scenario: graph where a node raises an exception - [ ] Verify coverage for `pure_graph.py` ≥ 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage for `src/cleveragents/langgraph/pure_graph.py` ≥ 97%. --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure | Agent: ca-new-issue-creator
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#3785
No description provided.