Skip to content

Add more Apollo Federation compliance test suites#9633

Open
michaelstaib wants to merge 18 commits intomainfrom
fed-compliance
Open

Add more Apollo Federation compliance test suites#9633
michaelstaib wants to merge 18 commits intomainfrom
fed-compliance

Conversation

@michaelstaib
Copy link
Copy Markdown
Member

No description provided.

michaelstaib and others added 10 commits April 27, 2026 07:20
Add three subgraphs (all-products, category, subcategories) matching
the nested-provides test suite from graphql-hive/federation-gateway-audit.

Subgraphs:
- all-products: pure entity provider owning the Product key
- category: owns Category.name, provides nested category data inline
  via Query.products with @provides and @Shareable
- subcategories: contributes shareable categories and subCategories
  fields to Product and Category entities

Tests are skipped because SelectionSetValidator.NullableType() does not
unwrap list wrappers when validating @provides field selections, so
[Category] is not recognized as a composite type. All wiring is in
place and tests will pass once the composition validator handles list
types in provides selections (PROVIDES_INVALID_FIELDS).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Port of the provides-on-interface suite from graphql-hive/federation-gateway-audit.
Three subgraphs (a, b, c) verify that interface types and inline fragments
work correctly across federated subgraphs.

Subgraph A owns the Book entity with shareable animals (Dog/Cat).
Subgraph B provides Query.media with animals pre-populated (id + name).
Subgraph C is the entity resolver for Dog/Cat (name, age).

Note: the original audit SDL uses @provides(fields: "animals { ... }") through
list-typed interface fields, but SelectionSetValidator.NullableType does not
unwrap list wrappers, blocking that pattern. The @provides directives are
omitted; the gateway resolves animal fields via shareable fields and entity
calls instead. The Reference/ SDL files preserve the original audit SDL for
future re-enablement.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add three subgraphs (a, b, c) and two test cases that verify @provides
works correctly with union types and inline fragments:

- SubgraphA: owns Book and Movie entity keys, exposes media query
- SubgraphB: provides Book.title as shareable (with entity resolver
  that returns title from seed data), exposes media query
- SubgraphC: owns Book and Movie with shareable title fields, handles
  entity resolution for titles

The original audit SDL uses @provides(fields: "... on Book { title }")
on the media query, but HC composition does not support @provides
through list-typed fields or union inline fragments. Book.title is
served as shareable instead; the gateway resolves it through entity
resolution or the shared media query.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…st suites

Add C# implementations for the requires-requires (4 subgraphs: a, b, c, d)
and requires-circular (2 subgraphs: a, b) Apollo Federation compliance
test suites. Each subgraph includes POCO entities, fluent ObjectType
descriptors, seed data, and a TestServer-based subgraph builder.

requires-requires: 3 tests pass, 2 skipped (chained @requires across
three subgraphs returns null for canAfford when queried alone).

requires-circular: 2 tests skipped (composition rejects nested
@requires(fields: "author { yearsOfExperience }") syntax).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e test suites

Add two Apollo Federation compliance test suites for HotChocolate Fusion:

mysterious-external (2 tests):
- Product subgraph owns Product @key(id) with id and name fields
- Price subgraph contributes price field via @key(id) entity resolution
- Tests verify cross-subgraph field merging for cheapestProduct and products queries

child-type-mismatch (4 tests):
- Subgraph A exposes User with shareable id (no @key)
- Subgraph B owns User @key(id) with union Account = User | Admin
- Tests verify union type resolution, nested similarAccounts at multiple levels

Adaptations for HotChocolate Fusion composition:
- Price subgraph: omit ExtendServiceType/External on key field (composition
  requires key fields to be accessible for cross-subgraph lookups)
- Child-type-mismatch: use ID! for both User.id and Admin.id (HotChocolate
  field selection merging requires matching nullability across union members)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…iance suites

Add full subgraph implementations for both Apollo Federation compliance
test suites:

- requires-with-argument: 4 subgraphs (A, B, C, D) with 5 test cases
  covering @requires with field arguments like price(currency: "USD")
  and comments(limit: 3) { authorId }.

- requires-with-argument-conflict: 2 subgraphs (A, B) with 1 test case
  covering conflicting @requires arguments on the same field
  (price(currency: "USD") vs price(currency: "EUR")).

All tests are skipped because the composition layer's @require FieldSet
parser does not yet support argument syntax in field selections.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…uites

Add full subgraph implementations (POCOs, ObjectType descriptors, Data classes,
QueryTypes, Subgraph builders) for both suites:

- requires-interface: 2 subgraphs (a, b) with Address interface hierarchy
  (HomeAddress, WorkAddress, SecondAddress), User entity with @requires on
  interface-typed fields. 5 test cases covering city/country resolution
  and address __typename queries.

- requires-with-fragments: 2 subgraphs (a, b) with Foo/Bar interface
  hierarchy (interface implementing interface), Baz and Qux concrete types,
  Entity with complex @requires using inline fragments. 6 test cases
  covering requirer/requirer2 resolution with fragment-based requires.

All 11 tests are skipped because composition rejects nested @requires
field selections (e.g. "address { id }") and inline fragment selections
as invalid syntax.

Also fix pre-existing RCS1260 trailing comma analyzer errors in
RequiresWithArgument suite data files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…est suites

Add two Apollo Federation compliance test suites for HotChocolate Fusion:

union-intersection (12 tests):
- Two subgraphs (a, b) with unions having different members across subgraphs
  (A: Book|Song, B: Book|Movie)
- Tests cover media queries with inline fragments, viewer queries,
  cross-subgraph entity resolution for aTitle/bTitle, and aMedia/bMedia

circular-reference-interface (2 tests):
- Two subgraphs (a, b) with a Product interface and circular Book references
- Subgraph A owns the Product interface with samePriceProduct @provides(price)
- Subgraph B owns Book.price @Shareable
- Tests cover nested circular entity resolution

All 14 tests pass across net8.0, net9.0, and net10.0.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…pliance test suites

Add two Apollo Federation compliance test suites for HotChocolate Fusion:

corrupted-supergraph-node-id (10 tests, 6 passing, 4 skipped):
  but intentionally return corrupted IDs for entity types they
  do not own
- Passing tests cover entity queries (account, chat), entity
  resolution with errors, and cross-subgraph entity calls
- Skipped tests require shareable query fields returning interface
  types, which the gateway composition currently drops

union-interface-distributed (10 tests, 1 passing, 9 skipped):
- Two subgraphs (a, b) test unions and interfaces distributed
  across subgraphs with Oven implementing Node/WithWarranty
  only in subgraph b
- Passing test covers named fragment on concrete type (toasters)
- Skipped tests require either query fields returning interface
  types or cross-subgraph interface resolution on union members

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 1, 2026 15:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants