Skip to content

feat(graphql-codegen): realtime subscriptions SDK + e2e harness#1206

Draft
yyyyaaa wants to merge 5 commits into
mainfrom
fix/realtime-subscriptions-e2e
Draft

feat(graphql-codegen): realtime subscriptions SDK + e2e harness#1206
yyyyaaa wants to merge 5 commits into
mainfrom
fix/realtime-subscriptions-e2e

Conversation

@yyyyaaa
Copy link
Copy Markdown
Contributor

@yyyyaaa yyyyaaa commented May 21, 2026

Summary

Generate a realtime subscriptions SDK (ORM subscribe() + events() AsyncIterable + React Query hook) from the GraphQL schema, with a RealtimeManager runtime that exposes a discriminated ConnectionState, onConnectionStateChange replay, and a close() lifecycle. Ship a private e2e harness (graphile-realtime-codegen-e2e) that compiles the generated output and exercises it against real PostgreSQL + PostGraphile + graphql-ws so the SDK contract is validated against actual LISTEN/NOTIFY traffic, not mocks.

Commits

  1. feat(graphql-query) — expose subscription metadata from introspection so codegen can decide whether to emit subscription bindings per table.
  2. feat(graphql-codegen) — RealtimeManager runtime + generator wiring + templates for the realtime SDK.
  3. test(graphql-codegen) — RealtimeManager unit coverage, subscription compile check, and refreshed model/client/hook/introspection snapshots.
  4. test(graphile-realtime-codegen-e2e) — new private package that compiles generated ORM + hooks and runs end-to-end against real PG + WS + PostGraphile (no mocks).
  5. chore — CHANGELOG entries, version bumps for graphql-query and graphql-codegen, and pnpm-lock refresh.

Verification

  • graphql/codegen unit + snapshot suite passes locally (381 tests, 124 snapshots).
  • 9/9 e2e tests pass in graphile/graphile-realtime-codegen-e2e/ against constructiveio/postgres-plus (3 ORM + 6 React hook / lifecycle / AsyncIterable tests).

Test plan

  • CI green on graphql/codegen
  • Manual run of e2e harness against constructiveio/postgres-plus:
    • pgpm docker start --image constructiveio/postgres-plus --recreate && eval "$(pgpm env)"
    • pnpm --filter @constructive-io/graphile-realtime-codegen-e2e test
  • Spot-check generated subscribe() typing in a downstream consumer

yyyyaaa added 5 commits May 21, 2026 13:29
Surface per-table subscription capabilities from the schema introspector so
downstream codegen can decide whether to emit realtime subscription bindings.
Generate a per-table realtime subscription surface alongside the existing ORM
and React Query outputs. Adds a RealtimeManager runtime with discriminated
ConnectionState, AsyncIterable events(), onConnectionStateChange replay, and a
close() lifecycle, plus the generator wiring that emits typed subscribe()
methods on each model and the supporting templates.
Add unit coverage for the RealtimeManager runtime contract, a compile-check
test for the generated subscription output, and refresh model/client/hook
snapshots plus introspection tests to reflect the new subscription metadata.
…bscription SDK

Introduce a private package that compiles the generated ORM and React Query
realtime output and exercises it against a real PostgreSQL + PostGraphile +
graphql-ws stack. Covers subscribe, events() AsyncIterable, unsubscribe,
onConnectionStateChange replay, close(), and the React hook lifecycle without
mocks so the SDK contract is validated against actual LISTEN/NOTIFY traffic.
Record the new realtime subscription work in the graphql-query and
graphql-codegen changelogs, bump their versions, and refresh pnpm-lock to
pick up the new e2e harness package.
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