Skip to content

fix(graph): retain owner identities for generic Go methods - #418

Open
DivyamTalwar wants to merge 1 commit into
activeloopai:mainfrom
DivyamTalwar:fix/graph-go-generic-method-receivers
Open

DivyamTalwar wants to merge 1 commit into
activeloopai:mainfrom
DivyamTalwar:fix/graph-go-generic-method-receivers

Conversation

@DivyamTalwar

@DivyamTalwar DivyamTalwar commented Sep 23, 2026 •

Copy link
Copy Markdown

Summary

Fixes #417.

The extractor recognizes Box and *Box receiver types but not Box[T] or *Box[T]. Same-named methods on different generic types receive colliding bare IDs, lose ownership edges, and can disappear from the graph.

Resolve the base type of the existing parser's generic receiver node for both value and pointer receivers. Preserve type-qualified method IDs, method ownership, and call attribution. Native parser tests cover two generic types and non-generic controls.

Version Bump

No release requested. Package versions, dependencies, lockfiles and release workflows are unchanged.

Test plan

The repository-native focused tests report 3 failures and 17 passing controls on unchanged production source; the prepared correction passes all 20 focused tests. The final commit is independently validated by the full Node 22/Linux suite with coverage, typecheck, build, duplication guard and critical-only bundle audit. The workflow enforces zero failed and zero skipped tests.

Exact submitted commit: dab2b82f95f61c4bcf263e283d385a86aecbae95. Independent Linux job, commands and logs. The checkout is pinned to this commit, not a combined patch branch.

The focused tests use isolated files or source fixtures and the real parser/cache/usage code. No customer data, credentials or live model/backend calls are required.

Compatibility and limits

Does not add general method-dispatch inference or support arbitrary unresolved receiver syntax. The shared resolver, TypeScript extraction and graph schema remain unchanged. No performance improvement is claimed.

A clean full macOS suite and native Windows validation are not claimed. Upstream CI approval and maintainer review are separate from this passing independent gate.

Summary by CodeRabbit

  • Bug Fixes
    • Go code analysis now correctly associates methods with their base types when receivers use generic types, including value and pointer receivers.
    • Calls within generic methods are attributed to the owning method. Parenthesized receiver types continue to produce method entries without a type association.

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: activeloopai/hivemind/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: b473cf3e-37c7-4aa8-990f-c3b8432d46f6

📥 Commits

Reviewing files that changed from the base of the PR and between ce30de7 and dab2b82.

📒 Files selected for processing (2)
  • src/graph/extract/go.ts
  • tests/shared/graph/go.test.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The Go extractor now resolves generic receiver types to their base types. Tests cover type-qualified method IDs, ownership edges, call attribution, ordinary receivers, and parenthesized receivers.

Changes

Generic Go receiver resolution

Layer / File(s) Summary
Resolve and test generic receivers
src/graph/extract/go.ts, tests/shared/graph/go.test.ts
A new helper resolves base types from type identifiers and generic types. Receiver extraction uses it for value and pointer receivers. Tests check method IDs, ownership edges, call attribution, ordinary receivers, and parenthesized receivers.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to dab2b

The generic-receiver change is ready to merge after normal checks; no outstanding issue is established.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: preserving owner identities for generic Go methods. It is concise and directly matches the implementation and tests.
Description check ✅ Passed The description includes the required Summary, Version Bump, and Test plan sections. It explains the problem, scope, compatibility limits, release impact, and validation results in sufficient detail.
Linked Issues check ✅ Passed Issue #417 requires base-type resolution for generic value and pointer receivers, type-qualified method IDs, method_of ownership edges, call attribution, and native parser tests. `src/graph/extract/…
Out of Scope Changes check ✅ Passed The reviewed changes are limited to the Go receiver extraction logic and its native Go extractor tests. They do not change the shared resolver, TypeScript extraction, graph schema, dependencies, or ge…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generic Go receiver methods lose their owning type and collide

1 participant