Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
8953ecf
New Query Planner
ardatan Feb 5, 2025
ce2863e
Leave batching and AST parsing
ardatan Feb 6, 2025
03effed
Subscriptions
ardatan Feb 6, 2025
82cfb8b
Deps
ardatan Feb 6, 2025
5bb0de5
More fixes
ardatan Feb 7, 2025
687c7a6
Lets go
ardatan Feb 7, 2025
d1aeed6
Benchmark
ardatan Feb 7, 2025
8bf93d4
nojit in bench
enisdenjo Jul 28, 2025
4cbe054
no fork
enisdenjo Jul 28, 2025
a891a88
typefix
enisdenjo Jul 30, 2025
0d11f0d
quick and dirty impl of hive query planner
enisdenjo Oct 14, 2025
5a334f3
explain things
enisdenjo Oct 14, 2025
3e59d6e
async / no async qp and no cache
enisdenjo Oct 14, 2025
10a8ad5
push bench
enisdenjo Oct 14, 2025
b942873
op doc node is available in hive qp now too
enisdenjo Oct 17, 2025
7521b92
start inspect
enisdenjo Oct 17, 2025
a5ad66e
only async
enisdenjo Oct 17, 2025
04dd0ab
introduce fastify deepmerge
enisdenjo Oct 17, 2025
84d5d79
add a lot of tests
enisdenjo Oct 17, 2025
a5af29b
WIP debugging
enisdenjo Oct 17, 2025
be153d6
no toolsmerge
enisdenjo Oct 20, 2025
e08c714
todo
enisdenjo Oct 20, 2025
092a012
merge deep fast but typebroken
enisdenjo Oct 20, 2025
38b22cf
unnecessary
enisdenjo Oct 21, 2025
b68505a
hive executor in fusion-runtime (we'll figure out where to place it l…
enisdenjo Oct 21, 2025
f448c33
subgraphs get
enisdenjo Oct 21, 2025
1034bf5
remove unused
enisdenjo Oct 21, 2025
4ef7003
fix benchmarks
enisdenjo Oct 21, 2025
5285dd8
re-enable schemexts
enisdenjo Oct 21, 2025
8e1caab
missing devdep for nestjs tests
enisdenjo Oct 21, 2025
d93732a
hive router query planner on/off and warn
enisdenjo Oct 21, 2025
1adc099
put in env to use everywher
enisdenjo Oct 21, 2025
ef8bf00
object containing and skip some tests
enisdenjo Oct 21, 2025
679a468
pass upstream timeout
enisdenjo Oct 21, 2025
03ebbbb
silence in fed compat
enisdenjo Oct 21, 2025
1c5122c
memoized plan simpler
enisdenjo Oct 21, 2025
92fccc6
consumer schema
enisdenjo Oct 24, 2025
e60c796
use consumer schema for validation
enisdenjo Oct 24, 2025
a161dd5
omit innaccessible enums when projecting
enisdenjo Oct 24, 2025
cc6dc9e
omit inaccessible types
enisdenjo Oct 24, 2025
5f8285f
some paths are null
enisdenjo Oct 24, 2025
a1fec9d
handle inline fragments when projecting
enisdenjo Oct 24, 2025
89c3f93
normalize fetch rewrite inspired by router
enisdenjo Oct 24, 2025
ef06385
honour alias and response key fields when extracting reps
enisdenjo Oct 24, 2025
9f79ef8
rework flatten and respect complete path
enisdenjo Oct 24, 2025
dc37f0b
enable and run all audit fed audits
enisdenjo Oct 24, 2025
c2411c2
bump typefixed things
enisdenjo Oct 24, 2025
d7fa2f5
normalize segments
enisdenjo Oct 24, 2025
eadb3e0
match better query plan
enisdenjo Oct 24, 2025
4f9d8b0
no masked errors when audit
enisdenjo Oct 26, 2025
7cec67d
unnecessary any and some checks
enisdenjo Oct 26, 2025
ebae9fd
no inspect better always
enisdenjo Oct 26, 2025
df48043
refactor and optimize executor and handler, more perf
enisdenjo Oct 26, 2025
94c10f0
promise helpers
enisdenjo Oct 26, 2025
d015a19
published router
enisdenjo Oct 26, 2025
18488f7
changeset
enisdenjo Oct 26, 2025
392d714
on fusion runtime
enisdenjo Oct 26, 2025
5c079f7
chore(dependencies): updated changesets for modified dependencies
github-actions[bot] Oct 26, 2025
c082d47
better changeset
enisdenjo Oct 26, 2025
8873148
mesh fusion runtime
enisdenjo Oct 26, 2025
43293fb
unit test hive router query planner
enisdenjo Oct 26, 2025
ef1164c
execution request with subgraph name
enisdenjo Oct 27, 2025
529ce0f
fix some tests
enisdenjo Oct 27, 2025
e57d142
propgagte
enisdenjo Oct 27, 2025
80b4675
build and remove introspection fields
enisdenjo Oct 27, 2025
1bd99ca
more fixes
enisdenjo Oct 27, 2025
d4c22bd
introspection
enisdenjo Oct 27, 2025
274e9a5
skip unnecessary
enisdenjo Oct 27, 2025
ced5c9a
only Query.__typename is also intropseipcting
enisdenjo Oct 27, 2025
6a407ec
fix otel too
enisdenjo Oct 27, 2025
48902bf
filter internal types and fields
enisdenjo Oct 28, 2025
8b54eff
test experimental qp in same job
enisdenjo Oct 28, 2025
9b3459f
expect hive router qp results in demand control
enisdenjo Oct 28, 2025
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
7 changes: 7 additions & 0 deletions .changeset/@graphql-mesh_fusion-runtime-1629-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-mesh/fusion-runtime': patch
---

dependencies updates:

- Added dependency [`@graphql-hive/router@0.0.0-manual-f9542ee` ↗︎](https://www.npmjs.com/package/@graphql-hive/router/v/0.0.0) (to `dependencies`)
5 changes: 5 additions & 0 deletions .changeset/sharp-cars-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-mesh/fusion-runtime': minor
---

Use Query Planner from Hive Router
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ jobs:
node-version: ${{matrix.node-version}}
- name: Test
run: yarn test
- name: "[EXPERIMENTAL] Test with Hive Router Query Planner"
env:
__EXPERIMENTAL__HIVE_ROUTER_QUERY_PLANNER: 1
run: yarn test

unit-bun:
name: Unit / Bun
Expand All @@ -51,6 +55,14 @@ jobs:
timeout_minutes: 10
max_attempts: 3
command: yarn test:bun
- name: "[EXPERIMENTAL] Test with Hive Router Query Planner"
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
env:
__EXPERIMENTAL__HIVE_ROUTER_QUERY_PLANNER: 1
with:
timeout_minutes: 10
max_attempts: 3
command: yarn test:bun

leaks:
strategy:
Expand All @@ -76,6 +88,14 @@ jobs:
timeout_minutes: 10
max_attempts: 3
command: yarn test:leaks
- name: "[EXPERIMENTAL] Run Tests with Hive Router Query Planner"
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
env:
__EXPERIMENTAL__HIVE_ROUTER_QUERY_PLANNER: 1
with:
timeout_minutes: 10
max_attempts: 3
command: yarn test:leaks

e2e:
runs-on: ${{ matrix.setup.os }}
Expand Down
20 changes: 14 additions & 6 deletions e2e/federation-example/federation-example.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,31 @@ import { fetch } from '@whatwg-node/fetch';
import { bench, describe, expect } from 'vitest';

describe('Gateway', async () => {
const { gateway, service } = createTenv(__dirname);
const { gateway, service: _service } = createTenv(__dirname);
const example = createExampleSetup(__dirname, 1000);

const supergraph = await example.supergraph();

const gateways: Record<string, Gateway | Service> = {
'Apollo Gateway': await service('apollo-gateway', {
// TODO: tests are failing for whatever reason
// 'Apollo Gateway': await service('apollo-gateway', {
// env: {
// SUPERGRAPH: supergraph,
// },
// }),
'Hive Gateway w/ Tools': await gateway({
supergraph,
env: {
SUPERGRAPH: supergraph,
FORK: 1,
NODE_ENV: 'production',
},
}),
'Hive Gateway': await gateway({
'Hive Gateway w/ Hive Router Query Planner': await gateway({
supergraph,
args: ['--jit'],
env: {
JIT: 'true',
FORK: 1,
NODE_ENV: 'production',
__EXPERIMENTAL__HIVE_ROUTER_QUERY_PLANNER: 1,
},
}),
};
Expand Down
8 changes: 8 additions & 0 deletions internal/env/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,11 @@ export function getNodeVer(): {
const [major, minor, patch] = process.versions.node.split('.').map(Number);
return { major: major || NaN, minor: minor || NaN, patch: patch || NaN };
}

/**
* Whether the federation query planner is using Hive Router node-addon for query planning.
* @experimental
*/
export function usingHiveRouterQueryPlanner(): boolean {
return getEnvBool('__EXPERIMENTAL__HIVE_ROUTER_QUERY_PLANNER');
}
77 changes: 40 additions & 37 deletions packages/federation/tests/federation-compatibility.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
MapperKind,
mapSchema,
} from '@graphql-tools/utils';
import { usingHiveRouterQueryPlanner } from '~internal/env';
import {
buildSchema,
getNamedType,
Expand Down Expand Up @@ -91,6 +92,8 @@ describe('Federation Compatibility', () => {
batch: true,
});
gatewayRuntime = createGatewayRuntime({
logging: false,
maskedErrors: false,
supergraph: supergraphSdl,
plugins: () => [useCustomFetch(auditRouter.fetch)],
});
Expand Down Expand Up @@ -150,46 +153,46 @@ describe('Federation Compatibility', () => {
);
});
tests.forEach((_, i) => {
(supergraphName === 'requires-with-argument-conflict' ? it.todo : it)(
`test-query-${i}`,
async () => {
const test = tests[i];
if (!test) {
throw new Error(`Test ${i} not found`);
}
const response = await gatewayRuntime.fetch(
'http://localhost/graphql',
{
method: 'POST',
headers: {
'content-type': 'application/json',
},
body: JSON.stringify({
query: test.query,
}),
(!usingHiveRouterQueryPlanner() &&
supergraphName === 'requires-with-argument-conflict'
? it.todo // fails in stitching
: it)(`test-query-${i}`, async () => {
const test = tests[i];
if (!test) {
throw new Error(`Test ${i} not found`);
}
const response = await gatewayRuntime.fetch(
'http://localhost/graphql',
{
method: 'POST',
headers: {
'content-type': 'application/json',
},
);
const result: ExecutionResult = await response.json();
const received = {
data: result.data ?? null,
errors: !!result.errors?.length,
};
body: JSON.stringify({
query: test.query,
}),
},
);
const result: ExecutionResult = await response.json();
const received = {
data: result.data ?? null,
errors: !!result.errors?.length,
};

const expected = {
data: test.expected.data ?? null,
errors: test.expected.errors ?? false,
};
const expected = {
data: test.expected.data ?? null,
errors: test.expected.errors ?? false,
};

try {
expect(received).toEqual(expected);
} catch (e) {
result.errors?.forEach((err) => {
console.error(err);
});
throw e;
}
},
);
try {
expect(received).toEqual(expected);
} catch (e) {
result.errors?.forEach((err) => {
console.error(err);
});
throw e;
}
});
});
});
}
Expand Down
1 change: 1 addition & 0 deletions packages/fusion-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"@envelop/core": "^5.3.2",
"@envelop/instrumentation": "^1.0.0",
"@graphql-hive/logger": "workspace:^",
"@graphql-hive/router": "0.0.0-manual-f9542ee",
"@graphql-mesh/cross-helpers": "^0.4.10",
"@graphql-mesh/transport-common": "workspace:^",
"@graphql-mesh/types": "^0.104.13",
Expand Down
Loading
Loading