Skip to content

fix(ingestion): own generic Rust inherent-impl methods through the mod-qualified Impl node (#1992)#1997

Closed
magyargergo wants to merge 2 commits into
abhigyanpatwari:mainfrom
magyargergo:fix/1992-rust-generic-impl-ownership
Closed

fix(ingestion): own generic Rust inherent-impl methods through the mod-qualified Impl node (#1992)#1997
magyargergo wants to merge 2 commits into
abhigyanpatwari:mainfrom
magyargergo:fix/1992-rust-generic-impl-ownership

Conversation

@magyargergo

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #1981 / #1982. bc4a560d mod-qualified the unscoped bare impl Inner target; a generic inherent-impl target (impl<T> Inner<T>) was not.

The Impl node was already correctly mod-qualified for generic impls (the @name capture drills into the inner type_identifier, tree-sitter-queries.ts:1226). The defect was in the owner walk (findEnclosingClassInfo): its inherent-impl arm matched only type_identifier / scoped_type_identifier, so a generic_type target fell through, the walk returned null, and the method got File → DEFINES with no HAS_METHOD edge — orphaned, and invisible to findDanglingEdges.

Note: this corrects the issue's stated mechanism. The failure is method orphaning, not node-collapse/cross-wire, and the fix is single-site (the owner walk) — the node-materialization gates already fire correctly and are left untouched.

Fix

Single site in findEnclosingClassInfo: match a generic_type target, drill into its base (childForFieldName('type')), and qualify a bare type_identifier base via the same qualifyRustImplTargetByModScope the node side uses → owner id == node id byte-for-byte (a.Inner / b.Inner). A scoped-generic base (impl<T> a::Inner<T>) materializes no @definition.impl node, so it falls through with no owner (orphaned, deferred) rather than minting a phantom owner. Node-typed and Rust-impl-gated — no other language reaches the impl_item arm; no shared-walker change for other languages.

Tests

New rust-nested-tail-collision-generic fixture + tests:

  • fa / fb own through distinct mod-qualified Impl nodes (a.Inner / b.Inner) — fails pre-fix (methods orphan to File).
  • Negative guard: scoped-generic fd is not owned through a phantom node (deferred scope-out).
  • Worker-pool parity block (usedWorkerPool === true).

Verification

  • rust resolver suite: registry-primary leg 174/174, legacy leg 172 + 2 by-design skips — both green, including the worker path.
  • tsc --noEmit clean; prettier clean.
  • rust-captures-golden regenerated additively (4 insertions — the new fixture only); scope-capture tripwire unaffected.

Closes #1992.

🤖 Generated with Claude Code

…d-qualified Impl node (abhigyanpatwari#1992)

A generic inherent-impl target (`impl<T> Inner<T>`) is a `generic_type` node, which the inherent-impl owner walk (findEnclosingClassInfo) did not match — so the walk returned null and the method got `File -> DEFINES` with NO HAS_METHOD edge (orphaned, and invisible to findDanglingEdges). The Impl node was already correctly mod-qualified (the @name capture drills into the inner type_identifier, tree-sitter-queries.ts), so this is an owner-walk-only fix: drill into the generic base and mirror the node gate so the owner id == the node id byte-for-byte. A scoped-generic target (`impl<T> a::Inner<T>`) materializes no Impl node and is left orphaned (deferred) rather than minting a phantom owner.

The owner walk is shared by the sequential and worker paths. New fixture + tests assert positive HAS_METHOD ownership through distinct `a.Inner` / `b.Inner` nodes on both resolver legs and the worker path, plus a negative scoped-generic guard. rust-captures-golden regenerated additively for the new fixture.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 3, 2026

Copy link
Copy Markdown

@magyargergo is attempting to deploy a commit to the NexusCore Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

CI Report

Some checks failed

Pipeline Status

Stage Status Details
✅ Typecheck success tsc --noEmit
❌ Tests failure unit tests, 3 platforms
✅ E2E success gitnexus-web changes only

Test Results

Tests Passed Failed Skipped Duration
11060 11044 0 16 679s

✅ All 11044 tests passed

16 test(s) skipped — expand for details
  • COBOL pipeline benchmark > scales with file count
  • C++ ADL emit benchmark > emit phase scales sub-quadratically with co-scaled files and sites
  • C++ pipeline benchmark > scales with file count
  • C# pipeline benchmark > scales with file count — namespaces spread across the solution
  • C# pipeline benchmark > scales with file count — all types in one (global) namespace bucket
  • C# pipeline benchmark > scales with file count — all types in one (named) namespace bucket
  • Go pipeline benchmark > scales with file count (workers enabled)
  • Go pipeline benchmark — worker pool (issue Worker idle timeout kills long Go scope extraction and surfaces as Napi::Error during analyze #1848) > does not quarantine the large generated Go file on sub-batch idle timeout
  • Go structural interface detection benchmark > scales linearly with interface × struct count
  • Go structural interface detection split-phase benchmark > separates index-build and detection time
  • PHP pipeline benchmark > scales with file count (workers enabled)
  • Ruby pipeline benchmark > scales with file count (workers enabled)
  • Rust pipeline benchmark > scales with file count (workers enabled)
  • Vue pipeline benchmark > scales with component count
  • run.cjs direct-exec entrypoint (fix(cli): steer docs, skills, and hooks through a CLI-neutral project-local runner (#1939) #1945) > resolves a .cmd shim via the Windows shell branch, passing args and exit code
  • buildTypeEnv > known limitations (documented skip tests) > Ruby block parameter: users.each { |user| } — closure param inference, different feature

Code Coverage

Tests

Metric Coverage Covered Base Delta Status
Statements 80.32% 38698/48175 79.84% 📈 +0.5 🟢 ████████████████░░░░
Branches 68.87% 24594/35709 68.5% 📈 +0.4 🟢 █████████████░░░░░░░
Functions 85.55% 4033/4714 84.94% 📈 +0.6 🟢 █████████████████░░░
Lines 83.93% 34813/41474 83.36% 📈 +0.6 🟢 ████████████████░░░░

📋 View full run · Generated by CI

@magyargergo

Copy link
Copy Markdown
Collaborator Author

Superseded by same-repo stacked PR #2003 (rebased into a 5-PR stack for conflict-free one-by-one merge with auto-retarget).

@magyargergo magyargergo closed this Jun 3, 2026
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.

fix(ingestion): qualify Rust GENERIC inherent-impl target by mod scope (same-tail impl Inner<T> collapse)

1 participant