Add AbstractTypeFilter query adapter for index inheritance#1163
Merged
myronmarston merged 4 commits intoblock:mainfrom May 5, 2026
Merged
Conversation
When abstract types share an index with unrelated concrete types via index inheritance, a query for the abstract type would otherwise return documents belonging to those other types. AbstractTypeFilter is a new query adapter that prevents this by automatically injecting an internal __typename filter scoped to the queried type's concrete subtypes. Also fixes requested_fields to use unwrap_fully before checking abstract?, which ensures __typename is fetched for abstract types returned via the nodes relay connection field (where the field type is list-wrapped, e.g. [Store!]!). End-to-end acceptance tests covering index inheritance query behavior are coming in a follow-up PR; this branch intentionally keeps coverage to minimal unit tests to reduce the set of reviewable changes.
myronmarston
requested changes
May 4, 2026
- Rename `concrete_non_subtypes_in_shared_index` → `shares_index_with_non_subtypes?` (boolean) - Add nil optimization: only include nil in `__typename` values when a queried index stores a single type - Replace `ThirdPartyWholesale` with `Wholesale` sub-interface in the stock schema to enable a test for the nil-omitted case
myronmarston
reviewed
May 4, 2026
…ndex when overridden Abstract types derive their search index set purely from their concrete subtypes. This avoids unnecessarily searching a shared index when all concrete subtypes have overridden it with dedicated indexes. Generated with Claude Code
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 the next PR spun off of the large one #1150 to reduce the size of the changeset for review. After this there are just two more for Issue #1054: one PR for acceptance tests and stock schema updates; and one PR for documentation updates.
When abstract types share an index with unrelated concrete types via index inheritance, a query for the abstract type would otherwise return documents belonging to those other types. AbstractTypeFilter (added here) is a new query adapter that prevents this by automatically injecting an internal
__typenamefilter scoped to the queried type's concrete subtypes.Also fixes
requested_fieldsto useunwrap_fullybefore checkingabstract?, which ensures__typenameis fetched for abstract types returned via thenodesrelay connection field (where the field type is list-wrapped, e.g.[Store!]!).