-
Notifications
You must be signed in to change notification settings - Fork 15
Add concurrency tests for ImportsValidator circular dependency detection #456
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or requesttestingTest coverage and qualityTest coverage and quality
Description
Category
Test Quality
Severity
Critical
Location
crates/agnix-core/src/rules/imports.rs
Description
The ImportsValidator handles complex graph traversal with circular dependency detection and depth limits, but existing tests only cover basic happy-path scenarios. Critical error paths are untested:
- No tests for circular chains involving 3+ files (A->B->C->A)
- No tests for concurrent cache access (despite using
RwLock<HashMap>) - No tests for error recovery when filesystem errors occur mid-traversal
- No tests for depth limit edge cases (exactly at limit, one over limit)
The code uses ImportCache = Arc<RwLock<HashMap<PathBuf, Vec<Import>>>> for shared state during parallel validation, but there are no concurrency tests.
Suggested Tests
#[test]
fn test_circular_import_three_files() {
// A imports B, B imports C, C imports A
}
#[test]
fn test_import_depth_exactly_at_limit() {
// Chain of exactly MAX_IMPORT_DEPTH files
}
#[test]
fn test_concurrent_import_cache_access() {
// Validate multiple files in parallel that share imports
}Effort
Medium
Found by /audit-project multi-agent review
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesttestingTest coverage and qualityTest coverage and quality