Skip to content

feat: resolve stdlib call: attribute placeholders via CDN registry - #618

Merged
shivasurya merged 4 commits into
mainfrom
shiva/gap-stdlib-attr-propagation
Mar 24, 2026
Merged

shivasurya merged 4 commits into
mainfrom
shiva/gap-stdlib-attr-propagation

Conversation

@shivasurya

Copy link
Copy Markdown
Owner

Summary

  • Resolve call: placeholders in the attribute registry using stdlib/third-party CDN registries
  • Extract dotted function calls (sqlite3.connect()) as call: placeholders in attribute extraction
  • Add GetCachedModule method for cache-safe registry lookups
  • Use silentLogger to prevent nil-pointer panics during lazy CDN module downloads

Changes

  • resolution/attribute.go: Add resolveCallPlaceholderViaRegistry + tryRegistryLookup fallback in ResolveAttributePlaceholders
  • resolution/attribute_test.go: Tests for stdlib function, constructor, thirdparty, priority, edge cases
  • extraction/attributes.go: Handle attribute nodes (dotted calls) in inferFromFunctionCall
  • registry/stdlib_remote.go: Add GetCachedModule method
  • registry/thirdparty_remote.go: Add GetCachedModule method

Test plan

  • All 29 packages pass (zero regressions)
  • 100% coverage on resolveCallPlaceholderViaRegistry and tryRegistryLookup
  • Stdlib function return type resolution (sqlite3.connect → sqlite3.Connection)
  • Stdlib constructor resolution (configparser.ConfigParser)
  • Thirdparty resolution (redis.Redis)
  • Project ReturnTypes takes priority over stdlib
  • E2E: pyload 153 new type-inferred resolutions, label-studio 19

🤖 Generated with Claude Code

@shivasurya shivasurya added enhancement New feature or request go Pull requests that update go code labels Mar 24, 2026
@shivasurya shivasurya self-assigned this Mar 24, 2026
@shivasurya shivasurya added enhancement New feature or request go Pull requests that update go code labels Mar 24, 2026
@safedep

safedep Bot commented Mar 24, 2026 •

Copy link
Copy Markdown

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

This report is generated by SafeDep Github App

@github-actions

github-actions Bot commented Mar 24, 2026 •

Copy link
Copy Markdown

Code Pathfinder Security Scan

Pass Critical High Medium Low Info

No security issues detected.

Metric Value
Files Scanned 8
Rules 88

Powered by Code Pathfinder

@codecov

codecov Bot commented Mar 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.77%. Comparing base (975305a) to head (9f5e381).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #618      +/-   ##
==========================================
+ Coverage   83.66%   83.77%   +0.10%     
==========================================
  Files         155      155              
  Lines       21149    21298     +149     
==========================================
+ Hits        17695    17843     +148     
  Misses       2801     2801              
- Partials      653      654       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from shiva/gap-attribute-access to main March 24, 2026 23:09
shivasurya and others added 4 commits March 24, 2026 19:12
…stry

When ResolveAttributePlaceholders encounters a call: placeholder like
'call:sqlite3.connect' that doesn't match a project function, it now
falls back to checking the stdlib and third-party CDN registries for
the function's return type or constructor. This resolves attribute types
for stdlib calls (e.g., sqlite3.connect → sqlite3.Connection) and
constructors (e.g., configparser.ConfigParser), enabling deep chain
resolution through stdlib intermediate types.

Project ReturnTypes lookup still takes priority over stdlib fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Edge case tests for resolveCallPlaceholderViaRegistry and tryRegistryLookup:
- nil typeEngine safety
- single-part funcName (no dots) skipped
- unknown/empty return type skipped
- stdlib checked before thirdparty (ordering guarantee)
- thirdparty constructor fallback
- unknown module stays unresolved

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tion

Three fixes to complete the stdlib attribute type propagation:

1. extraction/attributes.go: Handle attribute nodes (dotted calls like
   sqlite3.connect) in inferFromFunctionCall, not just identifiers. This
   creates call:sqlite3.connect placeholders for self.conn = sqlite3.connect().

2. resolution/attribute.go: Use a silentLogger (io.Discard writer) for
   stdlib/thirdparty registry lookups instead of nil, preventing panic
   when modules need to be lazy-loaded from CDN during attribute resolution.

3. registry/{stdlib,thirdparty}_remote.go: Add GetCachedModule() method
   for cache-only lookups without CDN downloads.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cover all lines flagged by Codecov:
- extraction/attributes.go: dotted call extraction (sqlite3.connect)
- registry/stdlib_remote.go: GetCachedModule
- registry/thirdparty_remote.go: GetCachedModule

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shivasurya
shivasurya force-pushed the shiva/gap-stdlib-attr-propagation branch from a3a8040 to 9f5e381 Compare March 24, 2026 23:26
@shivasurya
shivasurya merged commit 4dffef2 into main Mar 24, 2026
8 checks passed
@shivasurya
shivasurya deleted the shiva/gap-stdlib-attr-propagation branch March 24, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant