GitNexus/gitnexus/test/fixtures/lang-resolution/ruby-nested-tail-collision/nested.rb
Gergo Magyar bb84ccb27e fix(ingestion): resolve same-tail Ruby mixin/attr_accessor owners to the correct qualified node (#1982)
emitRubyMixinEdges keyed its owner map by the SIMPLE tail (def.qualifiedName
split-popped) with last-wins, and the __heritage__/__property__ markers carried
only the immediate owner name — so `module Outer; class Inner` and
`module Other; class Inner` collapsed onto one `Inner` key and cross-wired their
include/attr_accessor edges onto whichever Inner was processed last.

Fix (lockstep, full-qualified):
- ruby/captures.ts: build the marker owner from the FULL enclosing class/module
  chain (buildEnclosingQualifiedName walks all ancestors, normalizing the compact
  `class Outer::Inner` scope_resolution form via the shared splitQualifiedName) so
  the marker owner byte-matches the resolution def's qualifiedName.
- ruby/scope-resolver.ts: key graphIdByName by the full def.qualifiedName instead
  of the simple tail. Top-level owners/mixins are unchanged (full == simple).

Registry-primary ruby.test.ts 142/142 incl. a new worker-path block (the deferred
note's duplicate-edge concern: markers survive worker serialization, exactly one
HAS_PROPERTY per attr). Legacy leg unaffected (136 pass / 6 skip) — new assertions
registry-primary-only via helpers.ts. tsc clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 07:37:02 +00:00

25 lines
625 B
Ruby

module OuterMix; end
module OtherMix; end
module Outer
class Inner
include OuterMix
attr_accessor :outer_attr
def from_outer; end
end
end
module Other
class Inner
include OtherMix
attr_accessor :other_attr
def from_other; end
end
end
# Unambiguous nested class (no same-tail sibling): exercises the routed-property
# (attr_accessor) owner path, which must resolve to the QUALIFIED owner and not
# dangle under qualifiedNodeId. Same-tail routed-property owner identity is a
# separate resolution-side concern (see ruby.test.ts).
module Shapes
class Circle
attr_accessor :radius
end
end