Skip to content

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

Merged
shivasurya merged 2 commits intomainfrom
shiva/pr-05-golang-thirdparty
Apr 7, 2026
Merged

feat: Go resolution statistics in resolution-report command#645
shivasurya merged 2 commits intomainfrom
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

@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.37%. Comparing base (ca99cdd) to head (8605c1e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #645      +/-   ##
==========================================
+ Coverage   84.24%   84.37%   +0.12%     
==========================================
  Files         162      162              
  Lines       23358    23449      +91     
==========================================
+ Hits        19679    19785     +106     
+ Misses       2940     2918      -22     
- Partials      739      746       +7     

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

Copy link
Copy Markdown
Owner Author

shivasurya commented Apr 7, 2026

Merge activity

  • Apr 7, 8:35 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Apr 7, 8:43 PM UTC: Graphite rebased this pull request as part of a merge.
  • Apr 7, 8:43 PM UTC: @shivasurya merged this pull request with Graphite.

@shivasurya shivasurya changed the base branch from shiva/pr-04-golang-thirdparty to graphite-base/645 April 7, 2026 20:40
@shivasurya shivasurya changed the base branch from graphite-base/645 to main April 7, 2026 20:41
shivasurya and others added 2 commits April 7, 2026 20:42
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 <[email protected]>
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 <[email protected]>
@shivasurya shivasurya force-pushed the shiva/pr-05-golang-thirdparty branch from 5f5a0af to 8605c1e Compare April 7, 2026 20:42
@shivasurya shivasurya merged commit 87ba846 into main Apr 7, 2026
5 checks passed
@shivasurya shivasurya deleted the shiva/pr-05-golang-thirdparty branch April 7, 2026 20:43
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