Summary
The cache system exists (cache.py) but currently only caches file hashes. Implement true incremental validation that:
- Tracks file modification times and content hashes
- Only re-analyzes files that changed since last validation
- Supports dependency-aware invalidation (if
a.py imports b.py and b.py changes, re-analyze a.py too)
Current State
The cache.py module exists but needs enhancement. The multi_file.py handles dependency analysis.
Implementation Plan
- Content-addressed cache: Store
{file_hash: ValidationResult} instead of {file_path: ValidationResult}
- Dependency graph: Build import graph, invalidate dependents when a file changes
- Incremental mode flag:
aitrust validate src/ --incremental
- Cache manifest: Store
.aitrust_cache/manifest.json with file paths, hashes, and timestamps
- Smart invalidation: Only re-analyze if file content hash changed
Performance Target
- First run: same as current (full analysis)
- Second run (no changes): <100ms (just cache lookup)
- Second run (1 file changed): analyze only that file + dependents
Acceptance Criteria
Difficulty
Advanced — requires careful cache invalidation logic and dependency tracking.
Summary
The cache system exists (
cache.py) but currently only caches file hashes. Implement true incremental validation that:a.pyimportsb.pyandb.pychanges, re-analyzea.pytoo)Current State
The
cache.pymodule exists but needs enhancement. Themulti_file.pyhandles dependency analysis.Implementation Plan
{file_hash: ValidationResult}instead of{file_path: ValidationResult}aitrust validate src/ --incremental.aitrust_cache/manifest.jsonwith file paths, hashes, and timestampsPerformance Target
Acceptance Criteria
--incrementalflag worksDifficulty
Advanced — requires careful cache invalidation logic and dependency tracking.