-
Notifications
You must be signed in to change notification settings - Fork 10
refactor(callgraph): Create resolution package and complete extraction package (PR #4) #375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep Github App |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #375 +/- ##
==========================================
- Coverage 79.85% 78.23% -1.63%
==========================================
Files 78 83 +5
Lines 6886 6914 +28
==========================================
- Hits 5499 5409 -90
- Misses 1157 1266 +109
- Partials 230 239 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
shivasurya
added a commit
that referenced
this pull request
Nov 15, 2025
Improve test coverage for resolution/inference.go from 26% to >90%: ## New Test Coverage ### ResolveVariableType Function - Test variable type resolution from function returns - Test confidence decay calculation (1.0 * 0.8 * 0.95 = 0.76) - Test with different base confidence levels - Test with non-existent functions (returns nil) ### UpdateVariableBindingsWithFunctionReturns Function - Test resolving "call:funcName" placeholders - Test qualified function names (e.g., "logging.getLogger") - Test module-level scope resolution - Test function scope resolution with nested paths - Test unresolved function calls (remain as placeholders) - Test nil type handling (edge case, no panic) ## Test Scenarios Covered 1. **Simple name resolution**: call:create_user → myapp.controllers.create_user 2. **Qualified name resolution**: call:logging.getLogger → logging.getLogger 3. **Module-level scope**: No dots in FunctionFQN, append to module path 4. **Function scope**: Strip function name, add called function 5. **Non-existent returns**: Placeholder remains unchanged 6. **Nil type safety**: No panic on nil types ## Coverage Impact Before: 28 missing lines in inference.go (26.31% coverage) After: All critical paths covered (>90% coverage) This addresses the coverage gap reported in PR #375 review. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
This was referenced Nov 15, 2025
Owner
Author
This was referenced Nov 15, 2025
This was referenced Nov 15, 2025
Owner
Author
Merge activity
|
…n package Complete Phase 2 PR #4: AST Extraction Features (~2000 LOC migrated) ## New Packages Created ### resolution/ - imports.go (297 lines) - Import extraction and relative import resolution - callsites.go (271 lines) - Call site extraction with argument tracking - inference.go (155 lines) - Type inference engine with scope management - return_type.go (404 lines) - Return type analysis and class instantiation ### extraction/ - attributes.go (540 lines) - Class attribute extraction with type inference - variables.go (421 lines) - Variable assignment extraction and type tracking ## Backward Compatibility Created type aliases and wrapper functions in original files: - imports.go → calls resolution.ExtractImports - callsites.go → calls resolution.ExtractCallSites - type_inference.go → type aliases to resolution package - attribute_extraction.go → calls extraction.ExtractClassAttributes - variable_extraction.go → calls extraction.ExtractVariableAssignments - return_type.go → documentation only (signatures changed) ## Test Migration Moved 10 test files to new packages: - 7 tests to resolution/ (imports, callsites, inference, return_type) - 3 tests to extraction/ (attributes, variables) - Updated all imports and package declarations - Fixed type mismatches and relative paths - All tests passing with 100% success rate ## Build Verification - ✅ gradle buildGo - SUCCESS - ✅ gradle testGo - ALL PASSING - ✅ gradle lintGo - 0 issues Related to PR #4 specification document 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Improve test coverage for resolution/inference.go from 26% to >90%: ## New Test Coverage ### ResolveVariableType Function - Test variable type resolution from function returns - Test confidence decay calculation (1.0 * 0.8 * 0.95 = 0.76) - Test with different base confidence levels - Test with non-existent functions (returns nil) ### UpdateVariableBindingsWithFunctionReturns Function - Test resolving "call:funcName" placeholders - Test qualified function names (e.g., "logging.getLogger") - Test module-level scope resolution - Test function scope resolution with nested paths - Test unresolved function calls (remain as placeholders) - Test nil type handling (edge case, no panic) ## Test Scenarios Covered 1. **Simple name resolution**: call:create_user → myapp.controllers.create_user 2. **Qualified name resolution**: call:logging.getLogger → logging.getLogger 3. **Module-level scope**: No dots in FunctionFQN, append to module path 4. **Function scope**: Strip function name, add called function 5. **Non-existent returns**: Placeholder remains unchanged 6. **Nil type safety**: No panic on nil types ## Coverage Impact Before: 28 missing lines in inference.go (26.31% coverage) After: All critical paths covered (>90% coverage) This addresses the coverage gap reported in PR #375 review. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
c36b4d1 to
e492089
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Summary
Complete Phase 2 PR #4: AST Extraction Features by creating the
resolutionpackage and completing theextractionpackage. This PR migrates ~2000 LOC from 6 files into a clean hierarchical structure while maintaining full backward compatibility.New Package Structure
resolution/ Package (1,127 lines)
Consolidates all resolution logic for imports, callsites, and type inference:
from .. import module)extraction/ Package (961 lines)
Completes the extraction layer for Python AST analysis:
Backward Compatibility
All original files updated with wrapper functions and type aliases:
Note:
return_type.gocontains documentation only (no wrapper) due to signature changes requiring direct migration toresolutionpackage.Test Migration
Moved 10 test files to new packages with full updates:
All test fixtures and relative paths adjusted for new locations.
Build Verification
✅ gradle buildGo - SUCCESS
✅ gradle testGo - ALL PASSING (100% pass rate)
✅ gradle lintGo - 0 issues
Files Changed (26 files, +2389/-2241 lines)
New Files
resolution/imports.goresolution/callsites.goresolution/inference.goresolution/return_type.goextraction/attributes.goextraction/variables.goModified Files (Backward Compatibility)
imports.go→ wrapper to resolutioncallsites.go→ wrapper to resolutiontype_inference.go→ type aliases to resolutionattribute_extraction.go→ wrapper to extractionvariable_extraction.go→ wrapper to extractionreturn_type.go→ documentation onlybuilder.go→ updated all imports and callsTest Migrations
Breaking Changes
None for most users. Direct imports of functions continue to work through wrappers.
Only breaking change: Code directly using
ExtractReturnTypesorResolveClassInstantiationmust update to:Dependencies
Built on top of:
Related
/Users/shiva/src/shivasurya/cpf_plans/pr-details/refactor/pr-04-ast-extraction.md🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]