Skip to content

Re-align incremental delivery with the WorkQueue architecture#275

Merged
Cito merged 7 commits into
mainfrom
feat/incremental-workqueue
Jul 15, 2026
Merged

Re-align incremental delivery with the WorkQueue architecture#275
Cito merged 7 commits into
mainfrom
feat/incremental-workqueue

Conversation

@Cito

@Cito Cito commented Jul 15, 2026

Copy link
Copy Markdown
Member

This replaces the incremental delivery engine with the WorkQueue-based architecture that graphql-js adopted after v17.0.0-rc.0 (ported up to v17.0.2). A new Computation abstraction and a WorkQueue scheduler drive deferred and streamed execution; the control logic follows the upstream engine 1:1, but is re-expressed with native asyncio primitives instead of the JS promise machinery; streams are pumped by cancellable tasks with back-pressure, and cancellation awaits asynchronous cleanup. The established public API surface is unchanged.

Besides restoring alignment with upstream, the new architecture makes the invalid-state bug class behind #271 structurally impossible and fixes the non-termination reported in #272 (a spec-invalid @defer/@stream query could previously hang forever); a regression test for the latter is included.

Cito added 7 commits July 14, 2026 22:53
First part of adopting the WorkQueue-based incremental delivery
architecture, re-expressed with asyncio instead of Promise machinery;
awaitable results are scheduled as cancellable futures.

Replicates graphql/graphql-js@8e01e23
Second part of adopting the WorkQueue-based incremental delivery
architecture; the graph event channel is a plain asyncio queue drained
in batches, streams are pumped by cancellable tasks paced via a
handled event, and cancellation awaits asynchronous cleanup.

Replicates graphql/graphql-js@8e01e23
The architecture and control logic follow the upstream engine 1:1,
re-expressed with native asyncio primitives instead of the JS promise
machinery, while keeping the established GraphQL-core API surface.

Replicates graphql/graphql-js@8e01e23,
           graphql/graphql-js@e89ca8c,
           graphql/graphql-js@9190a9f,
           graphql/graphql-js@229c9df,
           graphql/graphql-js@d7e040e,
           graphql/graphql-js@37a6299,
           graphql/graphql-js@3dd146d,
           graphql/graphql-js@85e545c
The changes to the legacy stream tests are not ported, since the legacy
incremental format is not supported by GraphQL-core.

Replicates graphql/graphql-js@fa06509
A streamed list field without a subselection that merge-conflicts with an
unstreamed selection of the same field inside a sibling defer used to hang
incremental delivery whenever another field of that sibling resolved later
than the streamed field (issue #272). The WorkQueue architecture already
fixes this; the test guards termination and asserts the delivered payloads.
@codspeed-hq

codspeed-hq Bot commented Jul 15, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 17.67%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 18 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
test_execute_async_iterable_list_field 9.8 ms 8.4 ms +17.67%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing feat/incremental-workqueue (477529a) with main (adf2fc7)

Open in CodSpeed

@Cito Cito merged commit e49e4e2 into main Jul 15, 2026
18 checks passed
@Cito Cito deleted the feat/incremental-workqueue branch July 15, 2026 08:50
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.

1 participant