feat(go): package-level var Source 3 + StdlibLoader embed resolution#643
Merged
shivasurya merged 1 commit intomainfrom Apr 7, 2026
Merged
feat(go): package-level var Source 3 + StdlibLoader embed resolution#643shivasurya merged 1 commit intomainfrom
shivasurya merged 1 commit intomainfrom
Conversation
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep Github App |
Code Pathfinder Security ScanNo security issues detected.
Powered by Code Pathfinder |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #643 +/- ##
==========================================
+ Coverage 84.22% 84.24% +0.01%
==========================================
Files 162 162
Lines 23327 23358 +31
==========================================
+ Hits 19648 19677 +29
- Misses 2940 2941 +1
- Partials 739 740 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5 tasks
Owner
Author
This was referenced Apr 7, 2026
Owner
Author
Merge activity
|
…d fix Fix F8: Add Source 3 to Pattern 1b in resolveGoCallTarget. Scans codeGraph.Nodes for module_variable nodes (var globalDB *sql.DB) in the same package as the caller when Source 1 (params) and Source 2 (scope) both fail. Reads type from node.DataType, strips pointer prefix, resolves via importMap. Extends resolveGoCallTarget signature to accept codeGraph; updates all call sites. Fix C: Add resolveEmbeddings method to GoThirdPartyLocalLoader. Tries StdlibLoader.GetType first (covers all stdlib interfaces like context.Context and sort.Interface), falls back to the hardcoded well-known table when StdlibLoader is unavailable. Add registry field to GoThirdPartyLocalLoader and pass it from InitGoThirdPartyLoader. resolveEmbeddings is called in getOrLoadPackage after extractGoPackageWithTreeSitter. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
02bc40f to
4b48d38
Compare
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
resolveGoCallTarget. When Source 1 (function params) and Source 2 (scope bindings) both fail, Source 3 scanscodeGraph.Nodesformodule_variablenodes in the same package as the caller. Readsnode.DataType(e.g.*sql.DB), strips pointer prefix, resolves via importMap. Fixes the one PoC failure:globalDB.Query()→database/sql.DB.Query. ExtendsresolveGoCallTargetsignature withcodeGraph *graph.CodeGraph.resolveEmbeddingsmethod toGoThirdPartyLocalLoader. TriesStdlibLoader.GetTypefirst (covers all stdlib interfaces:context.Context,sort.Interface, etc.), falls back to the hardcoded well-known table when StdlibLoader is nil. Addregistryfield to loader; wire viaInitGoThirdPartyLoader. Called ingetOrLoadPackageafter tree-sitter extraction.Test plan
TestSource3_PackageLevelVariable—var globalDB *sql.DBresolvesglobalDB.Query→database/sql.DB.QueryTestSource3_PointerType— leading*stripped from DataTypeTestSource3_SamePackageFilter— variable in different package is NOT resolvedTestSource3_NoTypeAnnotation— empty DataType skipped gracefullyTestSource3_NilCodeGraph— no panic with nil codeGraphTestResolveEmbeddings_ViaStdlibLoader—context.Contextmethods flattened via StdlibLoaderTestResolveEmbeddings_FallbackToWellKnown—io.Closer.Closeresolves without StdlibLoaderTestResolveEmbeddings_NilRegistryStdlibLoader— no panic, fallback firesTestResolveEmbeddings_DoesNotOverwriteExistingMethods— existing methods preservedTestResolveEmbeddings_SamePackageEmbedSkipped— same-package embeds ignoredgo test ./...— 29/29 packages passgolangci-lint run— 0 issues🤖 Generated with Claude Code