From 289c74a82512393328b36a6c225d504a8ac76df1 Mon Sep 17 00:00:00 2001 From: Chris Lenfest Date: Wed, 2 Apr 2025 14:56:07 -0500 Subject: [PATCH 1/2] Fix entity detection in mismatch reporter (#3235) Fixes bug introduced in `2.10.0` where we could potentially throw in `hintOnInconsistentEntity` if subgraphs use `@federation__key` rather than `@key`. --- composition-js/src/merging/merge.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composition-js/src/merging/merge.ts b/composition-js/src/merging/merge.ts index 3c397a9b2..11975a65a 100644 --- a/composition-js/src/merging/merge.ts +++ b/composition-js/src/merging/merge.ts @@ -1118,7 +1118,7 @@ class Merger { supergraphElement: dest, subgraphElements: sources, // All we use the string of the next line for is to categorize source with a @key of the others. - elementToString: type => type.hasAppliedDirective('key') ? 'yes' : 'no', + elementToString: type => sourceAsEntity.find(entity => entity === type) ? 'yes' : 'no', // Note that the first callback is for element that are "like the supergraph". As the supergraph has no @key ... supergraphElementPrinter: (_, subgraphs) => `it has no @key in ${subgraphs}`, otherElementsPrinter: (_, subgraphs) => ` but has some @key in ${subgraphs}`, From 66714268884934b7c35aad1972b1de7b543eaa8e Mon Sep 17 00:00:00 2001 From: Chris Lenfest Date: Mon, 14 Apr 2025 14:07:00 -0500 Subject: [PATCH 2/2] add changeset for patch release --- .changeset/good-stingrays-accept.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/good-stingrays-accept.md diff --git a/.changeset/good-stingrays-accept.md b/.changeset/good-stingrays-accept.md new file mode 100644 index 000000000..78e71cd51 --- /dev/null +++ b/.changeset/good-stingrays-accept.md @@ -0,0 +1,5 @@ +--- +"@apollo/composition": patch +--- + +Fixes bug introduced in `2.10.0` where we could potentially throw in `hintOnInconsistentEntity` if subgraphs use `@federation__key` rather than `@key`.