Add GraphQL::Schema::Type helpers needed for query-time __typename filtering#1161
Merged
myronmarston merged 3 commits intoblock:mainfrom May 2, 2026
Merged
Conversation
myronmarston
requested changes
May 1, 2026
Collaborator
myronmarston
left a comment
There was a problem hiding this comment.
Thanks for spinning this off!
myronmarston
requested changes
May 2, 2026
…ltering This is a companion/pre-requisite PR to add methods supporting __typename filter injection when querying mixed-type indexes via index inheritance. * `source_type`: resolves the underlying document type for derived types (e.g. indexed aggregations) so the filter can look up search indexes on the source rather than the aggregation type * `subtypes`: declared in RBS so Steep-checked callers can use it * `non_subtypes_in_shared_index`: identifies concrete types sharing an index with this type that are not subtypes — the presence of any such types is what triggers the need for a __typename filter
- `source_type`: restore `&.` safe navigation since `@object_runtime_metadata` can be nil for non-object types (scalars, enums); return `nil` instead of `self` for non-derived types; update `search_index_definitions` to branch on `source_type` truthy rather than `indexed_aggregation?`, and update comment to describe the general case with indexed aggregation as a prime example - `subtypes`: return a `Set` instead of `Array`; inline `subtypes` in `non_subtypes_in_shared_index` rather than caching in a local variable - Tests: use `before(:context)` shared schema in `#source_type` group; add scalar and enum nil cases; use `contain_exactly` for precise set assertions; consolidate `not_to include` calls; add coverage for `t == self` guard Generated with Claude Code
- `source_type`: use `defined?(@source_type)` pattern to correctly memoize nil return values (||= doesn't memoize nil) - Rename `non_subtypes_in_shared_index` → `concrete_non_subtypes_in_shared_index` to make explicit that abstract types are excluded from the result - Tests: add a second sibling type so at least one test returns multiple elements, making it harder for a partial implementation to pass Generated with Claude Code
9732147 to
eac440b
Compare
myronmarston
approved these changes
May 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a minimal companion/pre-requisite PR spun off from #1150 to reduce the size of the changeset for review. It adds methods supporting
__typenamefilter injection when querying mixed-type indexes via index inheritance.source_type: resolves the underlying document type for derived types (e.g. indexed aggregations) so the filter can look up search indexes on the source rather than the aggregation typesubtypes: declared in RBS so Steep-checked callers can use itnon_subtypes_in_shared_index: identifies concrete types sharing an index with this type that are not subtypes — the presence of any such types is what will trigger__typenamefilterScreenshots of new YARD docs:

