Audit and broaden snapshot coverage of indexer behavior.#251
Audit and broaden snapshot coverage of indexer behavior.#251jasonhawkharris wants to merge 1 commit into
Conversation
|
|
||
| class GenericBox | ||
| # ^^^^^^^^^^ definition [..] GenericBox# | ||
| extend T::Sig |
There was a problem hiding this comment.
Should T::Sig have some sort of snapshot signal?
There was a problem hiding this comment.
It should but because it's an artificial type that is part of sorbet it's fine to skip, for the time being. I assume it hasn't been supported before your changes.
FYI, in scip-ruby we currently treat super class as reference instead of inheritance relationship. This is also acceptable for now and could be fixed but only in a separate PR.
| require 'json' | ||
| #^^^^^^^ reference [..] Kernel#require(). | ||
| require 'set' | ||
| #^^^^^^^ reference [..] Kernel#require(). | ||
| require_relative 'non_existent_helper' | ||
| #^^^^^^^^^^^^^^^^ reference [..] Kernel#require_relative(). |
There was a problem hiding this comment.
Should there be some kind of marker for 'json', 'set' and 'non_existent_helper'
|
|
||
| module Greetable | ||
| # ^^^^^^^^^ definition [..] Greetable# | ||
| extend T::Helpers |
There was a problem hiding this comment.
Same as before, should there be a marker for T::Helpers?
| sig { abstract.returns(String) } | ||
| # ^^^^^^ reference [..] String# |
There was a problem hiding this comment.
No reference for `sig {abstract.returns}?
There was a problem hiding this comment.
I'm not sure what abstract means in this context but this also feels fine.
| super(name) | ||
| # ^^^^ reference local 1$4213039946 |
There was a problem hiding this comment.
should super() have a reference?
There was a problem hiding this comment.
Ideally yes. But, as mentioned in another comment, inheritance relationship handling is awkward in this indexer.
| sig { params(x: T.nilable(String)).returns(Integer) } | ||
| # ^^^^^^ reference [..] String# |
There was a problem hiding this comment.
Should 'x' have a definition marker here?
There was a problem hiding this comment.
Ideally yes. But it's technically defined in line 14. If the indexer hasn't been covering it before I'd leave it as is.
| else | ||
| T.absurd(x) | ||
| end |
There was a problem hiding this comment.
Seems strange that there would be no markers here.
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_parametersprepend_extend.rb— prepend and user-level extend Mod (existing mixin.rb only covers include)singleton_class.rb— class << self definitions and class-instance variablesyield_block.rb— yield and yielded block params (YieldLoadArg / LoadYieldParams / YieldParamPresent)super_call.rb— explicit-arg super(...) (complementingimplicit_super_arg.rb)metaprog.rb— define_method, method_missing, respond_to_missing?typed_ignore.rbandtyped_strong.rb— sigils not previously snapshottedrequires_ancestor.rb— T::Helpers.requires_ancestort_helpers.rb— T.must, T.assert_type!, T.absurd, T.bind, T.type_aliasnested_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_relativeThis 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.
Motivation
Auditing the emission paths in
scip_indexer/SCIPIndexer.cc,SCIPSymbolRef.cc, andSCIPFieldResolve.ccsurfaced 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.