Skip to content

Commit

Permalink
Revert "Ignore non-resolvable keys in locally satisfiable key checking (
Browse files Browse the repository at this point in the history
#3137)" (#3144)

It turns out #3137 needs a few other changes, and we can't ship those in
a patch, so we're reverting the PR for now.
  • Loading branch information
sachindshinde authored Sep 13, 2024
1 parent b8e4ab5 commit fd2db6f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 100 deletions.
6 changes: 0 additions & 6 deletions .changeset/rich-tips-study.md

This file was deleted.

3 changes: 0 additions & 3 deletions query-graphs-js/src/graphPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1930,9 +1930,6 @@ export function getLocallySatisfiableKey(graph: QueryGraph, typeVertex: Vertex):
assert(metadata, () => `Could not find federation metadata for source ${typeVertex.source}`);
const keyDirective = metadata.keyDirective();
for (const key of type.appliedDirectivesOf(keyDirective)) {
if (!(key.arguments().resolvable ?? true)) {
continue;
}
const selection = parseFieldSetArgument({ parentType: type, directive: key });
if (!metadata.selectionSelectsAnyExternalField(selection)) {
return selection;
Expand Down
91 changes: 0 additions & 91 deletions query-planner-js/src/__tests__/buildPlan.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2986,97 +2986,6 @@ describe('@requires', () => {
}
`);
});

it('ignores non-resolvable keys when inserting self jump for @requires', () => {
const subgraph1 = {
name: 'A',
typeDefs: gql`
type Query {
t: T
}
type T @key(fields: "id1", resolvable: false) @key(fields: "id2 id3") {
id1: ID!
id2: ID!
id3: ID!
req: Int @external
v: Int @requires(fields: "req")
}
`,
};

const subgraph2 = {
name: 'B',
typeDefs: gql`
type T @key(fields: "id1") {
id1: ID!
req: Int
}
`,
};

const [api, queryPlanner] = composeAndCreatePlanner(subgraph1, subgraph2);
const operation = operationFromDocument(
api,
gql`
{
t {
v
}
}
`,
);

const plan = queryPlanner.buildQueryPlan(operation);
expect(plan).toMatchInlineSnapshot(`
QueryPlan {
Sequence {
Fetch(service: "A") {
{
t {
__typename
id1
id2
id3
}
}
},
Flatten(path: "t") {
Fetch(service: "B") {
{
... on T {
__typename
id1
}
} =>
{
... on T {
req
}
}
},
},
Flatten(path: "t") {
Fetch(service: "A") {
{
... on T {
__typename
req
id2
id3
}
} =>
{
... on T {
v
}
}
},
},
},
}
`);
});
});

describe('fetch operation names', () => {
Expand Down

0 comments on commit fd2db6f

Please sign in to comment.