Skip to content

SRE-1215: Upgrade @graphql-codegen/cli to 7 and its plugins to their next majors - #10088

Open
claude[bot] wants to merge 3 commits into
mainfrom
claude/graphql-codegen-v7-migration
Open

claude[bot] wants to merge 3 commits into
mainfrom
claude/graphql-codegen-v7-migration

Conversation

@claude

@claude claude Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Requested via Slack thread

🌟 Purpose

Prototype of the GraphQL Code Generator major upgrade, so we can see what it costs. The CLI 6 / plugin 5 line depends on @graphql-tools/utils ^11; the new majors depend on ^12, so this moves @graphql-tools/utils from 11.0.0 to 12.0.3 everywhere in the lockfile.

🔍 Changes

  • Versions. @graphql-codegen/cli ^6.2.1 → ^7.4.6, typescript 5.0.9 → 6.1.2, typescript-operations 5.0.9 → 6.1.10, typescript-resolvers 5.1.7 → 6.1.1, introspection 5.0.1 → 6.1.0, fragment-matcher 6.0.0 → 7.1.0. Transitively, the @graphql-tools/* loaders, delegate, wrap, executor (1.x → 2.0.3) and graphql-config 5.1.8. Each package resolves to a single version. @graphql-codegen/add 7.1.1 is added as a dev dependency where it is used.
  • Generated file split. typescript-operations 6 now generates the Input and Enum types its operations use, so running it in the same file as typescript declared those types twice (10 to 18 duplicates per file). This follows upstream's multi-file setup: typescript (plus typescript-resolvers in hash-api) writes schema-types.gen.ts, and typescript-operations writes api-types.gen.ts with importSchemaTypesFrom. An add line re-exports the schema types from api-types.gen.ts, so no import site changes. Upstream's single-file setup drops the typescript plugin, but hash-api imports about 100 resolver and args types and the frontend about 20 object types (such as FlowRun) from it, so we still need it.
  • base-codegen-config.ts is now typed for both plugins, because skipTypename moved from the shared visitor config to the typescript plugin's config.
  • Breaking changes that reached our code. Result types no longer have an optional __typename unless the query selects it. That broke one call site, useHashInstance, which destructured __typename away; it now picks the two flags explicitly. Apollo still adds __typename at runtime. Other changes that applied without type errors: nullable result fields are now T | null rather than optional (274 → 27 optional fields in the frontend's operation types), unmapped custom scalars default to unknown instead of any, and input ID is string | number.
  • Removed the unused @graphql-codegen/typescript-graphql-request from hash-backend-integration. Its latest stable release (7.1.0) still depends on the 6.x helpers that pin @graphql-tools/utils ^11, and only an 8.0.0 alpha moves off them.
  • Generated code. The *.gen.* files are gitignored, so they are not in the diff. After formatting before and after the same way, the regenerated output changes by roughly +880 / −870 lines across six workspaces (hash-frontend +352/−467, hash-api +264/−154, plugin-browser +96/−99, hash-playwright +92/−99, hash-isomorphic-utils +69/−42, hash-backend-integration +5/−10). The source diff is 93 added and 32 removed lines, plus the lockfile.

Checked locally:

  • codegen in all six codegen workspaces.
  • lint:tsc through turbo for hash-isomorphic-utils, hash-backend-utils, hash-api, hash-frontend, plugin-browser, hash-playwright and hash-backend-integration. All clean after the useHashInstance fix.
  • ESLint and oxfmt on the changed files.
  • test:unit for hash-isomorphic-utils (360 tests), hash-api (311) and hash-frontend (1450). All pass.
  • yarn install --immutable, yarn dedupe --strategy highest --check and yarn constraints, all with Yarn 4.18.1.

⚠️ Known issues

  • Not run locally: integration tests, Playwright, and a manual check of the frontend in a browser. The type changes are compile-time only, but the lost __typename and ? on result types could hide a mismatch with what Apollo's cache returns at runtime. That would show up as code narrowing on __typename with no type error.
  • The split is the smallest change for consumers. Moving the frontend and other clients to the single-file typescript-operations setup that upstream recommends would mean replacing their uses of schema object types, and it is out of scope here.

@vercel

vercel Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hash Ready Ready Preview Oct 20, 2026 9:17am UTC
hashdotdesign-tokens Ready Ready Preview Oct 20, 2026 9:17am UTC
petrinaut Ready Ready Preview Oct 20, 2026 9:17am UTC
petrinaut-docs Ready Ready Preview Oct 20, 2026 9:17am UTC

Request Review

@github-actions github-actions Bot added area/deps Relates to third-party dependencies (area) area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-api Affects the HASH API (app) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team type/eng > backend Owned by the @backend team area/tests New or updated tests area/tests > integration New or updated integration tests area/tests > playwright New or updated Playwright tests area/apps labels Oct 19, 2026
@claude
claude Bot deployed to pull-request October 19, 2026 09:38 Active
@claude
claude Bot deployed to pull-request October 19, 2026 09:38 Active
@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.02%. Comparing base (a5673b4) to head (758fccd).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...somorphic-utils/src/graphql/base-codegen-config.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10088   +/-   ##
=======================================
  Coverage   68.01%   68.02%           
=======================================
  Files        2003     2003           
  Lines      205921   205921           
  Branches     8786     8786           
=======================================
+ Hits       140059   140073   +14     
+ Misses      64197    64185   -12     
+ Partials     1665     1663    -2     
Flag Coverage Δ
apps.hash-ai-worker-ts 6.85% <ø> (ø)
apps.hash-api 15.59% <ø> (ø)
local.hash-backend-utils 6.21% <ø> (ø)
local.hash-isomorphic-utils 32.01% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Move `@graphql-codegen/cli` to 7.4.6 and the official plugins to their
next majors (`typescript` and `typescript-operations` 6, `typescript-resolvers`
6, `introspection` 6, `fragment-matcher` 7). This lets `@graphql-tools/utils`
resolve to 12.x across the lockfile.

`typescript-operations` 6 now emits the Input and Enum types its operations
use, so running it in the same file as `typescript` declares them twice.
Follow upstream's multi-file setup: `typescript` (and `typescript-resolvers`
in hash-api) writes `schema-types.gen.ts`, and `typescript-operations` writes
`api-types.gen.ts`, imports schema types through `importSchemaTypesFrom` and
re-exports them, so existing imports from `api-types.gen` keep working.

Result types no longer carry an optional `__typename` unless the selection
requests it, so `useHashInstance` picks the integration flags explicitly.

Drop the unused `@graphql-codegen/typescript-graphql-request` from
hash-backend-integration; its latest release still depends on the 6.x helpers.
@claude claude Bot changed the title Upgrade @graphql-codegen/cli to 7 and its plugins to their next majors SRE-1215: Upgrade @graphql-codegen/cli to 7 and its plugins to their next majors Oct 20, 2026
@cursor

cursor Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Broad dev-dependency and generated-type changes across API, frontend, and tests; compile-time fixes are in place but regenerated nullability/__typename behavior could surface subtle Apollo cache mismatches at runtime if not fully exercised in CI.

Overview
Upgrades GraphQL Code Generator across the monorepo (@graphql-codegen/cli 6 → 7, TypeScript plugins 5 → 6, fragment-matcher/introspection/resolvers to matching majors) and refreshes the lockfile (@graphql-tools/utils 11 → 12, transitive tooling bumps).

Codegen is restructured to avoid duplicate schema types under typescript-operations 6: each workspace now emits schema-types.gen.ts (schema + resolver types where needed) and api-types.gen.ts (operations only, with importSchemaTypesFrom plus an add re-export so existing api-types.gen imports stay the same). baseGraphQlCodegenConfig is typed for both plugin configs.

Runtime/type fallout: useHashInstance stops destructuring __typename from enabledIntegrations and explicitly picks googleSheets / linear (generated result types no longer include optional __typename unless selected). Unused @graphql-codegen/typescript-graphql-request is dropped from hash-backend-integration.

Reviewed by Cursor Bugbot for commit 758fccd. Bugbot is set up for automated code reviews on this repo. Configure here.

This branch was successfully deployed

5 active deployments
Preview – hash — 758fccd5 Deployed Oct 20, 2026 by vercel[bot]
Preview – petrinaut-docs — 758fccd5 Deployed Oct 20, 2026 by vercel[bot]
Preview – petrinaut — 758fccd5 Deployed Oct 20, 2026 by vercel[bot]
Preview – hashdotdesign-tokens — 758fccd5 Deployed Oct 20, 2026 by vercel[bot]
pull-request — 758fccd5 Deployed Oct 20, 2026 by claude[bot] via Sourcemaps (@apps/hash-integration-worker) #40561
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-api Affects the HASH API (app) area/apps area/deps Relates to third-party dependencies (area) area/libs Relates to first-party libraries/crates/packages (area) area/tests > integration New or updated integration tests area/tests > playwright New or updated Playwright tests area/tests New or updated tests type/eng > backend Owned by the @backend team type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

2 participants