Files
cleveragents-core/features/agent_configurable_limits.feature
HAL9000 e9e2deb090
CI / lint (pull_request) Successful in 40s
CI / typecheck (pull_request) Successful in 1m8s
CI / quality (pull_request) Successful in 1m0s
CI / security (pull_request) Successful in 1m21s
CI / push-validation (pull_request) Successful in 27s
CI / helm (pull_request) Successful in 30s
CI / build (pull_request) Successful in 37s
CI / unit_tests (pull_request) Successful in 4m10s
CI / docker (pull_request) Successful in 1m43s
CI / integration_tests (pull_request) Successful in 8m36s
CI / coverage (pull_request) Successful in 13m31s
CI / status-check (pull_request) Successful in 3s
refactor(agent): replace hardcoded dependency and context file limits with configurable parameters
author CleverThis <hal9000@cleverthis.com> 1776170939 +0000
committer CleverThis <hal9000@cleverthis.com> 1776170939 +0000

refactor(agent): replace hardcoded dependency and context file limits with configurable parameters

Implemented configurable limits for the agent and graph components:
- ContextAnalysisAgent now accepts max_dependencies: int = 10 with validation (ValueError if <= 0)
- _parse_dependencies uses self.max_dependencies instead of a hard-coded 10
- PlanGenerationGraph now accepts max_context_files: int = 5 with validation (ValueError if <= 0)
- _format_context_summary uses self.max_context_files instead of a hard-coded 5
- Updated class docstrings to reflect new parameters
- Added Behave feature file at features/agent_configurable_limits.feature with 12 scenarios
- Added step definitions at features/steps/agent_configurable_limits_steps.py

ISSUES CLOSED: #9050
2026-06-02 21:16:38 -04:00

84 lines
3.7 KiB
Gherkin

Feature: Configurable limits in context analysis and plan generation
As a developer using the agents module
I want to configure the maximum number of dependencies and context files
So that I can tune the agents for different project sizes and resource constraints
Background:
Given the configurable limits module is importable
# ContextAnalysisAgent.max_dependencies tests
@configurable_limits
Scenario: ContextAnalysisAgent uses default max_dependencies of 10
Given a ContextAnalysisAgent with default settings
When I parse dependencies from a string with 15 items
Then the result should contain exactly 10 dependencies
@configurable_limits
Scenario: ContextAnalysisAgent respects custom max_dependencies
Given a ContextAnalysisAgent with max_dependencies set to 3
When I parse dependencies from a string with 15 items
Then the result should contain exactly 3 dependencies
@configurable_limits
Scenario: ContextAnalysisAgent raises ValueError for non-positive max_dependencies
When I create a ContextAnalysisAgent with max_dependencies set to 0
Then a ValueError should be raised about max_dependencies
@configurable_limits
Scenario: ContextAnalysisAgent raises ValueError for negative max_dependencies
When I create a ContextAnalysisAgent with max_dependencies set to -5
Then a ValueError should be raised about max_dependencies
@configurable_limits
Scenario: ContextAnalysisAgent max_dependencies of 1 returns single dependency
Given a ContextAnalysisAgent with max_dependencies set to 1
When I parse dependencies from a string with 15 items
Then the result should contain exactly 1 dependencies
# PlanGenerationGraph.max_context_files tests
@configurable_limits
Scenario: PlanGenerationGraph uses default max_context_files of 5
Given a PlanGenerationGraph with default settings
When I format a context summary with 8 context files
Then the summary should contain exactly 5 file entries
And the summary should mention 3 more files
@configurable_limits
Scenario: PlanGenerationGraph respects custom max_context_files
Given a PlanGenerationGraph with max_context_files set to 2
When I format a context summary with 8 context files
Then the summary should contain exactly 2 file entries
And the summary should mention 6 more files
@configurable_limits
Scenario: PlanGenerationGraph raises ValueError for non-positive max_context_files
When I create a PlanGenerationGraph with max_context_files set to 0
Then a ValueError should be raised about max_context_files
@configurable_limits
Scenario: PlanGenerationGraph raises ValueError for negative max_context_files
When I create a PlanGenerationGraph with max_context_files set to -1
Then a ValueError should be raised about max_context_files
@configurable_limits
Scenario: PlanGenerationGraph with fewer contexts than max_context_files shows all
Given a PlanGenerationGraph with max_context_files set to 10
When I format a context summary with 3 context files
Then the summary should contain exactly 3 file entries
And the summary should not mention more files
@configurable_limits
Scenario: PlanGenerationGraph with exactly max_context_files contexts shows all
Given a PlanGenerationGraph with default settings
When I format a context summary with 5 context files
Then the summary should contain exactly 5 file entries
And the summary should not mention more files
@configurable_limits
Scenario: PlanGenerationGraph with empty contexts returns no context message
Given a PlanGenerationGraph with default settings
When I format a context summary with 0 context files
Then the summary should be the no-context message