Skip to content

Remove Symbol references from IOutputTypeInfo and implementations#9058

Merged
michaelstaib merged 7 commits intomainfrom
gai/source-generator-refactoring
Mar 10, 2026
Merged

Remove Symbol references from IOutputTypeInfo and implementations#9058
michaelstaib merged 7 commits intomainfrom
gai/source-generator-refactoring

Conversation

@glen-84
Copy link
Member

@glen-84 glen-84 commented Jan 23, 2026

Summary of the changes (Less than 80 chars)

  • Removed Symbol references from IOutputTypeInfo and implementations.

  • Introduced TypeNameInfo type to store type name information, replacing direct storage of INamedTypeSymbols (SchemaType/RuntimeType).
  • Removed unused Attributes collection from IOutputTypeInfo and derived types.

@github-actions
Copy link
Contributor

🚀 Fusion Gateway Performance Results

Simple Composite Query

Constant Load (50 VUs)

Requests/sec Error Rate
5858.20 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.84ms 7.12ms 161.96ms 8.38ms 13.01ms 18.42ms

Ramping Load (0→50→500→50 VUs)

Requests/sec Error Rate
4592.41 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.82ms 38.74ms 226.38ms 48.30ms 108.55ms 124.75ms

Executed Query

fragment User on User {
  id
  username
  name
}

fragment Review on Review {
  id
  body
}

fragment Product on Product {
  inStock
  name
  price
  shippingEstimate
  upc
  weight
}

query TestQuery {
  topProducts(first: 5) {
    ...Product
    reviews {
      ...Review
      author {
        ...User
      }
    }
  }
}

Deep Recursion Query

Constant Load (50 VUs)

Requests/sec Error Rate
271.24 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
12.46ms 173.12ms 638.15ms 178.95ms 224.67ms 247.53ms

Ramping Load (0→50→500→50 VUs)

Requests/sec Error Rate
304.50 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
3.03ms 689.87ms 1636.25ms 693.00ms 1380.73ms 1473.68ms

Executed Query

fragment User on User {
  id
  username
  name
}

fragment Review on Review {
  id
  body
}

fragment Product on Product {
  inStock
  name
  price
  shippingEstimate
  upc
  weight
}

query TestQuery {
  users {
    ...User
    reviews {
      ...Review
      product {
        ...Product
        reviews {
          ...Review
          author {
            ...User
            reviews {
              ...Review
              product {
                ...Product
              }
            }
          }
        }
      }
    }
  }
  topProducts(first: 5) {
    ...Product
    reviews {
      ...Review
      author {
        ...User
        reviews {
          ...Review
          product {
            ...Product
          }
        }
      }
    }
  }
}

Variable Batching Throughput

Constant Load (50 VUs)

Requests/sec Error Rate
24109.87 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.09ms 1.67ms 47.00ms 2.02ms 3.85ms 4.72ms

Ramping Load (0→50→500→50 VUs)

Requests/sec Error Rate
19047.49 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.09ms 9.05ms 120.25ms 11.08ms 22.89ms 27.60ms

Executed Query

query TestQuery_8f7a46ce_2(
  $__fusion_1_upc: ID!
  $__fusion_2_price: Long!
  $__fusion_2_weight: Long!
) {
  productByUpc(upc: $__fusion_1_upc) {
    inStock
    shippingEstimate(weight: $__fusion_2_weight, price: $__fusion_2_price)
  }
}

Variables (5 sets batched in single request)

[
  { "__fusion_1_upc": "1", "__fusion_2_price": 899, "__fusion_2_weight": 100 },
  { "__fusion_1_upc": "2", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 },
  { "__fusion_1_upc": "3", "__fusion_2_price": 15, "__fusion_2_weight": 20 },
  { "__fusion_1_upc": "4", "__fusion_2_price": 499, "__fusion_2_weight": 100 },
  { "__fusion_1_upc": "5", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 }
]

No baseline data available for comparison.


Run 21286323203 • Commit 14ea88d • Fri, 23 Jan 2026 12:52:42 GMT

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the analyzer models/generators to remove direct Roslyn symbol storage from IOutputTypeInfo implementations, replacing it with a lightweight TypeNameInfo representation.

Changes:

  • Introduces TypeNameInfo and updates output-type models to store type names/keys instead of INamedTypeSymbol references.
  • Removes Attributes from IOutputTypeInfo/implementations and adjusts downstream generator/builder logic accordingly.
  • Centralizes “assembly-qualified” key generation into SymbolExtensions.ToAssemblyQualified.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/HotChocolate/Core/src/Types.Analyzers/Polyfills.cs Adds polyfills for required-member related attributes and IsExternalInit.
src/HotChocolate/Core/src/Types.Analyzers/Models/TypeNameInfo.cs New TypeNameInfo record for storing full + fully-qualified type names.
src/HotChocolate/Core/src/Types.Analyzers/Models/RootTypeInfo.cs Replaces stored symbols/full-name strings with TypeNameInfo + RegistrationKey; removes Attributes.
src/HotChocolate/Core/src/Types.Analyzers/Models/Resolver.cs Stops storing member attributes; computes directive/user-attributes from a local attribute array.
src/HotChocolate/Core/src/Types.Analyzers/Models/ObjectTypeInfo.cs Replaces schema/runtime symbol storage with TypeNameInfo + RegistrationKey; removes Attributes.
src/HotChocolate/Core/src/Types.Analyzers/Models/InterfaceTypeInfo.cs Replaces schema/runtime symbol storage with TypeNameInfo + RegistrationKey; removes Attributes.
src/HotChocolate/Core/src/Types.Analyzers/Models/IOutputTypeInfo.cs Updates interface to expose SchemaTypeName/RuntimeTypeName and RegistrationKey; removes symbol/attributes properties.
src/HotChocolate/Core/src/Types.Analyzers/Models/EdgeTypeInfo.cs Replaces runtime symbol/full-name usage with TypeNameInfo and caches node type fully-qualified name.
src/HotChocolate/Core/src/Types.Analyzers/Models/ConnectionTypeInfo.cs Replaces runtime symbol/full-name usage with TypeNameInfo and caches node type fully-qualified name.
src/HotChocolate/Core/src/Types.Analyzers/Inspectors/ConnectionTypeTransformer.cs Updates runtime-type lookups to use RuntimeTypeName.FullName.
src/HotChocolate/Core/src/Types.Analyzers/Helpers/SymbolExtensions.cs Adds ToAssemblyQualified extension for registration keys.
src/HotChocolate/Core/src/Types.Analyzers/Generators/TypeModuleSyntaxGenerator.cs Uses RegistrationKey and TypeNameInfo fields instead of symbols; removes local helper.
src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/TypeFileBuilderBase.cs Switches runtime-type handling to RuntimeTypeName; updates resolver ctor type-name selection.
src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/RootTypeFileBuilder.cs Uses SchemaTypeName.FullyQualifiedName instead of symbol-based formatting.
src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/ObjectTypeFileBuilder.cs Uses TypeNameInfo for runtime/schema type formatting in generated code.
src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/InterfaceTypeFileBuilder.cs Uses TypeNameInfo for runtime/schema type formatting in generated code.
src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/EdgeTypeFileBuilder.cs Uses TypeNameInfo and cached node type name when generating code.
src/HotChocolate/Core/src/Types.Analyzers/FileBuilders/ConnectionTypeFileBuilder.cs Uses TypeNameInfo and cached node type name when generating code.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

This comment was marked as resolved.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 50 to 56
if (syntaxInfo is IOutputTypeInfo { HasRuntimeType: true } typeInfo)
{
#if NET8_0_OR_GREATER
connectionTypeLookup[typeInfo.RuntimeTypeFullName] = typeInfo;
connectionTypeLookup[typeInfo.RuntimeTypeName.FullName] = typeInfo;
#else
connectionTypeLookup[typeInfo.RuntimeTypeFullName!] = typeInfo;
connectionTypeLookup[typeInfo.RuntimeTypeName!.FullName] = typeInfo;
#endif
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connectionTypeLookup is seeded with RuntimeTypeName.FullName, but later lookups/additions use keys prefixed with "global::" (e.g., connectionTypeName). This inconsistency means existing types won't be found and can lead to duplicate generated connection/edge types (potentially causing duplicate AddSource hint names / generator failures). Use a consistent key representation—likely RuntimeTypeName.FullyQualifiedName (and drop manual "global::" concatenation or keep it consistent everywhere).

Copilot uses AI. Check for mistakes.
Comment on lines +598 to +606
var resolverTypeName =
type.SchemaTypeName?.FullyQualifiedName
?? type.RuntimeTypeName?.FullyQualifiedName
?? throw new InvalidOperationException("Schema type and runtime type are null.");

WriteResolverConstructor(
type,
typeLookup,
resolverType.ToFullyQualified(),
resolverTypeName,
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolverTypeName is computed and passed into WriteResolverConstructor(...), but the resolverTypeName parameter is never used inside TypeFileBuilderBase (only referenced at the call site and in the signature). This adds noise and risks future divergence. Either remove the parameter entirely (and the computation), or use it inside the constructor generation logic if it’s intended to influence output.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

🚀 Fusion Gateway Performance Results

Simple Composite Query

Constant Load (50 VUs)

Requests/sec Error Rate
5785.39 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.87ms 7.15ms 161.96ms 8.49ms 13.27ms 18.81ms

Ramping Load (0→50→500→50 VUs)

Requests/sec Error Rate
4507.85 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.79ms 38.45ms 269.26ms 49.25ms 112.63ms 128.84ms

Executed Query

fragment User on User {
  id
  username
  name
}

fragment Review on Review {
  id
  body
}

fragment Product on Product {
  inStock
  name
  price
  shippingEstimate
  upc
  weight
}

query TestQuery {
  topProducts(first: 5) {
    ...Product
    reviews {
      ...Review
      author {
        ...User
      }
    }
  }
}

Deep Recursion Query

Constant Load (50 VUs)

Requests/sec Error Rate
270.49 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
12.77ms 173.95ms 657.37ms 179.30ms 225.34ms 249.91ms

Ramping Load (0→50→500→50 VUs)

Requests/sec Error Rate
307.84 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
3.05ms 678.72ms 1760.38ms 687.55ms 1373.51ms 1497.66ms

Executed Query

fragment User on User {
  id
  username
  name
}

fragment Review on Review {
  id
  body
}

fragment Product on Product {
  inStock
  name
  price
  shippingEstimate
  upc
  weight
}

query TestQuery {
  users {
    ...User
    reviews {
      ...Review
      product {
        ...Product
        reviews {
          ...Review
          author {
            ...User
            reviews {
              ...Review
              product {
                ...Product
              }
            }
          }
        }
      }
    }
  }
  topProducts(first: 5) {
    ...Product
    reviews {
      ...Review
      author {
        ...User
        reviews {
          ...Review
          product {
            ...Product
          }
        }
      }
    }
  }
}

Variable Batching Throughput

Constant Load (50 VUs)

Requests/sec Error Rate
23566.22 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.09ms 1.71ms 48.88ms 2.07ms 3.93ms 4.81ms

Ramping Load (0→50→500→50 VUs)

Requests/sec Error Rate
18811.81 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.09ms 9.18ms 134.56ms 11.27ms 23.24ms 28.18ms

Executed Query

query TestQuery_8f7a46ce_2(
  $__fusion_1_upc: ID!
  $__fusion_2_price: Long!
  $__fusion_2_weight: Long!
) {
  productByUpc(upc: $__fusion_1_upc) {
    inStock
    shippingEstimate(weight: $__fusion_2_weight, price: $__fusion_2_price)
  }
}

Variables (5 sets batched in single request)

[
  { "__fusion_1_upc": "1", "__fusion_2_price": 899, "__fusion_2_weight": 100 },
  { "__fusion_1_upc": "2", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 },
  { "__fusion_1_upc": "3", "__fusion_2_price": 15, "__fusion_2_weight": 20 },
  { "__fusion_1_upc": "4", "__fusion_2_price": 499, "__fusion_2_weight": 100 },
  { "__fusion_1_upc": "5", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 }
]

No baseline data available for comparison.


Run 21516271682 • Commit 87fc888 • Fri, 30 Jan 2026 13:15:01 GMT

@glen-84 glen-84 marked this pull request as draft February 6, 2026 09:58
@glen-84
Copy link
Member Author

glen-84 commented Feb 6, 2026

@michaelstaib

The 2 comments by Copilot seem valid, but these were existing issues before my changes.

Can you confirm:

  1. What keys the connectionTypeLookup should be using?
  2. Whether the resolverTypeName parameter can be removed.

(or just make the necessary changes in this PR)

@github-actions github-actions bot added the 📚 documentation This issue is about working on our documentation. label Mar 9, 2026
@michaelstaib michaelstaib marked this pull request as ready for review March 9, 2026 10:45
@michaelstaib michaelstaib added this to the HC-16.0.0 milestone Mar 9, 2026
@glen-84 glen-84 changed the title Removed Symbol references from IOutputTypeInfo and implementations Remove Symbol references from IOutputTypeInfo and implementations Mar 9, 2026
@michaelstaib michaelstaib merged commit d0686f1 into main Mar 10, 2026
8 checks passed
@michaelstaib michaelstaib deleted the gai/source-generator-refactoring branch March 10, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📚 documentation This issue is about working on our documentation. 🌶️ hot chocolate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants