Commit Graph
11504 Commits
Author SHA1 Message Date
Tim Smart 85dcdb4e6f test(graphql): specify the graphql-ws and graphql-sse subscription transports
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.
2026-10-12 16:00:47 +13:00
Tim Smart 6df83e8e64 fix(graphql-generator): keep watch kinds explicit and reconcile cycle targets 2026-10-12 16:00:47 +13:00
Tim Smart 1b6c6f07f9 test(graphql-generator): reproduce root creation during watch installation 2026-10-12 16:00:47 +13:00
Tim Smart 75e8889c29 fix(graphql-generator): recover watched roots that are missing, deleted or failing; keep the parse cache internal 2026-10-12 16:00:47 +13:00
Tim Smart 438501c6e4 test(graphql-generator): cover missing roots and rename-over saves 2026-10-12 16:00:47 +13:00
Tim Smart bb7782fd21 test(graphql-generator): trim watch coverage to focused regressions 2026-10-12 16:00:47 +13:00
Tim Smart 7e0b47aace feat(graphql-generator): graphqlgen --watch with debounced cycles, parsed-input caching and config reloads 2026-10-12 16:00:47 +13:00
Tim Smart 76983316ce test(graphql-generator): tests-first graphqlgen --watch loop contract 2026-10-12 16:00:47 +13:00
Tim Smart 1b83c606d2 fix(graphql-generator): skip protected glob roots in both walks 2026-10-12 16:00:47 +13:00
Tim Smart e1e7a0fe45 test(graphql-generator): documents roots inside node_modules or dot-directories match nothing 2026-10-12 16:00:47 +13:00
Tim Smart 33bb58d04b test(graphql-generator): cover config failures and deletion safety 2026-10-12 16:00:47 +13:00
Tim Smart 696ebe0b90 feat(graphql-generator): graphqlgen CLI with config loading, all-or-nothing writes, stale cleanup and --check 2026-10-12 16:00:47 +13:00
Tim Smart b050786e1b test(graphql-generator): tests-first graphqlgen CLI and documents glob matcher 2026-10-12 16:00:47 +13:00
Tim Smart 05f1917436 fix(graphql-generator): merged-field conditions and abstract member selection
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.
2026-10-12 16:00:47 +13:00
Tim Smart 92bd55b756 test(graphql-generator): stage-5 review regressions for merged conditions and abstract members
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.
2026-10-12 16:00:47 +13:00
Tim Smart 5cfd13bbd1 feat(graphql-generator): unions, interfaces, @skip/@include, @oneOf and subscriptions
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.
2026-10-12 16:00:47 +13:00
Tim Smart 875a38be6b test(graphql-generator): tests-first abstract types, @skip/@include, @oneOf and subscriptions
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.
2026-10-12 16:00:47 +13:00
Tim Smart 27a7bd1aab fix(graphql-generator): check group-name collisions against emitted imports
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.
2026-10-12 16:00:47 +13:00
Tim Smart c54186f108 test(graphql-generator): group-name collision introduced by an inlined spread
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.
2026-10-12 16:00:47 +13:00
Tim Smart 8db559c342 fix(graphql-generator): module cycles, group bindings, shared schema names and __proto__ keys
- 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.
2026-10-12 16:00:47 +13:00
Tim Smart a5b36b2f8e test(graphql-generator): regressions for module cycles, group bindings, schema names and __proto__
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.
2026-10-12 16:00:47 +13:00
Tim Smart 5a041880e2 test(graphql-generator): GitHub snapshots, runtime acceptance and stage-5 diagnostics
- 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.
2026-10-12 16:00:47 +13:00
Tim Smart 3141289c27 feat(graphql-generator): generate core, mapping rules, emitter and shared module
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.
2026-10-12 16:00:47 +13:00
Tim Smart db669998eb test(graphql-generator): tests-first generate core, mapping rules and shared module
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.
2026-10-12 16:00:47 +13:00
Tim Smart c077c2fdb3 fix(graphql-generator): validate input files together
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.
2026-10-12 16:00:47 +13:00
Tim Smart 099bc4dc5b test(graphql-generator): cross-file fragments, shared name namespace, self-overlap
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.
2026-10-12 16:00:47 +13:00
Tim Smart 5dd1c754ce feat(graphql-generator): schema model readers and validation
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.
2026-10-12 16:00:47 +13:00
Tim Smart 2e3c403d87 test(graphql-generator): tests-first schema model, readers and validation
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.
2026-10-12 16:00:47 +13:00
Tim Smart 6ca6af90bf feat(graphql-generator): September 2025 edition, token-minimal printer, attribution
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.
2026-10-12 16:00:47 +13:00
Tim Smart e56b727a08 test(graphql-generator): September 2025 edition, token-minimal printing, comment characters
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.
2026-10-12 16:00:47 +13:00
Tim Smart 0a7ef5c270 test(graphql-generator): align selection diagnostic with reference 2026-10-12 16:00:47 +13:00
Tim Smart 2edbfb9721 feat(graphql-generator): lexer, parser, printer and diagnostics
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.
2026-10-12 16:00:47 +13:00
Tim Smart 7d34ab3bad test(graphql-generator): tests-first foundation for the language front end
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.
2026-10-12 16:00:47 +13:00
Tim Smart 772439ab41 test(graphql): cover middleware subscription failures 2026-10-12 16:00:47 +13:00
Tim Smart e251dc533c fix(graphql): review fixes and typed client construction
- 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.
2026-10-12 16:00:47 +13:00
Tim Smart 886ad1ce4f test(graphql): regression tests for review findings on PR #8979
- 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.
2026-10-12 16:00:47 +13:00
Tim Smart f7b783afd1 feat(graphql): effect/graphql runtime core
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.
2026-10-12 16:00:47 +13:00
Tim Smart 88a94401e3 test(graphql): tests-first foundation for the effect/graphql runtime core
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.
2026-10-12 16:00:47 +13:00
Tim 8f1ea52f0c Fix grouped RequestResolver batch key retention (#9041) 2026-10-12 15:43:30 +13:00
effect-botandTim Smart fccf660d83 Add request-scoped MCP HTTP layer (#9031)
Co-authored-by: Tim Smart <hello@timsmart.co>
2026-10-12 12:45:05 +13:00
effect-botandTim e1c6053c5e Release aborted web handler requests and streamed bodies (#9037)
Co-authored-by: Tim <hello@timsmart.co>
2026-10-11 23:23:31 +00:00
effect-bot 7440cf0884 Document Cloudflare Workers shared-fiber limitations (#9033) 2026-10-11 21:08:54 +00:00
effect-bot 4a999a34e8 Clean up Anthropic documentation imports and omitted binding (#9029) 2026-10-11 20:51:13 +00:00
Tim eebdf25f99 Batch SQLite Node Resolver fixture inserts (#9028) 2026-10-12 09:16:08 +13:00
Tim 5d88d8761d Update repository dependencies (#9027) 2026-10-12 09:15:44 +13:00
Tim 689fec6543 Avoid busy polling in Sharding claim-expiry tests (#9022) 2026-10-12 09:08:28 +13:00
effect-botandTim 22e7129023 Expose Scalar preferred authentication security scheme configuration (#9019)
Co-authored-by: Tim <hello@timsmart.co>
2026-10-11 19:12:30 +00:00
Jay HemnaniandEffect Bot 78e4c435ed Fix Multipart.toPersisted failing on dot and long multi-byte file names (#9013)
Co-authored-by: Effect Bot <tech-ops@effectful.co>
2026-10-12 08:04:57 +13:00
5726c655af fix(platform-node): skip taskkill for exited children (#9015)
Co-authored-by: Alb11747 <albertli_042@hotmail.com>
Co-authored-by: Effect Bot <tech-ops@effectful.co>
2026-10-12 08:03:43 +13:00
Tim 8b097ac4ba Stabilize cross-queue deduplication delivery assertion (#9021) 2026-10-12 08:03:11 +13:00