refactor(graphql): move each resolver-added field's type out of the SDL - #10426
Merged
Conversation
…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.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
metagraphed-wss-lb | 00aee0c | Aug 10 2026, 09:59 AM |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PROJECTED_TYPESdeclared the name of every field a resolver adds and not its type. That leftsrc/graphql-sdl.tsas 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.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-paritynow 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.tsadds 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
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— cleanvalidate:graphql-component-parity— 329 mirrors / 2544 fields / 42 projections (267 fields) / 25 pagination views / 194 drops / 51 under-typings, OKvalidate:published-names— 361 component names, 322 published types, 196 Query bindings, 1 Subscription binding, 42 projections, 0 resolver-built typesnpx vitest run— 799 files, 18,460 passed, 11 skipped, 0 failed08901dedfand re-verified; no generated artifact changes, so no rebuild is neededNo
src/**orworkers/**file changed, so there is nocodecov/patchsurface in this diff.Refs #10214.