Files
cleveragents-core/features/project_config_model.feature

131 lines
5.9 KiB
Gherkin

Feature: Project Configuration Models
As a developer
I want ValidationConfig and ContextConfig domain models
So that projects can define validation commands and context indexing behavior
# ValidationConfig Tests (B1.5)
# B1.5a - Model creation with defaults
Scenario: Create a default ValidationConfig
Given a default ValidationConfig
Then the validation test_command should be none
And the validation lint_command should be none
And the validation type_check_command should be none
And the validation build_command should be none
And the validation custom_commands should be empty
And the validation timeout_seconds should be 300
And the validation fail_on_lint_error should be true
# B1.5b - Fields with values
Scenario: Create a ValidationConfig with all commands
Given a ValidationConfig with test "pytest" lint "ruff check ." typecheck "pyright" build "python -m build"
Then the validation test_command should be "pytest"
And the validation lint_command should be "ruff check ."
And the validation type_check_command should be "pyright"
And the validation build_command should be "python -m build"
Scenario: Create a ValidationConfig with custom commands
Given a ValidationConfig with custom commands "security=bandit,docs=mkdocs build"
Then the validation custom_commands should contain "security" with value "bandit"
And the validation custom_commands should contain "docs" with value "mkdocs build"
Scenario: Create a ValidationConfig with custom timeout
Given a ValidationConfig with timeout 600
Then the validation timeout_seconds should be 600
Scenario: Create a ValidationConfig with fail_on_lint_error false
Given a ValidationConfig with fail_on_lint_error false
Then the validation fail_on_lint_error should be false
# B1.5c - Helper methods
Scenario: get_all_commands returns all configured commands
Given a ValidationConfig with test "pytest" lint "ruff check ." typecheck "pyright" build "python -m build"
Then get_all_commands should include "test" with value "pytest"
And get_all_commands should include "lint" with value "ruff check ."
And get_all_commands should include "type_check" with value "pyright"
And get_all_commands should include "build" with value "python -m build"
Scenario: get_all_commands includes custom commands
Given a ValidationConfig with test "pytest" and custom commands "security=bandit"
Then get_all_commands should include "test" with value "pytest"
And get_all_commands should include "security" with value "bandit"
Scenario: get_all_commands returns empty dict when no commands configured
Given a default ValidationConfig
Then get_all_commands should be empty
Scenario: has_any_validation is true when commands exist
Given a ValidationConfig with test "pytest" lint "ruff check ." typecheck "pyright" build "python -m build"
Then has_any_validation should be true
Scenario: has_any_validation is false when no commands configured
Given a default ValidationConfig
Then has_any_validation should be false
Scenario: has_any_validation is true with only custom commands
Given a ValidationConfig with custom commands "security=bandit,docs=mkdocs build"
Then has_any_validation should be true
# ContextConfig Tests (B1.6)
# B1.6a - Model creation with defaults
Scenario: Create a default ContextConfig
Given a default ContextConfig
Then the context max_file_size should be 1000000
And the context max_files should be 100000
And the context indexing_strategy should be "full_text"
And the context chunking_policy should be "smart"
And the context chunk_size should be 1000
And the context include_patterns should be none
Scenario: Default ContextConfig has default ignore patterns
Given a default ContextConfig
Then the context ignore_patterns should contain ".git/"
And the context ignore_patterns should contain "node_modules/"
And the context ignore_patterns should contain "__pycache__/"
And the context ignore_patterns should contain ".venv/"
And the context ignore_patterns should contain "*.pyc"
And the context ignore_patterns should contain ".DS_Store"
# B1.6b - Fields with values
Scenario: Create a ContextConfig with custom ignore patterns
Given a ContextConfig with ignore patterns "dist/,build/"
Then the context ignore_patterns should contain "dist/"
And the context ignore_patterns should contain "build/"
And the context ignore_patterns should contain ".git/"
Scenario: Create a ContextConfig with include patterns
Given a ContextConfig with include patterns "*.py,*.ts"
Then the context include_patterns should contain "*.py"
And the context include_patterns should contain "*.ts"
Scenario: Create a ContextConfig with custom max_file_size
Given a ContextConfig with max_file_size 2000000
Then the context max_file_size should be 2000000
Scenario: Create a ContextConfig with custom indexing strategy
Given a ContextConfig with indexing_strategy "semantic"
Then the context indexing_strategy should be "semantic"
Scenario: Create a ContextConfig with custom chunking policy
Given a ContextConfig with chunking_policy "fixed"
Then the context chunking_policy should be "fixed"
Scenario: Create a ContextConfig with custom chunk size
Given a ContextConfig with chunk_size 500
Then the context chunk_size should be 500
# B1.6c - Duplicate ignore patterns are deduplicated
Scenario: ContextConfig deduplicates ignore patterns that overlap with defaults
Given a ContextConfig with ignore patterns ".git/,node_modules/,custom/"
Then the context ignore_patterns should contain ".git/"
And the context ignore_patterns should contain "node_modules/"
And the context ignore_patterns should contain "custom/"
And the context ignore_patterns should not contain duplicate ".git/"