Skip to content

Fix test harness for HotChocolate to match graphql-js#11

Open
michaelstaib wants to merge 1 commit intojbellenger:masterfrom
michaelstaib:mst/hc
Open

Fix test harness for HotChocolate to match graphql-js#11
michaelstaib wants to merge 1 commit intojbellenger:masterfrom
michaelstaib:mst/hc

Conversation

@michaelstaib
Copy link
Copy Markdown

No description provided.

jbellenger added a commit that referenced this pull request Apr 20, 2026
## Summary
- Impls that natively support incremental delivery now emit
`multipart/mixed` per the GraphQL incremental-delivery spec; the
conformer parses and merges the parts into a single collapsed `{data,
errors?, extensions?}` object before comparison.
- Hot Chocolate and graphql-js-17 both updated; HC previously dropped
every incremental patch, and the 17 driver previously rejected every
schema that declared @defer/@stream directives.
- `conformer/src/execute.js:applyIncrementalMerge` replaced with a
path-based merger covering the two items flagged in a prior review of
#11:
- **P1**: `@stream` items' last path segment is an insertion index; the
merger splices into the parent array (and also supports pending-id forms
where the resolved path points directly at the list, which HC uses).
- **P2**: repeated `@defer` patches at the same parent path deep-merge
so nested object keys don't overwrite each other.
- SPEC.md §374-376 rewritten to describe the multipart-in /
collapsed-out contract and cross-reference the existing HTTP rules.
- New hand-crafted sanity case at `corpus/0/1/query.graphql` exercises
`@defer` + `@stream(initialCount: 1)` end-to-end;
`corpus/0/schema.graphqls` gains the directive declarations.

## Tests
- 21 unit tests in `conformer/src/execute.test.js` cover P1, P2,
pending-id resolution (both initial and subsequent-part pending
entries), subPath handling, HC's `{"data": null, "items": [...]}` shape,
error aggregation across initial/chunk-top-level/per-incremental
entries, extensions preservation, and malformed-part resilience.
- Docker-gated integration test in
`conformer/src/hot-chocolate.driver.test.js` boots the HC container,
posts a `@defer`+`@stream` query, and asserts that the response is
`multipart/mixed` with ≥2 parts that collapse to the wiring-spec shape.
Skips automatically when Docker is unreachable.
- `make run-conformer --drivers graphql-js-17,hot-chocolate` on
`corpus/0` passes 2/2 for both drivers (initial query + the new
defer/stream case).

## Out of scope
- Defer/stream support for other impls (juniper, async-graphql,
graphql-go, graphql-php, graphql-dotnet, graphql-ruby, absinthe,
lacinia, viaduct, graphql-js-16, gqlgen, graphql-java, graphql-core,
grafast) — follow-up PR.
- Fuzzed-corpus injection of `@defer`/`@stream` — follow-up.

## Test plan
- [ ] `make test` — unit + integration tests green (80/80 locally).
- [ ] `make run-conformer` on `corpus/0` — HC and graphql-js-17 both
pass the new `0/1` case.
- [ ] Differential check: `hot-chocolate.driver.test.js` asserts the
multipart wire format (not a collapsed JSON body).
@jbellenger
Copy link
Copy Markdown
Owner

Hi Michael! Thanks for putting this together!

The terrain of this project has changed a bit since you first posted this, though I've applied the spirit of your PR in #17, and there'll be an additional follow-up PR to address incremental directives more uniformly.

I'm honored that you put together this PR, but for the next 1-2 weeks I think this project is going to be in a high state of flux and might be too unstable for external contributions. I'd really like to work with you and HotChocolate though -- for the time being can you file github issues or start a github discussion about things you'd like to see?

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