Commit bb3f485
fix: Implement transitive dependency resolution for NuGet packages (#13)
* fix: Implement transitive dependency resolution for NuGet packages
- Enhanced NuGetPackageResolver to recursively resolve transitive dependencies
- Added session-based concurrent caching to prevent duplicate resolution
- Improved dependency filtering to handle Microsoft.Extensions packages properly
- Fixed ExamplesTests path resolution to work in Docker containers
- Updated AutoMapper test to include required logging services
- Added Docker examples directory copy for container testing
Resolves transitive dependency issues where packages like AutoMapper 15.0.1
would fail due to missing dependencies like Microsoft.Extensions.DependencyInjection.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* refactor: Address Claude review feedback for NuGetPackageResolver
- Add recursion depth limit (MaxRecursionDepth = 10) to prevent infinite loops
- Extract framework version constant (TargetFramework = "net9.0")
- Replace Console.WriteLine with proper logger.LogWarning calls
- Improve method signatures to pass depth parameter through recursive calls
- Add depth checking at start of ResolveTransitiveDependenciesAsync
Addresses critical issues identified in automated code review:
- Prevents potential stack overflow from circular dependencies
- Improves maintainability with extracted constants
- Uses proper logging infrastructure instead of direct console output
- Maintains existing error handling behavior while improving visibility
All 25 tests continue to pass with these robustness improvements.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* test: Add comprehensive test coverage for NuGet resolver improvements
Added 5 new tests covering critical functionality:
1. **EvalCSharp_WithDeeplyNestedDependencies_HandlesRecursionDepthLimit**:
- Tests that recursion depth handling works correctly
- Verifies no "Maximum recursion depth" warnings appear in normal operation
2. **EvalCSharp_WithFrameworkConstants_UsesCorrectTargetFramework**:
- Validates extracted TargetFramework constant is used correctly
- Tests compatibility with net9.0 packages
3. **EvalCSharp_WithInvalidPackageReference_ShowsProperError**:
- Tests improved error handling for non-existent packages
- Validates clear error messages without silent failures
4. **EvalCSharp_WithMalformedNuGetDirective_ShowsValidationError**:
- Tests directive validation improvements
- Ensures malformed syntax shows helpful error messages
5. **EvalCSharp_WithMicrosoftExtensionsPackage_HandlesFilteringCorrectly**:
- Tests dependency filtering allows Microsoft.Extensions packages
- Validates transitive dependency resolution for common scenarios
Updated existing **EvalCSharp_WithNuGetPackageWithTransitiveDependencies_ResolvesAllDependencies**:
- Simplified to use stable Newtonsoft.Json package
- Maintains transitive dependency validation without version conflicts
Total test count: 30 tests (was 25)
All tests pass, providing comprehensive coverage for recursion limits,
error handling, framework constants, and dependency filtering improvements.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* refactor: Address additional review feedback for robustness
**Constants Extraction:**
- Extract MicrosoftExtensionsStableVersion = "8.0.0" constant
- Replace remaining hardcoded framework version strings with TargetFramework constant
- Improve code maintainability with centralized version management
**Network Timeout Configuration:**
- Add NetworkOperationTimeout = 30 seconds constant
- Implement timeout handling for all network operations using CancellationTokenSource
- Add specific timeout error messages to distinguish from other failures
- Prevent hanging on network operations in production environments
**Resource Management Validation:**
- Confirmed all MemoryStream instances already use proper 'using' statements
- No resource leak risks identified in current implementation
**Error Handling Enhancement:**
- Add specific timeout exception handling with clear error messages
- Maintain existing error handling behavior while improving visibility
- Network timeouts now provide actionable feedback to users
All 30 tests continue to pass with these robustness improvements.
Addresses medium priority concerns from automated code review.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* feat: Add network timeout test and code analysis improvements
- Add comprehensive network timeout test using cancellation token
- Implement GeneratedRegex for improved performance
- Add Microsoft.CodeAnalysis.Analyzers to both projects
- Fix test assertions to handle NuGet error message variations
- Ensure complete branch coverage for timeout scenarios
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix: Improve error handling and eliminate duplicate package downloads
- Replace silent error handling with proper error classification
- Add IsExpectedDependencyFailure() to distinguish built-in vs real failures
- Implement dependency caching to avoid re-downloading packages
- Read assemblies and dependencies in single download operation
- Add comprehensive logging for unresolved dependencies
- Maintain performance while improving observability
Addresses review feedback on silent error swallowing and duplicate work.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>1 parent 4174a74 commit bb3f485
File tree
10 files changed
+622
-276
lines changed- .vscode
- src/InfinityFlow.CSharp.Eval
- Tools
- tests/InfinityFlow.CSharp.Eval.Tests
10 files changed
+622
-276
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
25 | 26 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| |||
0 commit comments