- GraphQL: one Constructor<K> signature shared by query/mutation/subscription
- GraphQLClientError: isRetryable lives on GraphQLClientError and TransportError only
- GraphQLProtocol: drop the test-only makeWebSocket overload, makeHttp is makeHttpWith
- GraphQLClient: inline the strict/partial decode choice
- Generator: drop unused directive definitions and specifiedBy from the schema model,
one directory walk in Generate, one fragment-spread walker, one imports map in
Emitter, merged object/interface SDL branches, smaller lexer/printer/parser/diagnostic
helpers, shared toGenerateError
Reject non-object ack/ping/pong payloads, empty ids, non-object next payloads
and error payloads that are not a non-empty list of entries with a message,
before any ack, keep-alive or routing state changes.
Extend the 4400 table with the shapes graphql-ws's validateMessage rejects:
empty ids, array or missing next payloads, error payloads that are not a
non-empty list of formatted errors, and non-object ack/ping/pong payloads.
The socket is read while connectionParams runs, so a close fails waiting
operations; the ack timeout still starts after connection_init. An invalid
server message closes the connection with 4400. 1002 joins fatalCloseCodes.
Failing regressions for review findings: a close while connectionParams is
pending must fail the waiting operation, an invalid server message must close
the connection with 4400, and 1002 must be fatal. A server pong stays valid.
layerHttp sends subscriptions as graphql-sse distinct mode on the same URL,
or over graphql-ws with subscriptions.webSocket. layerWebSocket sends every
operation over one lazily connected, multiplexed graphql-ws socket with
connectionParams, an ack timeout, keep-alive pings, idle close and close-code
classification. makeHttp and makeWebSocket are exported as effects.
Failing tests ahead of the implementation: graphql-ws against an in-memory
WebSocketConstructor under TestClock, graphql-sse against a streaming
HttpClient, client-level resubscribe over WS, and one Node end-to-end test
with a hand-rolled server for POST, SSE and graphql-ws.
Fixes the stage-5 review findings on 55f4e7ecfd:
- A merged field with several occurrences carries each occurrence's
@skip/@include condition to the children it adds, since the parent can
be present because of another occurrence. A field's only occurrence
still keeps its children required.
- On an interface or union, the fallback member only takes fragments on
the type itself or on an interface it declares. Every other fragment
names its object types as their own members: a fragment on the only
possible type keeps its member, and an interface fragment covering every
member of a union, or of an interface that doesn't declare its fields,
no longer resolves those fields against the parent and crashes.
Failing regressions for the stage-5 review of 55f4e7ecfd:
- A merged field whose second occurrence is conditional, written directly
or through a conditional spread, keeps that condition on the children it
adds. A field whose only occurrence is conditional keeps its children
required (passes today; guards the fix).
- A fragment on the only possible type of an interface or a union keeps
its own member, so the selected field decodes and a malformed member
fails.
- An interface fragment covering every possible type of a union, or of an
interface that doesn't declare the field, generates and decodes.
Stage 5 (EFF-1917) of the generator:
- Selections on interfaces and unions emit a Schema.Union discriminated by
__typename: one Literal struct per object type the selection names
through a fragment that doesn't cover every possible type, and a last
struct built with GraphQL.otherTypename<Shared.Typename.X>(). Inline
fragments and spreads on interfaces apply to every implementer they
cover. __typename is added to the decoded Schema and to every abstract
selection set in the printed document (not inside inline fragments,
which share their parent's object).
- The shared module emits each reached abstract type's possible types
once, as a type in its Typename namespace.
- Fragments on interfaces and unions are a Schema.Union const and a type
alias.
- @skip/@include with a variable condition make the fields they cover
optionalKey, through spreads and inline fragments; a conditional spread
is always written out inline. Literal conditions are folded, and the
document keeps every directive.
- @oneOf input objects are a Schema.Union of structs, each requiring one
non-null key with the others optionalKey(Never), so two keys or none
fail to encode. A class can't extend Opaque over a union (TS2509), so
they are `export const X = Schema.Opaque<X>()(Schema.Union([...]))` with
the type written out as `export type X`.
- Subscriptions emit GraphQL.subscription and join the file's group.
- Recursive input objects remain a located error.
- Snapshots regenerated, adding timeline.graphql.ts and the subscriptions
set.
Contract tests for stage 5 (EFF-1917), ahead of the implementation:
- Unions and interfaces (EFF-1831 point 4): __typename added first in the
document and Schema, one Literal struct per inline fragment plus an
otherTypename member, the shared Typename namespace, fragments on abstract
types as Schema.Union aliases, and decode checks through the generated
modules.
- @skip/@include (EFF-1832 point 11): variable conditions on a field, a
spread and an inline fragment, folded literal conditions, and a partly
optional fragment written inline, asserting the Schema text and printed
document.
- @oneOf inputs (point 12): Opaque over a Union; one key encodes, two keys,
no key or a null key fail.
- Subscriptions: GraphQL.subscription joins the file's group.
- GitHub set: the prototype's timeline.graphql, ActorFields on the Actor
interface, GitObjectID mapped in the fixture scalars.
- Hand-written SDL fixture sdl/subscriptions.graphql with a Subscription
root, a @oneOf input, nested interfaces and an enum, plus its documents.
- Snapshot entries for timeline.graphql.ts and the subscriptions set, and
runtime tests that import them through a mock GraphQLProtocol.
- Stage-5 "not supported yet" cases now expect no diagnostics; recursive
input objects stay a located error.
The new snapshot files are not committed. They come from the
implementation run with `-u`, and until then the runtime test can't
import them.
Each merged selection now records the spread in the file being emitted
through which another file's fragment was written out inline, and every
import records the first such spread. A module that exports a group and
imports a fragment of the same name is a located error at that spread,
replacing the syntactic check that missed imports exposed by inlining.
A spread that doesn't lead to the import, such as a non-overlapping
...Outer, is no longer considered.
A fragment named like the file's group, imported only because an
overlapping spread was written out inline, must be a located error at
that spread in the operation file, with no files emitted.
- Report a cycle in the imports between generated files as one located
error at its first cross-file spread (file order, then position), naming
the files on the cycle, instead of emitting modules that throw.
- Reject a local or imported fragment that would bind the name of the
group its file exports.
- Give shared-module types that can't be bound (reserved words, eval,
arguments) a local alias exported under the GraphQL name, and allocate
the effect/Schema and scalar module imports around every type name.
- Emit __proto__ struct keys as computed keys so they stay own fields.
Failing tests for the four stage-4 review findings, plus two passing
controls:
- a two-file fragment arrangement whose generated imports form a cycle
must be one located error at the first cross-file spread on the cycle;
- a local or imported fragment named like the file's group is a located
error, while a fragment-only file may use its own group name;
- an enum named Schema and an input object named default must emit
modules that load and round-trip;
- a __proto__ alias or variable must be an own struct field.
importGenerated writes generated output under test/.tmp and imports it so
tests can check that modules load.
- Snapshot the GitHub set to test/generated/github/*.graphql.ts with
toMatchFileSnapshot; pnpm check typechecks the snapshots, and oxlint and
dprint skip them.
- Build a GraphQLClient from the generated IssuesGroup and run RepoIssues
and AddComment against a mock HttpClient with GitHub-shaped responses.
- Cover the deferred stage-5 diagnostics, reserved names and introspection
JSON schemas.
- Correct the RepoIssues document expectation to the token-minimal printer
output (no commas).
- Narrow the test tsconfig fixture exclude to JSON so documents/scalars.ts
is in the program.
Public Config (defineConfig and the config Schema) and Generator
(generate(config, { cwd })) modules for EFF-1916. generate reads the
schema and the documents globs, validates them, and returns every
.graphql.ts file plus the shared module in memory, with located
diagnostics and one warning listing unmapped custom scalars.
Selections on interfaces and unions, @skip / @include, @oneOf and
recursive input objects, and subscriptions are reported as errors until
stage 5.