Skip to content

Port upstream v0.27.3 and v0.28.0 - #8

Merged
kamilkisiela merged 4 commits into
mainfrom
kamil-sync-0.28.0
Dec 3, 2026
Merged

kamilkisiela merged 4 commits into
mainfrom
kamil-sync-0.28.0

Conversation

@kamilkisiela

Copy link
Copy Markdown
Contributor

Ports upstream v0.27.3 and v0.28.0, one commit each, and moves UPSTREAM to v0.28.0.

v0.27.3

v0.28.0

From graphql-hive/federation-composition#347:

  • composeSchemaContract gains a skipSatisfiability option (ComposeSchemaContractOptions; compose_schema_contract takes an options argument).
  • composeServicesWithContracts (new contracts/supergraph_state_contract.rs) composes the supergraph once and derives each contract from its state: the tag filter is applied to the state, only the six @inaccessible rules run (validate_inaccessible_usage), the supergraph is built again, and the state is restored for the next contract. When the subgraphs fail to compose, each contract is composed in full.
  • The three filter predicates (isExcludedByFilter, isExcludedByExcludeFilter, isArgumentExcludedByFilter) are shared by both filters in tag_extraction.rs.
  • The wasm bindings and the npm shim export composeServicesWithContracts and SchemaContract. The shim shares a contract's unchanged definitions with the supergraph's document, as upstream does.

Where the Rust differs in mechanism, not in result:

  • External fields' @tags. Upstream reads them from the subgraph states' types, which the Rust drops after merging each subgraph. A stripped subgraph state now keeps its tagged fields' tags (SubgraphState::field_tags); untagged fields cost nothing.
  • Restoring the state. Upstream mutates the state through undo closures. The Rust decides every change from the state read-only, applies them, and logs each previous value by its position, so restore puts it back.
  • "a contract reuses the definitions it does not change" checks JS object identity. It passes on wasm through the shim; the Rust test compares the printed definitions, since a Rust success is its SDL.

Verification

  • pnpm conformance at v0.28.0: 7,401 passed, 25 skipped, 8 todo on wasm (same as upstream's own TypeScript); 3,714/3,714 compositions identical.
  • cargo test --workspace: the suite has 3,823 passed, 17 ignored; graphql-js differentials, doctests and unit tests pass. The random-tag tests on dgs and stars-stuff compare every derived contract with the full per-contract composition.
  • pnpm test:npm: 16/16.
  • clippy (native and wasm32) and cargo doc, with -D warnings.

DeprecatedInterfaceFieldImplementationRule (graphql-hive/federation-composition#349):
a deprecated field whose interface field is not deprecated is an INVALID_GRAPHQL
error, which graphql-js 17 would reject in the supergraph. The new test of
INVALID-GRAPHQL.spec.ts is ported, and the huge-schema fixture deprecates the
interface fields its implementations deprecate.

Conformance at v0.27.3: 7,376 passed, 25 skipped, 8 todo on wasm; 3,601/3,601
compositions identical.
composeServicesWithContracts (graphql-hive/federation-composition#347): the
supergraph is composed once, and each contract is derived from its state: the
tag filter is applied to the supergraph state (supergraph_state_contract.rs),
only the @inaccessible rules run (validate_inaccessible_usage), the supergraph
is built again, and the state is restored for the next contract. When the
subgraphs fail to compose, each contract is composed from the subgraphs.
composeSchemaContract gains a skipSatisfiability option.

The filter decisions shared by both filters (isExcludedByFilter,
isExcludedByExcludeFilter, isArgumentExcludedByFilter) are in tag_extraction.
A subgraph state stripped of its types keeps its tagged fields' @tags
(SubgraphState::field_tags), which the state filter reads for external fields.
The wasm bindings and the npm shim export composeServicesWithContracts and
SchemaContract; the shim shares a contract's unchanged definitions with the
supergraph's document, as upstream does.

Conformance at v0.28.0: 7,401 passed, 25 skipped, 8 todo on wasm; 3,714/3,714
compositions identical.
contracts_bench composes a fixture with 0, 2, 4 and 8 @tag contracts three
ways: compose_services then compose_schema_contract per contract, the same
with skip_satisfiability, and compose_services_with_contracts. It tags the
fixture first (public on every type, feature tags on a share of fields) and
checks that the three agree before timing.

At 8 contracts: large-graph 273 / 97 / 51 ms, huge-schema 921 / 754 / 344 ms.

@n1ru4l n1ru4l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lets goo

@kamilkisiela
kamilkisiela merged commit 4af9bc6 into main Dec 3, 2026
1 check passed
@kamilkisiela
kamilkisiela deleted the kamil-sync-0.28.0 branch December 3, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants