Skip to content

feat: Go resolution statistics in resolution-report command#645

Open
shivasurya wants to merge 2 commits intoshiva/pr-04-golang-thirdpartyfrom
shiva/pr-05-golang-thirdparty
Open

feat: Go resolution statistics in resolution-report command#645
shivasurya wants to merge 2 commits intoshiva/pr-04-golang-thirdpartyfrom
shiva/pr-05-golang-thirdparty

Conversation

@shivasurya
Copy link
Copy Markdown
Owner

Summary

  • Wires the full Go call graph pipeline into pathfinder resolution-report (same as scan.go): BuildGoModuleRegistryInitGoStdlibLoaderInitGoThirdPartyLoaderBuildGoCallGraphMergeCallGraphs, guarded by go.mod existence check
  • Adds Go-specific fields to resolutionStatistics: GoTotalCalls, GoResolvedCalls, GoUnresolvedCalls, GoUserCodeResolved, GoStdlibResolved, GoThirdPartyResolved, GoStdlibByModule, GoThirdPartyByModule
  • Classifies Go call sites using site.IsStdlib (authoritative for single-segment stdlib like fmt/os) and site.TypeSource ("thirdparty_local" / "thirdparty_cdn")
  • New helpers: extractGoModuleName, printTopModules, printGoResolutionStatistics
  • 9 new tests — all three new functions at 100% coverage, aggregateResolutionStatistics bumped to 100%

Why

Without this PR there is no way to measure Go resolution rates. The resolution report is the observability layer for the entire Go third-party resolution feature — it answers whether the 97%+ resolution target from the tech spec is being hit on real projects.

Dependencies

Stacked on PR-04 (shiva/pr-04-golang-thirdparty).

Expected output

Go Resolution Statistics:
  Total Go calls:       45
  Resolved:             42 (93.3%)
  Unresolved:           3 (6.7%)

  Resolution Breakdown:
    User code:          12 (28.6%)
    Stdlib (CDN):       20 (47.6%)
    Third-party:        10 (23.8%)

  Top Go Stdlib Modules:
     1. net/http                                    8 calls
     2. fmt                                         5 calls

  Top Go Third-Party Modules:
     1. gorm.io/gorm                                4 calls
     2. github.com/gin-gonic/gin                    3 calls

Test plan

  • go build ./cmd/... — zero errors
  • go test ./cmd/... -count=1 — all pass
  • golangci-lint run ./cmd/... — zero issues
  • CI green

🤖 Generated with Claude Code

Add Go call graph construction to `pathfinder resolution-report` (same
pipeline as scan.go: BuildGoModuleRegistry → InitGoStdlibLoader →
InitGoThirdPartyLoader → BuildGoCallGraph → MergeCallGraphs).

Classify Go call sites into user-code / stdlib / third-party using
site.IsStdlib (authoritative for single-segment packages like fmt/os)
and site.TypeSource ("thirdparty_local"/"thirdparty_cdn").

New helpers: extractGoModuleName (strips type name from FQN path),
printTopModules (sorts map by count, prints top N), printGoResolutionStatistics
(full Go stats section with module breakdown tables).

Add 9 new tests covering extractGoModuleName edge cases, printTopModules,
printGoResolutionStatistics variants (empty/stdlib/third-party/mixed), and
aggregateResolutionStatistics Go classification paths.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shivasurya shivasurya added the enhancement New feature or request label Apr 5, 2026
@shivasurya shivasurya self-assigned this Apr 5, 2026
@safedep
Copy link
Copy Markdown

safedep bot commented Apr 5, 2026

SafeDep Report Summary

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

No dependency changes detected. Nothing to scan.

View complete scan results →

This report is generated by SafeDep Github App

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

Code Pathfinder Security Scan

Pass Critical High Medium Low Info

No security issues detected.

Metric Value
Files Scanned 2
Rules 205

Powered by Code Pathfinder

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.38%. Comparing base (61d181d) to head (5f5a0af).

Additional details and impacted files
@@                        Coverage Diff                        @@
##           shiva/pr-04-golang-thirdparty     #645      +/-   ##
=================================================================
+ Coverage                          84.24%   84.38%   +0.14%     
=================================================================
  Files                                162      162              
  Lines                              23358    23449      +91     
=================================================================
+ Hits                               19677    19787     +110     
+ Misses                              2941     2917      -24     
- Partials                             740      745       +5     

☔ 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.

Add TestResolutionReportCmd_WithoutGoMod and TestResolutionReportCmd_WithGoMod
to exercise the Run function's new Go call graph construction block and
printGoResolutionStatistics call path, bringing patch coverage above threshold.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant