Skip to content

Commit 7c8263b

Browse files
fix(tests): configuration management system
changes: - file: command_handlers.py area: cli modified: [_show_general_info, check_command, validate_command, batch_command] - file: settings_builders.py area: cli modified: [build_validate_settings, build_batch_settings] - file: config.py area: config modified: [VallmSettings] - file: scoring.py area: core modified: [_get_default_validators] - file: regression.py area: core added: [_parse_failures, _resolve_test_dir, validate, _interpret, _run_pytest, _timeout_result, +5 more] - file: conftest.py area: test added: [Client] modified: [disable_external_calls] - file: test_pipeline.py area: test added: [DummyRegressionValidator, validate] new_tests: 1 - file: test_regression_validator.py area: test added: [TestInterpret, TestParseFailures, setup_method, _make_proposal, TestErrorHelpers, TestValidate, +2 more] new_tests: 24 testing: new_tests: 25 scenarios: - pipeline_includes_regression_validator - pytest_usage_error - tests_failed_with_failed_lines - pytest_internal_error - validate_passes - cmd_includes_test_dir - validator_name - no_tests_collected - tests_failed_no_failed_lines - pytest_interrupted # +15 more stats: lines: "+613/-18 (net +595)" files: 9 complexity: "Large structural change (normalized)"
1 parent ffebd15 commit 7c8263b

File tree

13 files changed

+626
-21
lines changed

13 files changed

+626
-21
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,4 @@ htmlcov/
9999
# Backup files
100100
*.bak
101101
*.backup
102+
.aider*

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
124124
- **Tree-sitter for all** — syntax validation for 165+ languages
125125
- **Example 07** — comprehensive multi-language demo with 8 languages
126126

127+
## [0.1.52] - 2026-03-24
128+
129+
### Test
130+
- Update tests/conftest.py
131+
- Update tests/test_pipeline.py
132+
- Update tests/test_regression_validator.py
133+
134+
### Other
135+
- Update .gitignore
136+
127137
## [0.1.51] - 2026-03-23
128138

129139
### Docs

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.51
1+
0.1.52

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "vallm"
7-
version = "0.1.51"
7+
version = "0.1.52"
88
description = "A complete toolkit for validating LLM-generated code"
99
readme = "README.md"
1010
license = "Apache-2.0"

src/vallm/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
"detect_language",
1717
]
1818

19-
__version__ = "0.1.51"
19+
__version__ = "0.1.52"

src/vallm/cli/command_handlers.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from vallm.core.proposal import Proposal
1616

1717
console = Console()
18+
OUTPUT_FORMAT_HELP = "Output format"
1819

1920

2021
def validate_command(
@@ -25,8 +26,9 @@ def validate_command(
2526
config: Optional[Path] = typer.Option(None, "--config", help="Path to vallm.toml"),
2627
enable_semantic: bool = typer.Option(False, "--semantic", help="Enable LLM-as-judge"),
2728
enable_security: bool = typer.Option(False, "--security", help="Enable security checks"),
29+
enable_regression: bool = typer.Option(False, "--regression", help="Enable regression tests"),
2830
model: Optional[str] = typer.Option(None, "--model", "-m", help="LLM model for semantic"),
29-
output_format: str = typer.Option("rich", "--output", "-o", help="Output format"),
31+
output_format: str = typer.Option("rich", "--output", "-o", help=OUTPUT_FORMAT_HELP),
3032
verbose: bool = typer.Option(False, "--verbose", "-v", help="Show detailed results"),
3133
exit_on_verdict: bool = typer.Option(False, "--exit", help="Exit with non-zero on fail/review"),
3234
) -> None:
@@ -41,7 +43,14 @@ def validate_command(
4143
detected_language = _detect_and_log_language(file, language)
4244

4345
# Build settings
44-
settings = build_validate_settings(config, enable_semantic, enable_security, model, verbose)
46+
settings = build_validate_settings(
47+
config,
48+
enable_semantic,
49+
enable_security,
50+
enable_regression,
51+
model,
52+
verbose,
53+
)
4554

4655
# Create proposal
4756
proposal = _build_proposal(code_str, detected_language, ref_code, file)
@@ -79,7 +88,7 @@ def check_command(
7988
from vallm.scoring import validate
8089

8190
# Only enable syntax validator
82-
settings = build_validate_settings(None, False, False, None, False)
91+
settings = build_validate_settings(None, False, False, False, None, False)
8392
settings.enable_syntax = True
8493
settings.enable_imports = False
8594
settings.enable_complexity = False
@@ -100,10 +109,11 @@ def batch_command(
100109
use_gitignore: bool = typer.Option(True, "--gitignore/--no-gitignore", help="Respect .gitignore"),
101110
enable_semantic: bool = typer.Option(False, "--semantic", help="Enable LLM-as-judge"),
102111
enable_security: bool = typer.Option(False, "--security", help="Enable security checks"),
112+
enable_regression: bool = typer.Option(False, "--regression", help="Enable regression tests"),
103113
no_imports: bool = typer.Option(False, "--no-imports", help="Skip import validation (faster)"),
104114
no_complexity: bool = typer.Option(False, "--no-complexity", help="Skip complexity analysis (faster)"),
105115
model: Optional[str] = typer.Option(None, "--model", "-m", help="LLM model for semantic"),
106-
format: str = typer.Option("rich", "--format", "-f", help="Output format"),
116+
format: str = typer.Option("rich", "--format", "-f", help=OUTPUT_FORMAT_HELP),
107117
output: Optional[Path] = typer.Option(None, "--output", "-o", help="Output directory"),
108118
fail_fast: bool = typer.Option(False, "--fail-fast", help="Stop on first failure"),
109119
verbose: bool = typer.Option(False, "--verbose", "-v", help="Show detailed validation results for each file"),
@@ -113,7 +123,15 @@ def batch_command(
113123
from vallm.cli.batch_processor import BatchProcessor
114124
processor = BatchProcessor(console)
115125

116-
settings = build_batch_settings(enable_semantic, enable_security, model, verbose, no_imports, no_complexity)
126+
settings = build_batch_settings(
127+
enable_semantic,
128+
enable_security,
129+
enable_regression,
130+
model,
131+
verbose,
132+
no_imports,
133+
no_complexity,
134+
)
117135

118136
results_by_language, failed_files, passed_count, filtered_files = processor.process_batch(
119137
paths=paths,
@@ -309,13 +327,14 @@ def _show_general_info() -> None:
309327
console.print(" 2. Import validation - Module resolution checking")
310328
console.print(" 3. Complexity analysis - Cyclomatic complexity metrics")
311329
console.print(" 4. Security analysis - Security pattern detection")
312-
console.print(" 5. Semantic analysis - LLM-powered code review")
330+
console.print(" 5. Regression testing - Pytest-based regression checks")
331+
console.print(" 6. Semantic analysis - LLM-powered code review")
313332

314333
# Show cache stats
315334
cache_stats = get_semantic_cache().get_cache_stats()
316-
console.print(f"\n[bold]Semantic Cache:[/bold]")
335+
console.print("\n[bold]Semantic Cache:[/bold]")
317336
console.print(f" Cached entries: {cache_stats['total_entries']}")
318-
console.print(f" Use 'vallm info --clear-cache' to clear cache")
337+
console.print(" Use 'vallm info --clear-cache' to clear cache")
319338

320339
console.print("\n[bold]Import Validation Languages:[/bold]")
321340
factory = ImportValidatorFactory()

src/vallm/cli/settings_builders.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def build_validate_settings(
1212
config: Optional[Path],
1313
enable_semantic: bool,
1414
enable_security: bool,
15+
enable_regression: bool,
1516
model: Optional[str],
1617
verbose: bool,
1718
) -> VallmSettings:
@@ -27,6 +28,8 @@ def build_validate_settings(
2728
settings.enable_semantic = enable_semantic
2829
if enable_security:
2930
settings.enable_security = enable_security
31+
if enable_regression:
32+
settings.enable_regression = enable_regression
3033
if model:
3134
settings.llm_model = model
3235
if verbose:
@@ -38,6 +41,7 @@ def build_validate_settings(
3841
def build_batch_settings(
3942
enable_semantic: bool,
4043
enable_security: bool,
44+
enable_regression: bool,
4145
model: Optional[str],
4246
verbose: bool,
4347
no_imports: bool,
@@ -49,6 +53,7 @@ def build_batch_settings(
4953
# Override with command line options
5054
settings.enable_semantic = enable_semantic
5155
settings.enable_security = enable_security
56+
settings.enable_regression = enable_regression
5257
if model:
5358
settings.llm_model = model
5459
settings.verbose = verbose

src/vallm/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class VallmSettings(BaseSettings):
2525
enable_imports: bool = True
2626
enable_complexity: bool = True
2727
enable_security: bool = False
28+
enable_regression: bool = False
2829
enable_semantic: bool = False
2930

3031
# Complexity limits

src/vallm/scoring.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def validate(
141141
settings = _initialize_settings(settings)
142142
context = _initialize_context(context)
143143
validators = _initialize_validators(validators, settings)
144-
144+
145145
results = _run_validation_pipeline(proposal, validators, context, settings)
146146
return compute_verdict(results, settings, proposal.filename)
147147

@@ -160,14 +160,14 @@ def _initialize_validators(validators: Optional[list], settings: VallmSettings)
160160
"""Initialize validators with defaults if not provided and sort by tier."""
161161
if validators is None:
162162
validators = _get_default_validators(settings)
163-
163+
164164
# Sort validators by tier for fail-fast behavior
165165
validators.sort(key=lambda v: v.tier)
166166
return validators
167167

168168

169-
def _run_validation_pipeline(proposal: Proposal, validators: list,
170-
context: dict, settings: VallmSettings) -> list:
169+
def _run_validation_pipeline(proposal: Proposal, validators: list,
170+
context: dict, settings: VallmSettings) -> list:
171171
"""Run the validation pipeline and collect results."""
172172
results = []
173173
for validator in validators:
@@ -177,7 +177,7 @@ def _run_validation_pipeline(proposal: Proposal, validators: list,
177177
# Fail fast on errors in tier 1
178178
if result.has_errors and validator.tier == 1:
179179
return results
180-
180+
181181
return results
182182

183183

@@ -205,6 +205,11 @@ def _get_default_validators(settings: VallmSettings) -> list:
205205

206206
validators.append(SecurityValidator())
207207

208+
if getattr(settings, "enable_regression", False):
209+
from vallm.validators.regression import RegressionValidator
210+
211+
validators.append(RegressionValidator())
212+
208213
if settings.enable_semantic:
209214
from vallm.validators.semantic import SemanticValidator
210215

0 commit comments

Comments
 (0)