Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds “semantic introspection” to HotChocolate by introducing new introspection fields for schema discovery and lookup, backed by a BM25-based in-memory search index and new introspection types/unions across Core and Fusion.
Changes:
- Introduce
__searchand__definitionsintrospection fields (gated viaEnableSemanticIntrospection) plus__SearchResultand__SchemaDefinition. - Add BM25 indexing/search implementation (
SchemaIndexer,BM25Index,BM25SearchProvider, tokenizer) and public abstractions (ISchemaSearchProvider, result/path types). - Wire feature into Core and Fusion schema building/execution and update tests/snapshots accordingly.
Reviewed changes
Copilot reviewed 55 out of 55 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| src/HotChocolate/Primitives/src/Primitives/Types/IntrospectionFieldNames.cs | Adds field-name constants/spans for __search and __definitions. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Text/Json/SourceResultElementBuilder.cs | Adds number-writing support (SetNumberValue) for JSON output. |
| src/HotChocolate/Fusion/src/Fusion.Execution/HotChocolate.Fusion.Execution.csproj | Links BM25 search source files into Fusion.Execution build. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/IntrospectionExecutionNode.cs | Enhances introspection selection execution to support abstract types (union/interface). |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Introspection/SearchResultData.cs | Adds Fusion runtime backing data for __SearchResult. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Introspection/SchemaCoordinateResolver.cs | Adds Fusion resolver for schema coordinates and union member type names. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Introspection/Query.cs | Adds Fusion resolvers for __search and __definitions (feature-gated). |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Introspection/MemHelper.cs | Adds float-number writing helper for introspection JSON output. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Introspection/__SearchResult.cs | Adds Fusion interceptor/resolvers for __SearchResult fields. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/FusionRequestExecutorManager.cs | Wires semantic introspection option into interceptor registration + DI service registration in Fusion. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/FusionOptions.cs | Adds EnableSemanticIntrospection to Fusion options + cloning support. |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/IFusionSchemaOptions.cs | Exposes EnableSemanticIntrospection on Fusion schema options interface. |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/FusionSchemaOptions.cs | Propagates EnableSemanticIntrospection into Fusion schema options copy. |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/Completion/SemanticIntrospectionSchema.cs | Adds schema SDL for __SearchResult and __SchemaDefinition (Fusion completion). |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/Completion/CompositeSchemaBuilder.cs | Adds semantic introspection types/fields to Fusion composite schema based on option. |
| src/HotChocolate/Core/test/Validation.Tests/IntrospectionRuleTests.cs | Pins semantic introspection off to keep existing validation test behavior stable. |
| src/HotChocolate/Core/test/Types.Tests/Types/Scalars/snapshots/Issue6970ReproTests.Schema_With_IDictionary_String_Object_Output_Field_Builds.snap | Snapshot updates due to added introspection/directive surface. |
| src/HotChocolate/Core/test/Types.Tests/Types/Introspection/Search/SchemaIndexerTests.cs | Adds tests for schema indexing and reverse map construction. |
| src/HotChocolate/Core/test/Types.Tests/Types/Introspection/Search/BM25TokenizerTests.cs | Adds tokenizer unit tests (splitting/normalization). |
| src/HotChocolate/Core/test/Types.Tests/Types/Introspection/Search/BM25SearchProviderTests.cs | Adds provider tests (search, pagination, scoring, paths, concurrency). |
| src/HotChocolate/Core/test/Types.Tests/Types/Introspection/Search/BM25IndexTests.cs | Adds BM25 index unit tests (build/search/ranking). |
| src/HotChocolate/Core/test/Types.Tests/Configuration/snapshots/TypeInitializerTests.Register_SchemaType_ClrTypeExists.snap | Snapshot updates for new query introspection fields. |
| src/HotChocolate/Core/test/Types.Tests/Configuration/snapshots/TypeInitializerTests.Register_ClrType_InferSchemaTypes.snap | Snapshot updates for new query introspection fields. |
| src/HotChocolate/Core/test/Types.Tests/Configuration/snapshots/TypeDiscovererTests.Register_SchemaType_ClrTypeExists.snap | Snapshot updates to include new introspection types/scalars. |
| src/HotChocolate/Core/test/Types.Tests/Configuration/snapshots/TypeDiscovererTests.Register_ClrType_InferSchemaTypes.snap | Snapshot updates to include new introspection types/scalars. |
| src/HotChocolate/Core/test/Types.Tests/snapshots/SchemaFirstTests.Interfaces_Impl_Interfaces_Are_Correctly_Exposed_Through_Introspection.snap | Snapshot updates to include new introspection types/unions/scalars. |
| src/HotChocolate/Core/test/Types.Tests/snapshots/SchemaFirstTests.DescriptionsAreCorrectlyRead.snap | Snapshot updates to include new introspection types/unions/scalars. |
| src/HotChocolate/Core/test/Types.Tests/snapshots/CodeFirstTests.Allow_PascalCasedArguments_Schema.graphql | Snapshot updates due to added directive/introspection surface. |
| src/HotChocolate/Core/test/Execution.Tests/SemanticIntrospectionTests.cs | Adds end-to-end execution tests for __search and __definitions. |
| src/HotChocolate/Core/test/Execution.Tests/Integration/StarWarsCodeFirst/snapshots/StarWarsCodeFirstTests.Ensure_Benchmark_Query_LargeQuery.snap | Snapshot updates to include new introspection types/unions/scalars. |
| src/HotChocolate/Core/test/Execution.Tests/snapshots/IntrospectionTests.ExecuteGraphiQLIntrospectionQuery.snap | Snapshot updates to include new introspection types/unions/scalars. |
| src/HotChocolate/Core/test/Execution.Tests/snapshots/IntrospectionTests.ExecuteGraphiQLIntrospectionQuery_ToJson.snap | Snapshot updates to include new introspection types/unions/scalars. |
| src/HotChocolate/Core/test/Execution.Tests/snapshots/IntrospectionTests.DirectiveIntrospection_SomeDirectives_Internal.snap | Snapshot updates due to introspection schema changes. |
| src/HotChocolate/Core/test/Execution.Tests/snapshots/IntrospectionTests.DirectiveIntrospection_AllDirectives_Public.snap | Snapshot updates due to introspection schema changes. |
| src/HotChocolate/Core/test/Execution.Tests/snapshots/IntrospectionTests.DirectiveIntrospection_AllDirectives_Internal.snap | Snapshot updates due to introspection schema changes. |
| src/HotChocolate/Core/test/Execution.Tests/snapshots/IntrospectionTests.DefaultValueIsInputObject.snap | Snapshot updates to include new introspection types/unions/scalars. |
| src/HotChocolate/Core/src/Validation/Rules/IntrospectionVisitor.cs | Expands “introspection not allowed” rule to cover any introspection field on Query (incl. new ones). |
| src/HotChocolate/Core/src/Types/Types/Introspection/SearchResultInfo.cs | Adds Core runtime backing data for __SearchResult. |
| src/HotChocolate/Core/src/Types/Types/Introspection/Search/SchemaIndexer.cs | Walks schema to create BM25 documents + reverse adjacency map. |
| src/HotChocolate/Core/src/Types/Types/Introspection/Search/BM25Tokenizer.cs | Implements tokenization (case/boundary splitting + normalization). |
| src/HotChocolate/Core/src/Types/Types/Introspection/Search/BM25SearchProvider.cs | Implements ISchemaSearchProvider using BM25 index + path-to-root BFS. |
| src/HotChocolate/Core/src/Types/Types/Introspection/Search/BM25Index.cs | Implements immutable BM25 inverted index and scoring search. |
| src/HotChocolate/Core/src/Types/Types/Introspection/Search/BM25Document.cs | Defines index document record (coordinate + text). |
| src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs | Adds __search/__definitions fields to Query when enabled. |
| src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionFields.cs | Adds descriptors/resolvers for the new semantic introspection fields. |
| src/HotChocolate/Core/src/Types/Types/Introspection/__SearchResult.cs | Adds Core introspection object type for search results. |
| src/HotChocolate/Core/src/Types/Types/Introspection/__SchemaDefinition.cs | Adds Core introspection union for schema definition results. |
| src/HotChocolate/Core/src/Types/SchemaOptions.cs | Adds EnableSemanticIntrospection option (defaults to true). |
| src/HotChocolate/Core/src/Types/SchemaBuilder.Setup.cs | Registers ISchemaSearchProvider in Core DI. |
| src/HotChocolate/Core/src/Types/IReadOnlySchemaOptions.cs | Exposes EnableSemanticIntrospection on schema options interface. |
| src/HotChocolate/Core/src/Types/Configuration/IntrospectionTypeReferences.cs | Ensures semantic introspection types/scalars are enqueued when enabled. |
| src/HotChocolate/Core/src/Types.Abstractions/SchemaSearchResult.cs | Adds public schema search result abstraction. |
| src/HotChocolate/Core/src/Types.Abstractions/SchemaCoordinatePath.cs | Adds public path abstraction for coordinate-to-root traversal. |
| src/HotChocolate/Core/src/Types.Abstractions/ISchemaSearchProvider.cs | Adds public provider interface for semantic schema search/path discovery. |
| .work/review/review.md | Adds a review-verdict markdown file (appears to be a local artifact). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Introspection/Query.cs
Outdated
Show resolved
Hide resolved
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Introspection/Query.cs
Outdated
Show resolved
Hide resolved
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Introspection/MemHelper.cs
Outdated
Show resolved
Hide resolved
src/HotChocolate/Core/src/Types/Types/Introspection/Search/BM25SearchProvider.cs
Outdated
Show resolved
Hide resolved
src/HotChocolate/Core/src/Types/Types/Introspection/Search/BM25SearchProvider.cs
Show resolved
Hide resolved
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Introspection/Query.cs
Outdated
Show resolved
Hide resolved
src/HotChocolate/Core/test/Execution.Tests/SemanticIntrospectionTests.cs
Outdated
Show resolved
Hide resolved
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.
No description provided.