Skip to content

refactor(graphql): move each resolver-added field's type out of the SDL - #10426

Merged
JSONbored merged 1 commit into
mainfrom
feat/graphql-added-field-types
Aug 10, 2026
Merged

refactor(graphql): move each resolver-added field's type out of the SDL#10426
JSONbored merged 1 commit into
mainfrom
feat/graphql-added-field-types

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

PROJECTED_TYPES declared the name of every field a resolver adds and not its type. That left src/graphql-sdl.ts as the only place those 150 shapes are written down — and unlike every other field in the schema, a resolver-added one has no component to read a shape from. It is the concrete thing stopping the generator from emitting them.

- readonly added: readonly string[];
+ readonly added: Readonly<Record<string, string>>;
  GlobalHealth: {
    component: "HealthSummaryArtifact",
-   added: ["status", "ok_count", "degraded_count", ],
+   added: {
+     status: "String",
+     ok_count: "Int",
+     degraded_count: "Int",
+     
+   },

Moved, not copied

Every one of the 150 spellings was read out of the SDL, which is still their source today — that is what makes this a move. And validate:graphql-component-parity now compares each declared spelling against what the SDL publishes, so the two cannot drift apart while both exist. Once the SDL is generated, the declaration is simply the source and the check becomes vacuous on its own.

Declaring only the name already made a typo'd or invented field a failure. Declaring the type is what lets the SDL stop being the source.

Why this and not "close the remaining under-typings"

The equivalence report reads 407 of 407 published types with a generator source, 196 of 196 Query return types, and the argument lists deriving from the routes. At that point, hand-writing the remaining shapes into src/graphql-sdl.ts adds a thousand lines to the file the epic exists to delete — it makes the duplication worse, not better. What is actually left is the generator, and this is the input it was missing.

Proving the new check can fail

GlobalHealth.status -- declared as resolver-added Int!, the SDL publishes String

A test mutates one declared spelling and asserts it is reported. Without it the type would be recorded and never compared, which is how the generator would come to emit a field the schema never had.

Validation

  • npm run typecheck, npm run lint, npm run format:check — clean
  • validate:graphql-component-parity — 329 mirrors / 2544 fields / 42 projections (267 fields) / 25 pagination views / 194 drops / 51 under-typings, OK
  • validate:published-names — 361 component names, 322 published types, 196 Query bindings, 1 Subscription binding, 42 projections, 0 resolver-built types
  • npx vitest run — 799 files, 18,460 passed, 11 skipped, 0 failed
  • rebased onto 08901dedf and re-verified; no generated artifact changes, so no rebuild is needed

No src/** or workers/** file changed, so there is no codecov/patch surface in this diff.

Refs #10214.

…DL (#10214)

PROJECTED_TYPES declared the NAME of every field a resolver adds and not its
type, so the SDL was still the only place those 150 shapes were written down --
and a resolver-added field has no component to read one from. That is the
concrete thing stopping the generator from emitting them.

The types are moved, not copied: the gate now compares each declared spelling
against the SDL, so the two cannot drift while both exist, and once the SDL is
generated the declaration is the source.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 10, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
metagraphed-wss-lb 00aee0c Aug 10 2026, 09:59 AM

@superagent-security

Copy link
Copy Markdown

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored self-assigned this Aug 10, 2026
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.78%. Comparing base (08901de) to head (00aee0c).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10426   +/-   ##
=======================================
  Coverage   95.78%   95.78%           
=======================================
  Files         668      668           
  Lines       41837    41837           
  Branches    15476    15476           
=======================================
  Hits        40073    40073           
  Misses        592      592           
  Partials     1172     1172           
Files with missing lines Coverage Δ
schemas-src/graphql/published-names.ts 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit 8e0a950 into main Aug 10, 2026
16 checks passed
@JSONbored
JSONbored deleted the feat/graphql-added-field-types branch August 10, 2026 10:05
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