Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FED-251: fixed a (type-position, schema) inconsistency in compute_nodes_for_key_resolution #5435

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3062,6 +3062,10 @@ fn compute_nodes_for_key_resolution<'a>(
let dest = stack_item.tree.graph.node_weight(dest_id)?;
// We shouldn't have a key on a non-composite type
let source_type: CompositeTypeDefinitionPosition = source.type_.clone().try_into()?;
let source_schema: ValidFederationSchema = dependency_graph
.federated_query_graph
.schema_by_source(&source.source)?
.clone();
let dest_type: CompositeTypeDefinitionPosition = dest.type_.clone().try_into()?;
let dest_schema: ValidFederationSchema = dependency_graph
.federated_query_graph
Expand Down Expand Up @@ -3153,7 +3157,7 @@ fn compute_nodes_for_key_resolution<'a>(
let node =
FetchDependencyGraph::node_weight_mut(&mut dependency_graph.graph, stack_item.node_id)?;
let typename_field = Arc::new(OpPathElement::Field(Field::new_introspection_typename(
&dependency_graph.supergraph_schema,
&source_schema,
&source_type,
None,
)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ fn can_use_a_key_on_an_interface_object_type() {
}

#[test]
#[should_panic(
expected = r#"Cannot add selection of field "I.__typename" to selection set of parent type "I" that is potentially an interface object type at runtime"#
)]
// TODO: investigate this failure
fn can_use_a_key_on_an_interface_object_from_an_interface_object_type() {
let planner = planner!(
S1: SUBGRAPH1,
Expand Down Expand Up @@ -181,6 +177,8 @@ fn only_uses_an_interface_object_if_it_can() {
#[should_panic(
expected = "Cannot add selection of field \"I.__typename\" to selection set of parent type \"I\" that is potentially an interface object type at runtime"
)]
// TODO: investigate this failure
// - Fails to rebase on an interface object type in a subgraph.
fn does_not_rely_on_an_interface_object_directly_for_typename() {
let planner = planner!(
S1: SUBGRAPH1,
Expand Down Expand Up @@ -232,9 +230,10 @@ fn does_not_rely_on_an_interface_object_directly_for_typename() {

#[test]
#[should_panic(
expected = r#"Cannot add selection of field "I.__typename" to selection set of parent type "I" that is potentially an interface object type at runtime"#
expected = r#"Cannot add selection of field "I.id" to selection set of parent type "A""#
)]
// TODO: investigate this failure
// - Fails to rebase on an interface object type in a subgraph.
fn does_not_rely_on_an_interface_object_directly_if_a_specific_implementation_is_requested() {
let planner = planner!(
S1: SUBGRAPH1,
Expand Down Expand Up @@ -377,10 +376,6 @@ fn can_use_a_key_on_an_interface_object_type_even_for_a_concrete_implementation(
}

#[test]
#[should_panic(
expected = r#"Cannot add selection of field "I.__typename" to selection set of parent type "I" that is potentially an interface object type at runtime"#
)]
// TODO: investigate this failure
fn handles_query_of_an_interface_field_for_a_specific_implementation_when_query_starts_with_interface_object(
) {
let planner = planner!(
Expand Down Expand Up @@ -437,9 +432,10 @@ fn handles_query_of_an_interface_field_for_a_specific_implementation_when_query_

#[test]
#[should_panic(
expected = r#"Cannot add selection of field "I.__typename" to selection set of parent type "I" that is potentially an interface object type at runtime"#
expected = r#"Cannot add selection of field "I.id" to selection set of parent type "A""#
)]
// TODO: investigate this failure
// - Fails to rebase on an interface object type in a subgraph.
fn it_avoids_buffering_interface_object_results_that_may_have_to_be_filtered_with_lists() {
let planner = planner!(
S1: r#"
Expand Down
Loading