Skip to content

Audit and broaden snapshot coverage of indexer behavior.#251

Draft
jasonhawkharris wants to merge 1 commit into
scip-ruby/masterfrom
jhh/update-snapshots-and-e2e-tests
Draft

Audit and broaden snapshot coverage of indexer behavior.#251
jasonhawkharris wants to merge 1 commit into
scip-ruby/masterfrom
jhh/update-snapshots-and-e2e-tests

Conversation

@jasonhawkharris
Copy link
Copy Markdown

@jasonhawkharris jasonhawkharris commented Jun 3, 2026

Broaden snapshot coverage of indexer behavior

Adds 13 new snapshot fixtures under test/scip/testdata/ to cover indexer code paths that previously had no end-to-end test:

  • generics.rb — type_member, type_template, type_parameters
  • prepend_extend.rb — prepend and user-level extend Mod (existing mixin.rb only covers include)
  • singleton_class.rb — class << self definitions and class-instance variables
  • yield_block.rb — yield and yielded block params (YieldLoadArg / LoadYieldParams / YieldParamPresent)
  • super_call.rb — explicit-arg super(...) (complementing implicit_super_arg.rb)
  • metaprog.rb — define_method, method_missing, respond_to_missing?
  • typed_ignore.rb and typed_strong.rb — sigils not previously snapshotted
  • requires_ancestor.rb — T::Helpers.requires_ancestor
  • t_helpers.rb — T.must, T.assert_type!, T.absurd, T.bind, T.type_alias
  • nested_constants.rb — 4-level constant qualifier walks in class names, ancestors, and references (exercises saveQualifierReferences recursion)
  • abstract_interface.rb — abstract!, interface!, sealed!, mixes_in_class_methods (existing singleton.rb only covers final!)
  • requires.rb — require from top-level and method bodies, plus require_relative

This PR makes no changes to indexer code. It only adds fixtures and the snapshots they produce, locking in current behavior so future regressions are caught.

Several snapshots document existing behavior that may be worth follow-up fixes (intentionally captured as-is rather than silently changed):

  • Elem = type_member is emitted as a plain definition local, suggesting the Descriptor::TypeParameter / Descriptor::Type branches in SCIPSymbolRef.cc:95–103 are unreachable.
  • c.hello on a prepended module resolves to the included module's method, ignoring prepend ordering. prepend/user extend do not surface is_reference relationships for shared fields.
  • class << self emits a spurious Class:K# definition at the self token (matching the pre-existing BUG comment in field_inheritance.rb).
  • super(arg) emits no reference to the parent method.
  • T.absurd(x) swallows the x argument occurrence.
  • typed: ignore does not suppress indexer output.
  • Class-to-superclass is_definition relationships are not emitted on a class's SymbolInformation — only the docstring class K2 < K1 carries the info.

Motivation

Auditing the emission paths in scip_indexer/SCIPIndexer.cc, SCIPSymbolRef.cc, and SCIPFieldResolve.cc surfaced a number of distinct code paths — entire cfg::Tag cases, symbol kinds, and Ruby DSL constructs — that emit occurrences, symbols, or relationships but had no snapshot exercising them. That left the indexer with silent failure modes: a refactor or upstream Sorbet merge could change observable output for these constructs without any test catching it. This PR closes those gaps so the snapshot suite documents what the indexer actually does for each construct.

Test plan

All 13 new fixtures pass under both ./bazel test --spawn_strategy=local //test/scip:update_ (snapshot generation) and ./bazel test //test/scip: (deterministic comparison). The full SCIP test suite (//test/scip:scip, 59 tests) passes.

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.

1 participant