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

feat(federation): query plan correctness checker #6498

Open
wants to merge 19 commits into
base: dev
Choose a base branch
from

Conversation

duckki
Copy link
Contributor

@duckki duckki commented Dec 21, 2024

This PR implements the first version of the query plan correctness checker.
It implemented the completeness part of the plan. I'll create a separate PR for the soundness part.

Status

  • ResponseShape computation from operations
  • ResponseShape computation from query plans
  • ResponseShape comparison
  • Handle all PathElements.
  • Handle Defer/Subscription nodes
  • Subgraph constraints handling
  • Corpus run

@svc-apollo-docs
Copy link
Collaborator

svc-apollo-docs commented Dec 21, 2024

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 1 changed, 0 removed
* graphos/reference/migration/from-router-v1.mdx

Build ID: 789e8fe275ae195cd6ad8cda

URL: https://www.apollographql.com/docs/deploy-preview/789e8fe275ae195cd6ad8cda

Copy link
Contributor

@duckki, please consider creating a changeset entry in /.changesets/. These instructions describe the process and tooling.

@router-perf
Copy link

router-perf bot commented Dec 21, 2024

CI performance tests

  • connectors-const - Connectors stress test that runs with a constant number of users
  • const - Basic stress test that runs with a constant number of users
  • demand-control-instrumented - A copy of the step test, but with demand control monitoring and metrics enabled
  • demand-control-uninstrumented - A copy of the step test, but with demand control monitoring enabled
  • enhanced-signature - Enhanced signature enabled
  • events - Stress test for events with a lot of users and deduplication ENABLED
  • events_big_cap_high_rate - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity
  • events_big_cap_high_rate_callback - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity using callback mode
  • events_callback - Stress test for events with a lot of users and deduplication ENABLED in callback mode
  • events_without_dedup - Stress test for events with a lot of users and deduplication DISABLED
  • events_without_dedup_callback - Stress test for events with a lot of users and deduplication DISABLED using callback mode
  • extended-reference-mode - Extended reference mode enabled
  • large-request - Stress test with a 1 MB request payload
  • no-tracing - Basic stress test, no tracing
  • reload - Reload test over a long period of time at a constant rate of users
  • step-jemalloc-tuning - Clone of the basic stress test for jemalloc tuning
  • step-local-metrics - Field stats that are generated from the router rather than FTV1
  • step-with-prometheus - A copy of the step test with the Prometheus metrics exporter enabled
  • step - Basic stress test that steps up the number of users over time
  • xlarge-request - Stress test with 10 MB request payload
  • xxlarge-request - Stress test with 100 MB request payload

@duckki duckki force-pushed the duckki/correctness branch from a910d24 to bcb23f4 Compare December 22, 2024 05:34
@duckki duckki changed the title WIP/feat(federation): started query plan correctness checker WIP/feat(federation): query plan correctness checker Jan 8, 2025
@duckki duckki force-pushed the duckki/correctness branch 3 times, most recently from 2632b38 to 38bb635 Compare January 11, 2025 23:54
Comment on lines 132 to 155
// These two intersections are distinct type conditions.
// - `U ∧ I` = {R, S}
// - `U ∧ J` = `U` = {R, S, X}
let op_str = r#"
query {
test_u {
... on I {
data(arg: 0)
}
... on J {
data(arg: 0)
}
}
}
"#;
// Note: The set {R, S} has no corresponding named type definition in the schema, while
// `U ∧ J` is just the same as `U`.
insta::assert_snapshot!(response_shape(op_str), @r###"
{
test_u -----> test_u {
data -may-> data(arg: 0) on I ∧ U = {R, S}
data -may-> data(arg: 0) on U
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a bit of clarification, or more clearly named types. It becomes confusing to reason about single letter types in sets and intersections 😅 . For example, we can use the Pet schema that graphql js uses, or expand on the startstuff schema to add more unions?

Also, what does the -----> actually denote in these snapshots? I take it -may-> is an option? So, test_u has two possible options?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote some design doc (google doc).

@duckki duckki force-pushed the duckki/correctness branch from e1bd353 to 294c280 Compare January 29, 2025 03:54
@duckki duckki marked this pull request as ready for review January 31, 2025 05:39
@duckki duckki changed the title WIP/feat(federation): query plan correctness checker feat(federation): query plan correctness checker Jan 31, 2025
@duckki
Copy link
Contributor Author

duckki commented Jan 31, 2025

I have finished the first version (the completeness checking part) and rebased it on more recent dev branch commit.
This is now ready for review.

@duckki duckki added the backport-1.x Backport this PR to 1.x label Jan 31, 2025
@duckki duckki requested a review from lrlna January 31, 2025 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-1.x Backport this PR to 1.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants