Skip to content

Build Plan failure when using fragments and @include #2862

Description

@tinnou

Issue Description

We are getting the following error when using queries that have a combination of non intersecting fragments and @include directive.

Error:

Cannot add fragment of condition "Video" (runtimes: [Show]) to parent type "Show" (runtimes: Show)
GraphQLError: Cannot add fragment of condition "Video" (runtimes: [Show]) to parent type "Show" (runtimes: Show)
    at Object.err (/Users/antoineb/IdeaProjects/federation/internals-js/src/error.ts:36:60)
    at validate (/Users/antoineb/IdeaProjects/federation/internals-js/src/operations.ts:61:34)
    at FragmentElement.rebaseOn (/Users/antoineb/IdeaProjects/federation/internals-js/src/operations.ts:492:7)
    at FragmentElement.rebaseOnOrError (/Users/antoineb/IdeaProjects/federation/internals-js/src/operations.ts:91:17)
    at makeSelection (/Users/antoineb/IdeaProjects/federation/internals-js/src/operations.ts:2239:40)
(...)

Link to Reproduction

main...tinnou:federation:non_intersecting_fragment_with_include

Reproduction Steps

I added a unit test that reproduces the issue with a minimal schema and query in buildPlan.test.ts see the commit details.

If you remove @include the plan succeeds.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions