feat(callgraph): Add local stdlib registry loader with resolution#338
Merged
Conversation
Implements PR #2: Local filesystem loader for Python stdlib registries. **Core Implementation:** - Add stdlib_registry.go with data structures for Python 3.14 stdlib - StdlibRegistry, StdlibModule, StdlibFunction, StdlibClass - StdlibConstant, StdlibAttribute with full JSON mapping - Snake_case JSON tags to match Python-generated format - Add stdlib_registry_loader.go for local file loading - Loads manifest.json and all module JSON files - SHA256 checksum verification for data integrity - Graceful error handling (logs warnings, continues without stdlib) - Add stdlib_registry_loader_test.go with comprehensive coverage - Tests manifest loading, module loading, checksum validation - Tests with actual generated registries (188 modules) - Edge case handling (missing/corrupted files) **Resolution Integration:** - Add validateStdlibFQN() helper with module alias support - Handles os.path -> posixpath platform-specific aliasing - Checks functions, classes, constants, and attributes - Integrate stdlib validation into resolveCallTarget() - Checks stdlib before user project registry - Non-blocking: stdlib load failures don't break analysis **Test Results:** - All tests passing (gradle testGo) - Zero lint issues (gradle lintGo) - Successfully loads 188 modules from registries/python3.14/stdlib/v1/ - Resolution improvement: 64.7% -> 66.3% (+90 resolutions) **Integration:** - TypeInferenceEngine.StdlibRegistry field added - Loaded in BuildCallGraph() after builtin registry - Logs success: "Loaded stdlib registry: 188 modules" Related: PR #1 (Python stdlib registry generator) Next: PR #3 (remote registry hosting + deployment) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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 #338 +/- ##
==========================================
- Coverage 74.92% 74.20% -0.72%
==========================================
Files 43 45 +2
Lines 5176 5288 +112
==========================================
+ Hits 3878 3924 +46
- Misses 1140 1199 +59
- Partials 158 165 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Implements PR #2: Local filesystem loader for Python stdlib registries with call graph resolution integration.
Depends on: #337 (PR #1 - Python generator)
What's Changed
Go Data Structures (
stdlib_registry.go)All structs use snake_case JSON tags to match Python-generated format.
Local Loader (
stdlib_registry_loader.go)Features:
Resolution Integration (
builder.go)Resolution improvements:
Comprehensive Tests (
stdlib_registry_loader_test.go)Test Results
Build & Tests
Integration Test (pre-commit codebase)
Before PR #2:
After PR #2:
Registry Status:
Known Limitations
Resolution improvement lower than expected (+90 vs expected +700-900)
Module aliases - Only os.path → posixpath mapped
Type inference required for method calls on typed variables
logger.warning()requires knowingloggeris a Loggerf.read()requires knowingfis a file objectNext Steps
Follow-up PR (already in progress):
import os.pathpatternPR #3 (after this PR):
Part of: Production stdlib registry system (4 PRs total)
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com