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.
Contract tests for the public Config and Generator modules (EFF-1916):
EFF-1832 mapping rules 1-10 on a hand-written SDL, scalar specifiers and
output locations (EFF-1834 points 5-7), per-file output and fragment reuse
(EFF-1831), diagnostics, and the GitHub document fixtures the snapshot set
will be generated from. Snapshots and the runtime test come later.
Fix run for the three stage-3 review findings confirmed in 3098332ad1.
Production code only; tests unchanged.
- One validator now covers all input files and builds a single fragment
index from them, as EFF-1831 point 3 allows importing a fragment from
another file. Spread resolution, transitive variable usage, unused
fragment tracking and cycle detection all use that index. Each node
carries its file index, so a diagnostic is reported in the file that
holds the node: an undefined variable at its usage inside the other
file's fragment, and a cycle at its first spread.
- Operations and fragments share one name table. When the definitions
sharing a name are all one kind, the existing message stays. When kinds
mix, each one gets `There can be only one operation or fragment named
"X".`
- A composite type overlaps itself before possible types are compared,
matching graphql-js's doTypesOverlap. This fixes interfaces that
nothing implements yet.
The module and validate() docs now describe cross-file resolution and
the shared namespace.
246 of 246 generator tests pass; pnpm lint, check and jsdocs --check
pass.
Tests-only run for the stage-3 review of f2ea6726fd. All three findings
hold against the accepted specs.
- Fragments resolve across files (EFF-1831 point 3: a fragment used from
another file is imported from it). The passing case spreads a fragment
from a fragments-only file, and that fragment uses a variable the
operation defines. The failing case has a cycle that spans two files and
an undefined variable, each reported in the file that holds the node.
- Operations and fragments share one namespace (EFF-1831 point 3). A name
used by both kinds, in one file or across files, gives every definition
`There can be only one operation or fragment named "X".` The existing
operation/operation and fragment/fragment messages are unchanged.
- A composite type overlaps itself, as graphql-js's doTypesOverlap does.
The shared schema gains `interface Orphan` with no implementations.
Spreading it inline and as a named fragment inside an Orphan field
passes, and spreading it into User still fails.
The new invalid cases were checked against graphql-js 16.14.2 where it
has a matching rule, with multi-file cases concatenated into one
document.
4 of 246 generator tests fail, all against the current Validate.ts;
pnpm lint and check pass.
Implementation run for EFF-1915 (stage 3); production code only, tests
unchanged.
- SchemaModel.ts gains the helpers both readers share: built-in scalar
and directive names, the default deprecation reason, and conversion
of AST const values and types into the model.
- SdlReader collects definitions and extensions, checks that each
extension matches a defined type of the same kind, then merges them in
document order. Interface possible types come from the object types
that implement them. Roots come from `schema` / `extend schema`, or
from the `Query` / `Mutation` / `Subscription` names.
- IntrospectionReader reads the JSON directly. It accepts both response
shapes, parses `defaultValue` strings with parseConstValue, treats the
newer keys as optional, and reports malformed input with the JSON path
of the bad value.
- Validate checks the EFF-1829 point 5 rules per document, then operation
and fragment name uniqueness across files. Diagnostics are sorted by
file and position. Fragment cycles are reported once, at the first
spread on the cycle, as graphql-js reports them.
240 of 240 generator tests pass; pnpm lint, check and jsdocs --check
pass.
Tests-only run for EFF-1915 (stage 3).
Define the internal contract: the schema model in
src/internal/SchemaModel.ts, and the SdlReader.read,
IntrospectionReader.read and Validate.validate signatures. The reader
and validator bodies are placeholders that throw until the
implementation run lands.
- Acceptance: the GitHub introspection JSON and an SDL derived from it
produce equal models, compared type by type so a failure names the
first differing type. The vendored github/docs SDL is a different
snapshot (about 290 types apart), and octokit's schema.graphql at the
pinned commit doesn't match either, so test/fixtures/github/
schema.graphql is printed from schema.json by graphql-js 16.14.2.
The README records its digest and how to regenerate it. Spot checks
pin a few types as literals, plus the { data: { __schema } } shape
and reading the github/docs SDL on its own.
- Hand-written SDL fixtures under test/fixtures/sdl/, each with an
expected model: @oneOf, @specifiedBy, input and argument
deprecation, repeatable directives with dropped and undeclared
applied directives, a Subscription root, and every extend form.
- test/fixtures/introspection/modern.json, which is graphql-js
introspection of modern.graphql with every newer key enabled, must
read to the same model as its SDL.
- Validation: each EFF-1829 point 5 rule and the cross-file name rule
has a passing document and a failing one, with every diagnostic's
path, line, column and message. Messages and locations were checked
against graphql-js 16.14.2 where it has a matching rule.
30 new tests fail on the placeholder errors; the 210 existing tests
pass. pnpm lint, check and jsdocs --check pass.
Follow-up to the stage-2 review of PR #8979; production code only.
- Descriptions on operations, fragments and variable definitions, as the
September 2025 edition allows. The AST nodes gain `description`, the
parser reads it, the shorthand rejects it with graphql-js's wording,
and the extension diagnostic uses the 16.12+ wording. The printer
drops descriptions from the compact document.
- Comments are scanned by Unicode scalar value, so an unpaired
surrogate in a comment is reported like one anywhere else.
- The printer is token-minimal: arguments, list values and object
fields no longer get a separator when punctuation already separates
them.
- Lexer.ts and Parser.ts carry the graphql-js v16.14.2 MIT notice
(Copyright (c) GraphQL Contributors), since both adapt its structure.
Headers now name the September 2025 edition.
210 of 210 generator tests pass; pnpm lint, check and jsdocs --check
pass.
Tests-only run after the stage-2 review of PR #8979.
- Descriptions on operations, fragments and variable definitions, which
the September 2025 edition (the current published edition EFF-1829
names) adds to the executable grammar: conformance cases, AST shape
expectations, the shorthand/field/end-of-input diagnostics, and the
extension diagnostic reworded as graphql-js 16.12+ words it. The
compact printer drops these descriptions, so print/parse round trips
are compared without them.
- Compact printing settled as token-minimal: a single space only where
two adjacent non-punctuator tokens would otherwise merge. Three value
literals lose the separator after `]` or `}`.
- Comments and other positions must reject unpaired surrogates, which
are not source characters under the "any Unicode scalar value" rule;
astral and control characters in comments stay valid.
Production code is untouched; the new expectations fail until the
follow-up implementation run lands.
Implement the language front end against the committed contract and
tests. The lexer covers the full October 2021 lexical grammar: ignored
tokens including BOM and comments, punctuators, names, int and float
numbers, strings with fixed- and variable-width unicode escapes and
surrogate pairs, and block strings with the spec's dedent algorithm.
The recursive-descent parser covers executable and type-system
documents including every extend form, schema blocks, repeatable
directives and interfaces implementing interfaces, and stops at the
first error. Diagnostics carry 1-based line and UTF-16 column, a
graphql-js-worded message, and a code frame with neighbouring lines.
The printer emits compact executable documents.
184 of 185 tests pass. The remaining case, `{ $v }`, expects
`Unexpected "$".` but graphql-js (the arbiter the tests name) reports
`Expected Name, found "$".`, which this parser also produces; the
expectation is left for a separate test run.
Scaffold packages/tools/graphql-generator from openapi-generator and
register it on every root surface (workspace lockfile, tsconfig
references and test path alias, vitest project, changesets fixed group,
README catalog, dprint exclusion for the vendored JSON). Vendor the
pinned GitHub schema fixtures (github/docs SDL at b93d24a, octokit
introspection JSON at 597478f) with their MIT notices, digests and
refresh procedure, plus four hand-written operation documents.
Define the internal contract for the EFF-1914 slice: the full-grammar
AST in src/internal/Ast.ts, the located Diagnostic error, and the
parse / parseConstValue / print signatures. Parser and Printer bodies
are placeholders that throw until the implementation run lands.
Tests pin the contract at the parse and print seams: table-driven
conformance cases per grammar section with compact printed forms,
every extend form and type-system definition, spec lexical cases for
strings, block strings and numbers, diagnostic positions, messages and
code frames, printer round trips over the cases and the GitHub
operations, and the fixture's definition counts. 183 of 185 tests fail
with the placeholder error; pnpm lint, check and jsdocs --check pass.
- PagingVariables requires `after` to be optional and accept a string;
a required or non-string cursor is InvalidAfterVariable. `after?: string`
stays accepted.
- data: null (or missing) without errors is a DecodeError before the
result codec runs, on strict and partial calls.
- make builds methods from a Runtime<Op> typed by the operation instead of
any-typed helpers. Method overloads are declared on the implementation;
the remaining type boundaries (mapped client type, `next`, empty call
context, pages' strict-overload call, lenient codecs, phantom group and
operation types) are narrow assertions with a comment each.
- Subscription retries only step the schedule for retryable
GraphQLClientErrors, so middleware errors no longer reach a schedule
typed for GraphQLClientError.
- pages / items reject a required or non-string $after variable and
accept an optional string-only one
- data: null without errors is a DecodeError even when the result codec
accepts null, on both the strict and the partial path
These fail against a9ff88869a on purpose; the fixes land in a separate
implementation run.
Add the experimental effect/graphql module: GraphQL operations as plain
values, groups with group-level middleware, a client with one method per
operation, GraphQL-level middleware tags with { execute, subscribe } and
mapRequest, the GraphQLProtocol service with an HTTP transport for
queries and mutations, the GraphQLClientError model with five
Schema.TaggedError reasons and isRetryable, per-call partial results,
the pages / items cursor paging helpers, and the otherTypename /
enumLiterals lenient decoding helpers for generated code.
Register the ./graphql export, add the effect/graphql test path alias,
and add the effect changeset.
Runtime tests in packages/effect/test/graphql and type tests in
packages/effect/typetest/graphql for the EFF-1913 slice: errors and
their Schemas, the HTTP transport, middleware order and mapRequest,
variable encoding, partial results, paging, subscription retry, and the
otherTypename / enumLiterals helpers.
The module does not exist yet, so these fail with a missing-module
error until the implementation lands on this branch.