Feature: Plan Generation LangGraph Coverage As a developer I want test coverage for the new PlanGenerationGraph LangGraph workflow in cleveragents.agents.plan_generation So that I can ensure the workflow executes correctly Background: Given the langgraph plan generation module is importable Scenario: PlanGenerationGraph LangGraph can be instantiated with default LLM When I create a langgraph PlanGenerationGraph with no LLM Then the langgraph graph should be initialized successfully And the langgraph graph should have a default FakeListLLM configured And the langgraph graph should have max_retries set to 3 Scenario: PlanGenerationGraph LangGraph can be instantiated with custom max_retries When I create a langgraph PlanGenerationGraph with max_retries of 5 Then the langgraph graph max_retries should be 5 Scenario: PlanGenerationGraph LangGraph creates prompt templates When I create a langgraph PlanGenerationGraph with no LLM Then the langgraph graph should have an analyze_prompt template And the langgraph graph should have a generate_prompt template And the langgraph graph should have a validate_prompt template Scenario: PlanGenerationGraph LangGraph builds workflow with correct nodes When I create a langgraph PlanGenerationGraph with no LLM Then the langgraph workflow graph should contain node "load_context" And the langgraph workflow graph should contain node "analyze_requirements" And the langgraph workflow graph should contain node "generate_plan" And the langgraph workflow graph should contain node "validate" Scenario: Format context summary with no files returns appropriate message Given I have a langgraph PlanGenerationGraph instance When I format the langgraph context summary with no contexts Then the langgraph summary should be "No context files provided" Scenario: Format context summary with multiple files Given I have a langgraph PlanGenerationGraph instance When I format the langgraph context summary with 3 contexts Then the langgraph summary should include all 3 file paths Scenario: Format context summary limits to five files Given I have a langgraph PlanGenerationGraph instance When I format the langgraph context summary with 8 contexts Then the langgraph summary should indicate "and 3 more files" Scenario: Load context node initializes state Given I have a langgraph PlanGenerationGraph instance When I execute the langgraph load_context node Then the langgraph node result should have retry_count set to 0 And the langgraph node result should have error set to None And the langgraph node result should include context metadata defaults Scenario: Load context node enriches context summary Given I have a langgraph PlanGenerationGraph instance When I execute the langgraph load_context node with sample contexts Then the langgraph node result should include an analyzed context summary And the langgraph node result should include context dependencies Scenario: Should retry returns retry when validation fails and retries available Given I have a langgraph PlanGenerationGraph instance with max_retries 3 When I check langgraph should_retry with FAIL validation and retry_count 0 Then the langgraph retry decision should be "retry" Scenario: Should retry returns end when validation passes Given I have a langgraph PlanGenerationGraph instance with max_retries 3 When I check langgraph should_retry with PASS validation and retry_count 0 Then the langgraph retry decision should be "end" Scenario: Should retry returns end when max retries reached Given I have a langgraph PlanGenerationGraph instance with max_retries 3 When I check langgraph should_retry with FAIL validation and retry_count 4 Then the langgraph retry decision should be "end" Scenario: Should retry still retries when retry_count equals max_retries Given I have a langgraph PlanGenerationGraph instance with max_retries 3 When I check langgraph should_retry with FAIL validation and retry_count 3 Then the langgraph retry decision should be "retry" Scenario: Validate node increments retry_count in returned state Given I have a langgraph PlanGenerationGraph instance When I execute the langgraph validate node with no changes Then the langgraph validation status should be "FAIL" And the langgraph validate result should include retry_count incremented from 0 to 1 Scenario: Validate node fails when no changes provided Given I have a langgraph PlanGenerationGraph instance When I execute the langgraph validate node with no changes Then the langgraph validation status should be "FAIL" And the langgraph validation message should contain "No changes to validate" Scenario: Generate plan handles missing requirements Given I have a langgraph PlanGenerationGraph instance When I execute the langgraph generate_plan node with no requirements Then the langgraph generated_changes should be empty And the langgraph error should contain "No requirements to generate from" Scenario: Workflow invoke method returns complete state Given I have a langgraph PlanGenerationGraph instance And I have langgraph workflow inputs with project plan and contexts When I invoke the langgraph workflow synchronously Then the langgraph workflow result should contain all expected fields Scenario: Workflow stream method yields events Given I have a langgraph PlanGenerationGraph instance And I have langgraph workflow inputs with project plan and contexts When I stream the langgraph workflow execution Then the langgraph stream should yield multiple events Scenario: PlanGenerationGraph retries transient LLM failures Given I have a langgraph PlanGenerationGraph instance When I execute the langgraph analyze_requirements node with a flaky LLM that fails once Then the langgraph analyze node should succeed after retry Scenario: LangGraph graphs package exports workflows Given the langgraph graphs package is importable Then the langgraph graphs exports should include "PlanGenerationGraph" And the langgraph graphs exports should include "ContextAnalysisAgent" Scenario: Agents package exposes LangGraph workflows Given the agents package is importable Then the agents package exports should include "PlanGenerationGraph" And the agents package exports should include "ContextAnalysisAgent"