Skip to content

Add IBM cost spec support to fusion - #10374

Open
michaelstaib wants to merge 458 commits into
mainfrom
mst/cost-v2
Open

michaelstaib wants to merge 458 commits into
mainfrom
mst/cost-v2

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

No description provided.

Copilot AI lite review requested due to automatic review settings September 8, 2026 19:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new Fusion planning/normalization pipeline introduces exception-based failure paths (and at least one misleading error message) that should be adjusted to improve diagnosability and avoid unnecessary 500-style failures in misconfigured pipelines.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR introduces IBM GraphQL cost-spec support throughout Fusion (composition + execution), adds a new shared CostAnalysis.Core engine layer, and updates pipelines/tests/snapshots to account for upcoming cost enforcement defaults (notably the default list-size behavior).

Changes:

  • Add document normalization and normalized-operation plumbing in Fusion execution so planning/coercion/cost analysis can reuse a rewritten/defragmentized document.
  • Introduce CostAnalysis.Core (snapshot/plan/algebra scaffolding, conformance fixtures) and wire it into Fusion and HotChocolate cost analysis.
  • Update directive folding/compatibility logic for @cost and @listSize, and refresh affected test harnesses/snapshots (including pinning DefaultListSize in many tests).
File summaries
File Description
src/HotChocolate/Raven/test/Data.Raven.Tests/FluentApiTests.cs Pin DefaultListSize for upcoming enforcement.
src/HotChocolate/Raven/test/Data.Raven.Tests/DataExtensionsTests.cs Pin DefaultListSize for upcoming enforcement.
src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/ProjectionVisitorTestBase.cs Pin DefaultListSize in test schema builder.
src/HotChocolate/Raven/test/Data.Raven.Paging.Tests/VisitorTestBase.cs Pin DefaultListSize in paging tests.
src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/FilterVisitorTestBase.cs Pin DefaultListSize in filter tests.
src/HotChocolate/Language/src/Language.Web/CachedDocument.cs Add cached normalized document storage.
src/HotChocolate/Fusion/test/Fusion.Composition.Tests/SourceSchemaMerger.ListSizeDirective.Tests.cs Add listSize folding test coverage.
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/HotChocolate.Fusion.AspNetCore.Tests.csproj Link shared article fixtures into Fusion tests.
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/FusionTestBase.MatchSnapshot.cs Add snapshot helper overload with postfix.
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/FusionTestBase.cs Pin DefaultListSize for composed test schemas.
src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/DefaultSecurityTests.cs Add (skipped) cost enforcement security tests.
src/HotChocolate/Fusion/src/Fusion.Execution/HotChocolate.Fusion.Execution.csproj Reference CostAnalysis.Core; suppress experimental warning.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Pipeline/OperationVariableCoercionMiddleware.cs Use normalized operation; skip coercion for validate-cost w/o vars.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Pipeline/OperationPlanMiddleware.cs Plan from normalized operation (normalization moved earlier).
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Pipeline/FusionMiddleware.cs Expose DocumentNormalization middleware config.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Pipeline/DocumentNormalizationMiddleware.cs New middleware: rewrite/defragmentize and cache normalized document.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/FusionRequestOptions.cs Add FusionRequestOptions.Cost and clone/readonly behavior.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/FusionOperationInfo.cs Store normalized document/operation in request features.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Extensions/FusionRequestContextExtensions.cs Add normalized document/operation context extensions.
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/ErrorHelper.cs Update error message for variable coercion precondition.
src/HotChocolate/Fusion/src/Fusion.Execution/DependencyInjection/CoreFusionGatewayBuilderExtensions.Pipeline.cs Add UseDocumentNormalization and reorder default pipelines.
src/HotChocolate/Fusion/src/Fusion.Execution/DependencyInjection/CoreFusionGatewayBuilderExtensions.Options.cs Add ModifyCostOptions for Fusion gateway builder.
src/HotChocolate/Fusion/src/Fusion.Diagnostics/Listeners/FusionActivityExecutionDiagnosticEventListener.cs Support spans when only normalized operation is available.
src/HotChocolate/Fusion/src/Fusion.Composition/DirectiveMergers/ListSizeDirectiveFold.cs New listSize fold rules helper.
src/HotChocolate/Fusion/src/Fusion.Composition/DirectiveMergers/CostDirectiveMerger.cs Remove old cost directive merger implementation.
src/HotChocolate/Fusion/src/Fusion.Composition/DirectiveMergers/CostDirectiveFold.cs New cost fold + default-weight helpers.
src/HotChocolate/Fusion/src/Fusion.Composition/DirectiveDefinitionCompatibility.cs Allow canonical-arg superset compatibility checks.
src/HotChocolate/Fusion/src/Fusion.AspNetCore/DependencyInjection/FusionServerServiceCollectionExtensions.cs Disable cost enforcement when default security is disabled.
src/HotChocolate/Fusion/HotChocolate.Fusion.slnx Add CostAnalysis.Core project to Fusion solution.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ActivityServerDiagnosticListenerTests.cs Pin DefaultListSize in diagnostics server tests.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.RequestDetails_None_ExcludesAllDetails_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.RequestDetails_DocumentOnly_IncludesDocumentTag_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.RequestDetails_Default_IncludesIdHashOperationNameExtensions_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.RequestDetails_All_IncludesAllDetails_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Subscription_Should_Be_Unset_When_Client_Disconnects_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Subscription_Should_Be_Unset_When_Client_Disconnects_During_Event_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Subscription_Should_Be_Ok_When_Server_Completes_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Subscription_Event_Should_Be_Error_When_Timeout_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Request_Should_Be_Unset_When_Client_Disconnects_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Request_Should_Be_Error_When_Timeout_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_With_Extensions_Map_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_Variables_Are_Not_Automatically_Added_To_Activities_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_SingleRequest_GetHeroName_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_Ensure_List_Path_Is_Correctly_Built_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_Capture_Deferred_Response_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Post_Add_Variables_To_Http_Activity_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityServerDiagnosticListenerTests.Http_Get_SingleRequest_GetHeroName_NET11_0.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Diagnostics/test/Diagnostics.Tests/snapshots/ActivityExecutionDiagnosticListenerTests.ComplexityAnalysis_Enabled_RecordsCostInSpan.snap Snapshot updates for span ordering/tags.
src/HotChocolate/Data/test/Data.Tests/ProjectableDataLoaderTests.cs Pin DefaultListSize in data tests.
src/HotChocolate/Data/test/Data.Tests/Issue5893Tests.cs Pin DefaultListSize in repro test.
src/HotChocolate/Data/test/Data.Sorting.InMemory.Tests/QueryableSortVisitorVariablesTests.cs Pin DefaultListSize in sorting tests.
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/Issue8252UnionProjectionTests.cs Pin DefaultListSize in PostgreSQL tests.
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/IntegrationTests.cs Pin DefaultListSize in PostgreSQL integration.
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/IgnoredObjectFieldIntegrationTests.cs Pin DefaultListSize in PostgreSQL integration.
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/DateTimeOffsetSortingTests.cs Pin DefaultListSize in PostgreSQL sorting.
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/DataLoaderTests.cs Pin DefaultListSize in PostgreSQL dataloader tests.
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/ComputedExpressionProjectionTests.cs Pin DefaultListSize in PostgreSQL projection tests.
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/AsSelectorRecordProjectionTests.cs Pin DefaultListSize in PostgreSQL projection tests.
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/AsSelectorEncapsulatedProjectionTests.cs Pin DefaultListSize in PostgreSQL projection tests.
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/ArrayLengthProjectionTests.cs Pin DefaultListSize in PostgreSQL projection tests.
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/ArrayLengthFilterTests.cs Pin DefaultListSize in PostgreSQL filter tests.
src/HotChocolate/Data/test/Data.PostgreSQL.Tests/snapshots/IntegrationTests.CreateSchema.graphql Snapshot updates for cost directives on list-of-leaf fields.
src/HotChocolate/Data/test/Data.NodaTime.Tests/IntegrationTests.cs Pin DefaultListSize in NodaTime tests.
src/HotChocolate/CostAnalysis/tools/oracle/oracle.patch Patch for external oracle repo wiring.
src/HotChocolate/CostAnalysis/tools/oracle/LICENSE-graphql-static-analysis-rs.md Add oracle license/provenance notice.
src/HotChocolate/CostAnalysis/tools/oracle/clone-oracle.sh Script to clone/apply oracle patch.
src/HotChocolate/CostAnalysis/tools/AotSmoke/Program.cs Add AOT smoke program for core parsing/snapshot path.
src/HotChocolate/CostAnalysis/tools/AotSmoke/AotSmoke.csproj Add AOT smoke project.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/SpecificationExampleTests.cs Pin DefaultListSize in spec example tests.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/SchemaIntegrationTests.cs Adjust tests for default cost weights and list-of-leaf behavior.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/ResponseSizeTests.cs Add response-size behavior tests (currently skipped).
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/OptionsTests.cs Add defaults + obsolete-member tests for options.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/ListSizeDirectiveTypeTests.cs Add parsing-default tests for listSize directive.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/InfinityReportingTests.cs Add Infinity reporting tests (currently skipped).
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/HotChocolate.CostAnalysis.Tests.csproj Link shared fixtures into HC cost tests.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/CostSyntaxRewriterTests.cs Update rewriter tests for new defaults.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/StaticQueryAnalysisTests.Execute_ListQuery_ReturnsExpectedResult_6.md Snapshot updates for requireOneSlicingArgument.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/StaticQueryAnalysisTests.Execute_ListQuery_ReturnsExpectedResult_5.md Snapshot updates for requireOneSlicingArgument.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/StaticQueryAnalysisTests.Execute_ListQuery_ReturnsExpectedResult_4.md Snapshot updates for requireOneSlicingArgument.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/StaticQueryAnalysisTests.Execute_ListQuery_ReturnsExpectedResult_3.md Snapshot updates for requireOneSlicingArgument.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/StaticQueryAnalysisTests.Execute_ListQuery_ReturnsExpectedResult_10.md Add new snapshot case for slicing-argument requirement error.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/SlicingArgumentsTests.SlicingArgumentDefaultValue_ListSizeAttribute_HasPrecedenceOver_DefaultPageSize.graphql Snapshot updates for explicit list-of-leaf cost directive.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/SlicingArgumentsTests.SlicingArgumentDefaultValue_Inferred_From_DefaultPageSize.graphql Snapshot updates for explicit list-of-leaf cost directive.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/SchemaIntegrationTests.Rewrite_NonDefaultWeights_DoesNotRemoveCostDirectives.graphql Snapshot updates for default-weight behavior.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/SchemaIntegrationTests.Rewrite_DefaultWeights_RemovesCostDirectives.graphql Snapshot updates for default-weight behavior.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/PagingTests.Filtering_Variable.md Snapshot update for revised variable-cost behavior.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/CostSyntaxRewriterTests.Rewrite_NonDefaultWeights_DoesNotRemoveCostDirectives.graphql Snapshot updates for default-weight behavior.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/CostSyntaxRewriterTests.Rewrite_DefaultWeights_RemovesCostDirectives.graphql Snapshot updates for default-weight behavior.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Tests/Traversal/TraversalTestHelpers.cs Add traversal test helpers for new core backend.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Tests/Traversal/TestCostAlgebra.cs Add minimal algebra test double.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Tests/HotChocolate.CostAnalysis.Core.Tests.csproj Add CostAnalysis.Core test project.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Tests/CostEngineOptionsTests.cs Add defaults tests for core engine options.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Tests/ContractTests.cs Verify NotImplemented shells for core public contract.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Tests/Conditions/ConditionTreeTestHelpers.cs Add condition-tree test helpers.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/README.md Document new fixture-driven conformance suite.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/HotChocolate.CostAnalysis.Core.Conformance.Tests.csproj Add conformance test project and resources copy.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/FixtureWellFormednessTests.cs Add fixture well-formedness checks.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/FixtureLoader.cs Add fixture discovery logic.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/Fixture.cs Add fixture model/deserialization.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/resources/rust-corpus/manifest.json Add rust-corpus manifest metadata.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/resources/NOTICE.md Add provenance/notice for vendored fixtures.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/resources/fixture.schema.json Add JSON schema for conformance fixtures.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/resources/article/c6-zero-length-list.json Add article fixture.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/resources/article/c5-signed-weights.json Add article fixture.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/resources/article/c5-signed-weights-merged-control.json Add article fixture (merged control).
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/resources/article/c4-duplicate-response-name.json Add article fixture.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/resources/article/c4-duplicate-response-name-fragments.json Add article fixture (fragment spelling).
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/resources/article/c3-complementary-include-skip.json Add article fixture.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/resources/article/c2-list-size-variable.json Add article fixture.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/resources/article/c1-exclusive-types.json Add article fixture.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Core.Conformance.Tests/resources/article/c1-exclusive-types-fragments.json Add article fixture (fragment spelling).
src/HotChocolate/CostAnalysis/src/CostAnalysis/Types/ListSizeDirectiveType.cs Fix listSize parsing default for requireOneSlicingArgument.
src/HotChocolate/CostAnalysis/src/CostAnalysis/Options/SortCostOptions.cs Obsolete variable multiplier (error).
src/HotChocolate/CostAnalysis/src/CostAnalysis/Options/FilterCostOptions.cs Obsolete variable multiplier (error).
src/HotChocolate/CostAnalysis/src/CostAnalysis/Options/CostOptions.cs Add DefaultListSize/plan-cache/response-size/case-budget options.
src/HotChocolate/CostAnalysis/src/CostAnalysis/HotChocolate.CostAnalysis.csproj Add NoWarn + reference CostAnalysis.Core; adjust internals visibility.
src/HotChocolate/CostAnalysis/src/CostAnalysis/DependencyInjection/CostAnalyzerRequestExecutorBuilderExtensions.cs Wire RequestCostOptions + pipeline ordering after coercion.
src/HotChocolate/CostAnalysis/src/CostAnalysis/CostTypeInterceptor.cs Fix argument-cost directive application; add explicit list-of-leaf cost.
src/HotChocolate/CostAnalysis/src/CostAnalysis/CostSyntaxRewriter.cs Align directive removal with IBM default weights (incl. lists).
src/HotChocolate/CostAnalysis/src/CostAnalysis/CostAnalyzerMiddleware.cs Prefer original parsed operation for locationful errors.
src/HotChocolate/CostAnalysis/src/CostAnalysis/CostAnalyzer.cs Switch to legacy multiplier field name.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Traversal/TypeRegionPartitioner.cs Add type-region partitioning for exact-case traversal.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Traversal/TraversalMembers.cs Add member-builder for collected field groups.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Traversal/FieldGroupMerger.cs Add response-name group merge helpers.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Traversal/CaseBudget.cs Add compile-time case-budget tracker.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/ThrowHelper.cs Add core throw helper and formatted exceptions.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Snapshot/ListSizeMetadata.cs Add listSize metadata model.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Snapshot/CostMetadataKeys.cs Add key types for snapshot indices.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Properties/CostAnalysisCoreResources.Designer.cs Add generated resource accessor.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/ICostVariableValues.cs Add variable-value lookup abstraction for plan evaluation.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/HotChocolate.CostAnalysis.Core.csproj Add CostAnalysis.Core package/project definition.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Decisions/BooleanAssignment.cs Add boolean assignment structure for decision evaluation.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/CostPlanCompiler.cs Add plan compiler shell (NotImplemented).
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/CostPlan.cs Add plan shell API (NotImplemented).
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/CostExperiments.cs Add experimental diagnostic id for algebra API.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/CostEstimate.cs Add estimate value type.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/CostEngineOptions.cs Add engine options (DefaultListSize, CaseBudget).
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/CostAnalysisResult.cs Add request-context result container type.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/CostAnalyses.cs Add analysis flags (Cost, ResponseSize).
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Conditions/FieldGroup.cs Add response-name group model.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Conditions/ConditionTree.cs Add condition tree model.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Conditions/Condition.cs Add cumulative condition model with canonical boolean literals.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Conditions/BranchCondition.cs Add branch condition model (type or boolean).
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Conditions/Branch.cs Add branch edge model.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Conditions/BooleanLiteral.cs Add boolean literal model.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Algebra/ResponseSizeAlgebra.cs Add response-size algebra shell (NotImplemented).
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Algebra/IAnalysisAlgebra.cs Add experimental algebra interface.
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Algebra/CostAlgebra.cs Add cost algebra shell (NotImplemented).
src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Algebra/CollectedFieldGroup.cs Add collected field group + member types.
src/HotChocolate/CostAnalysis/HotChocolate.CostAnalysis.slnx Add core + tests to CostAnalysis solution.
src/HotChocolate/Core/test/Types.Tests/Types/Scalars/AnyTypeTests.cs Snapshot updates for list-of-leaf cost directive + cost directive SDL.
src/HotChocolate/Core/test/Types.Tests/Types/Relay/snapshots/IdAttributeTests.Id_Type_Is_Correctly_Inferred.snap Snapshot updates for list-of-leaf cost directive + cost directive SDL.
src/HotChocolate/Core/test/Types.Tests/Configuration/FactoryTypeReferenceTests.cs Pin DefaultListSize in types tests.
src/HotChocolate/Core/test/Types.Mutations.Tests/AnnotationBasedMutations.cs Pin DefaultListSize in mutations tests.
src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/snapshots/IntegrationTests.Schema_Snapshot.snap Snapshot updates for list-of-leaf cost directives.
src/HotChocolate/Core/test/Execution.Tests/WarmupRequestTests.cs Add test for validate-cost request skipping coercion.
src/HotChocolate/Core/test/Authorization.Tests/AnnotationBasedAuthorizationTests.cs Pin DefaultListSize in auth tests.
src/HotChocolate/Core/src/Types/Execution/Pipeline/Pipelines.md Update pipeline docs for cost analysis stage position.
src/HotChocolate/Core/src/Types/Execution/Pipeline/OperationVariableCoercionMiddleware.cs Skip coercion for validate-cost requests without variables.
src/HotChocolate/Core/src/Types/Execution/DependencyInjection/RequestExecutorBuilderExtensions.UseRequest.cs Reorder SkipWarmup vs coercion in default pipelines.
src/HotChocolate/Core/src/Execution.Abstractions/WellKnownRequestMiddleware.cs Add DocumentNormalizationMiddleware key.
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/snapshots/HttpGetSemanticNonNullSchemaMiddlewareTests.Download_GraphQL_SemanticNonNull_Schema.md Snapshot updates for list-of-leaf cost directive.
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/snapshots/HttpGetSemanticNonNullSchemaMiddlewareTests.Download_GraphQL_SemanticNonNull_Schema_Explicit_Pattern.snap Snapshot updates for list-of-leaf cost directive.
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/snapshots/HttpGetSchemaMiddlewareTests.Download_GraphQL_SDL.snap Snapshot updates for list-of-leaf cost directive.
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/snapshots/HttpGetSchemaMiddlewareTests.Download_GraphQL_SDL_Explicit_Route.snap Snapshot updates for list-of-leaf cost directive.
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/snapshots/HttpGetSchemaMiddlewareTests.Download_GraphQL_SDL_Explicit_Route_Explicit_Pattern.snap Snapshot updates for list-of-leaf cost directive.
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/snapshots/HttpGetSchemaMiddlewareTests.Download_GraphQL_Schema.md Snapshot updates for list-of-leaf cost directive.
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/snapshots/HttpGetSchemaMiddlewareTests.Download_GraphQL_Schema_Slicing_Args_Enabled.md Snapshot updates for list-of-leaf cost directive.
src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/ServerTestBase.cs Pin DefaultListSize in test server setup.
src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/OpenApiTestBase.cs Pin DefaultListSize in OpenAPI adapter tests.
src/Build.Pack.slnx Include CostAnalysis.Core in pack build solution.
src/All.slnx Include new CostAnalysis projects/tools in full solution.
.gitignore Ignore oracle checkout directory.
Review details

Files not reviewed (1)

  • src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Properties/CostAnalysisCoreResources.Designer.cs: Generated file
  • Files reviewed: 219/222 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot added 🧰 maintenance 📚 documentation This issue is about working on our documentation. 🌶️ strawberry shake labels Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Patch coverage

95.5% of changed lines covered (5483/5740)

File Covered Changed Patch %
src/HotChocolate/Core/src/Types/Execution/ThrowHelper.cs 0 1 0.0% 🔴
…/CostAnalysis/src/CostAnalysis.Core/Index/ArgumentKey.cs 0 1 0.0% 🔴
…/src/CostAnalysis.Core/Index/DirectiveArgumentDefinition.cs 0 1 0.0% 🔴
…/CostAnalysis/src/CostAnalysis.Core/Index/FieldKey.cs 0 1 0.0% 🔴
…/Execution/Pipeline/OperationExecutionMiddleware.cs 4 15 26.7% 🔴
…/src/Execution.Abstractions/Execution/Pipeline/ThrowHelper.cs 1 3 33.3% 🔴
…/Fusion/src/Fusion.Diagnostics/Spans/ExecuteRequestSpan.cs 2 6 33.3% 🔴
…/Pipeline/DocumentNodeOperationDefinitionExtensions.cs 14 24 58.3% 🔴
…/CostAnalysis/src/CostAnalysis/Utilities/ResultHelper.cs 37 58 63.8% 🔴
…/src/CostAnalysis.Core/Conditions/BooleanLiteral.cs 2 3 66.7% 🔴
…/Execution/Caching/NormalizedDocumentCache.cs 4 6 66.7% 🔴
…/SourceSchemaValidationRules/CostDirectiveDefinitionRule.cs 36 49 73.5% 🔴
…/CostAnalysis/src/CostAnalysis.Core/PerRequestCostAlgebra.cs 29 39 74.4% 🔴
…/CostAnalysis/src/CostAnalysis/Options/RequestCostOptions.cs 34 43 79.1% 🔴
…/Fusion/src/Fusion.Composition/Options/ThrowHelper.cs 4 5 80.0% 🟡
…/Pipeline/RequestContextNormalizedDocumentExtensions.cs 17 21 81.0% 🟡
…/src/CostAnalysis.Core/Conditions/BranchCondition.cs 9 11 81.8% 🟡
…/Diagnostics/Listeners/ActivityExecutionDiagnosticListener.cs 42 50 84.0% 🟡
…/CostAnalysis/src/CostAnalysis.Core/ThrowHelper.cs 16 19 84.2% 🟡
…/Listeners/FusionActivityExecutionDiagnosticEventListener.cs 32 36 88.9% 🟡

+123 more changed files; see the JSON below for uncovered lines.

Uncovered changed lines (JSON)
{
  "sha": "7e6cd09549479dffd66f00bb93a9b4d2c04d7957",
  "files": [
    { "path": "src/HotChocolate/Core/src/Types/Execution/ThrowHelper.cs", "ranges": [[13, 13]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Index/ArgumentKey.cs", "ranges": [[6, 6]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Index/DirectiveArgumentDefinition.cs", "ranges": [[6, 6]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Index/FieldKey.cs", "ranges": [[7, 7]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Pipeline/OperationExecutionMiddleware.cs", "ranges": [[83, 91], [93, 94]] },
    { "path": "src/HotChocolate/Core/src/Execution.Abstractions/Execution/Pipeline/ThrowHelper.cs", "ranges": [[6, 6], [12, 12]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Diagnostics/Spans/ExecuteRequestSpan.cs", "ranges": [[56, 59]] },
    { "path": "src/HotChocolate/Core/src/Execution.Abstractions/Execution/Pipeline/DocumentNodeOperationDefinitionExtensions.cs", "ranges": [[46, 47], [55, 57], [64, 67], [69, 69]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis/Utilities/ResultHelper.cs", "ranges": [[49, 50], [81, 81], [87, 89], [92, 93], [96, 97], [100, 100], [102, 102], [104, 104], [116, 117], [126, 126], [131, 131], [143, 144], [147, 147], [154, 154]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Conditions/BooleanLiteral.cs", "ranges": [[12, 12]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Caching/NormalizedDocumentCache.cs", "ranges": [[19, 19], [24, 24]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Composition/SourceSchemaValidationRules/CostDirectiveDefinitionRule.cs", "ranges": [[58, 60], [65, 69], [72, 76]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/PerRequestCostAlgebra.cs", "ranges": [[45, 50], [59, 59], [74, 76]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis/Options/RequestCostOptions.cs", "ranges": [[221, 222], [285, 291]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Composition/Options/ThrowHelper.cs", "ranges": [[12, 12]] },
    { "path": "src/HotChocolate/Core/src/Execution.Abstractions/Execution/Pipeline/RequestContextNormalizedDocumentExtensions.cs", "ranges": [[33, 34], [43, 44]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Conditions/BranchCondition.cs", "ranges": [[42, 42], [45, 45]] },
    { "path": "src/HotChocolate/Diagnostics/src/Diagnostics/Listeners/ActivityExecutionDiagnosticListener.cs", "ranges": [[28, 28], [97, 97], [216, 221]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/ThrowHelper.cs", "ranges": [[10, 10], [34, 34], [45, 45]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Diagnostics/Listeners/FusionActivityExecutionDiagnosticEventListener.cs", "ranges": [[190, 193]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/CostAnalysis/CostResultHelper.cs", "ranges": [[40, 41], [52, 52], [67, 67], [85, 86], [98, 99], [102, 102]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Pipeline/OperationPlanInFlightRelease.cs", "ranges": [[41, 42]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Algebra/CollectedFieldGroup.cs", "ranges": [[43, 43]] },
    { "path": "src/HotChocolate/Core/src/Types/Execution/DependencyInjection/RequestExecutorBuilderExtensions.UseRequest.cs", "ranges": [[553, 553]] },
    { "path": "src/HotChocolate/Core/src/Types/Execution/Pipeline/PipelineTools.cs", "ranges": [[69, 71]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis/CostAnalyzerMiddleware.cs", "ranges": [[30, 30], [46, 46], [215, 220], [247, 247], [261, 265]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Index/FieldSemanticIdentityComparer.cs", "ranges": [[17, 18], [31, 32], [124, 125], [131, 132]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Pipeline/OperationPlanCacheMiddleware.cs", "ranges": [[105, 107], [130, 130]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Conditions/ConditionTreeNode.cs", "ranges": [[57, 58], [70, 71]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/CostPlanCompiler.cs", "ranges": [[45, 46], [90, 90]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Plan/PlanNode.cs", "ranges": [[23, 24]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Extraction/ConditionTreeBuilder.cs", "ranges": [[76, 76], [80, 80], [108, 109], [215, 215], [270, 272], [278, 280], [362, 362], [406, 407], [451, 453], [506, 507]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Plan/PlanAlgebra.cs", "ranges": [[37, 37], [142, 144], [197, 197], [201, 204]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis/Utilities/ErrorHelper.cs", "ranges": [[17, 18]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Analyses/ListSizeResolver.cs", "ranges": [[157, 159], [249, 251]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Decisions/BooleanDecision.cs", "ranges": [[45, 45], [58, 59], [150, 150]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Analyses/ResponseSizeAlgebra.cs", "ranges": [[58, 59]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Traversal/CaseBudgetFallback.cs", "ranges": [[108, 109], [154, 155], [247, 248]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Index/CostSchemaIndexBuilder.cs", "ranges": [[23, 26], [330, 330], [443, 444], [465, 466], [474, 475]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/CostPlan.cs", "ranges": [[79, 79], [178, 178]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Traversal/ExactCasesTraversal.cs", "ranges": [[138, 139], [519, 521], [624, 626], [854, 855], [919, 920], [1023, 1024], [1159, 1160], [1203, 1204], [1220, 1223], [1240, 1241], [1247, 1248]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis/Utilities/CostAnalyzerUtilities.cs", "ranges": [[284, 286], [288, 288]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Conditions/Condition.cs", "ranges": [[36, 36]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Index/PossibleTypeSet.cs", "ranges": [[75, 75]] },
    { "path": "src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/Plan/FieldPlanNode.cs", "ranges": [[31, 32]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Pipeline/CostAnalysisMiddleware.cs", "ranges": [[227, 227]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Composition/SourceSchemaMerger.cs", "ranges": [[1371, 1371]] }
  ]
}

Project coverage: 58.5% (296154/505846 lines)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

One or more issues must be addressed before approval.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (1)

src/HotChocolate/CostAnalysis/src/CostAnalysis/Options/CostOptions.cs:95

  • The new response-size limit accepts double.NaN, but enforcement only checks responseSize > maxResponseSize; that comparison is always false for NaN, silently disabling the limit even though the documentation says only null disables it. Validate this option as a non-negative finite value (or explicitly define a different unlimited sentinel).
  • Files reviewed: 226/509 changed files
  • Comments generated: 6
  • Review effort level: Lite

Comment thread src/HotChocolate/CostAnalysis/src/CostAnalysis.Core/CostEngineOptions.cs Outdated
Comment thread src/HotChocolate/Fusion/src/Fusion.Execution/Execution/FusionCostOptions.cs Outdated
Move ConstantPlanNode, BinaryPlanNode, RootPlanNode, ConditionPlanNode,
FieldPlanNode and PlanArithmetic out of PlanNode.cs into their own files.
Pure move, no behavior change.
Move LeafDecision, SplitDecision and JoinDecision out of
BooleanDecision.cs into their own files. Pure move, no behavior change.
Move IInheritedSizePlanAlgebra<T> and ILeafFieldBatchAlgebra<T> out of
PlanAlgebra.cs into their own files. Pure move, no behavior change.
Move FieldKey, ArgumentKey, FieldSemanticIdentity,
FieldSemanticIdentityComparer, InputValueMetadata and
DirectiveArgumentDefinition into their own files. CostMetadataKeys.cs is
removed since no type of that name exists. Pure move, no behavior change.
One type per file: split the record struct into its own file.
…r.cs

One type per file: split the record struct into its own file.
…hemaMerger.cs

One type per file: split the branch-added enum into its own file.
Per user ruling: no reference to the article anywhere in the codebase.
…ision

Renames __resources__/article to __resources__/precision, updates the
fixture.schema.json source enum and every fixture's source field, renames
ConformanceTests' ArticleFixtures/Article_ theory to PrecisionFixtures/
Precision_, and strips provenance wording (schema RECONSTRUCTED/VERBATIM,
verbatim from the article) from the fixture notes, README.md and the
rust-unit README while keeping the MIT crate attribution intact.
…reorder

The 3405874 coercion-reorder span-order fix updated only the
_NET11_0 baselines; the shared net8.0-net10.0 baselines were left
stale, causing 18 of 63 Diagnostics.Tests to fail on lower TFMs.
Follows the article -> precision fixture family rename: updates the
class, member and record names, the __resources__/precision path, the
csproj Link entries and comment, DocumentShapeParityTests' fixture path,
and renames the 9 associated snapshot files.
Follows the article -> precision fixture family rename: updates the
class, record and constant names, the __resources__/precision path, the
csproj Link entries and comment, DocumentShapeParityTests' fixture path,
and renames the 9 associated snapshot files.
372e356 added the _NET11_0 baseline for
AnalyzeComplexity_Should_RecordCostTags_When_ScopeIsEnabled without a
shared net8.0-net10.0 twin, causing lower TFMs to self-baseline
locally on every run instead of verifying against a committed
baseline.
…mment

CostFieldRule's XML doc becomes contract-only (reference implementation,
no lean model mention); CostAlgebraTests' c6-zero-length-list comment now
says precision fixture instead of article fixture.
… the new stage order

PipelineOrderTests now expects coercion and cost analysis ahead of the
operation cache and compiler on all three default pipelines.
OperationDocumentNormalizerCallCountTests asserts the new hot path directly:
a fully cached request still reaches the normalizer, from coercion, but
rewrites and compiles zero times. OperationIdAccessorTests moves its probes
to match where each stage now sits, and its shared RewriteCountingNormalizer
test helper uses the self-computing operation id accessor instead of the
non-computing one, since coercion can now reach it before the operation
cache stage has run.
Cost analysis now runs ahead of the operation cache, so it can no longer
assume some earlier stage already computed and stored the operation id: the
operation cache middleware guaranteed that in the old order, but the cost
analyzer sits before it now. The middleware self-computes the id instead,
the same way the operation cache and the normalizer already do.
…order

CostAnalysisPipelineOrderTests now proves the point of the reorder: a
cost-rejected request is never compiled and never enters the operation
cache, whether alone or as a burst of identical concurrent requests, since
cost enforcement now runs, and rejects, before the operation cache's
single-flight coalescing ever starts.

CostAnalyzerNormalizerCallCountTests reflects that variable coercion now
normalizes every request unconditionally, ahead of the cost analyzer; what
still must never happen is a second normalization within the same request,
which the cost analyzer avoids by reusing the document coercion already
normalized instead of normalizing it again on a cost plan cache miss.
Coercion and cost analysis spans now precede the operation-planning span
again, matching the reordered pipeline, on both the generic and net11.0
baseline families. A rejected coercion no longer shows AddedOperationToCache,
since the operation is never compiled or cached once cost analysis and
coercion run ahead of the operation cache.
Rewrite the 16.6-to-16.7 migration guide's custom-pipeline section, the cost
analysis page's pipeline placement paragraph, and the Pipelines.md mermaid
diagrams for the final order: DocumentValidation, OperationVariableCoercion,
CostAnalyzer, OperationCache, OperationCompiler, SkipWarmupExecution. Also
notes that the coercion middleware can no longer read the compiled operation,
since it now runs ahead of the operation cache and the compiler.
…usion (coercion, cost, cache, compiler); rejected operations are never compiled; IFeatureProvider restored on Compile
…ective

The normalizer now appends an internal hc__hasIncrementalParts directive to
the operation definition when the rewriter reports HasIncrementalParts,
before caching the normalized document, so a cache hit already carries it.
The static uncached entry point used by the OperationCompiler convenience
overloads applies the same marker. The directive name is a const defined
and read only inside HotChocolate.Types, next to the other well-known
directive names.
hasIncrementalParts is now derived from the presence of the marker
directive on the operation definition instead of re-walking the whole
normalized selection set on every compile. ContainsIncrementalDirectives
and HasIncrementalDirective are removed; the instance Compile signature
is unchanged.
…form

The NormalizedDocument XML doc now says the document is the executor's
internal form after validation, may carry internal marker directives, and
is not meant to be forwarded to another server.
An operation with a defer selection compiles the same cost plan whether or
not its operation definition carries the internal incremental-parts marker
directive.
Defer and stream compile snapshots now show the appended
hc__hasIncrementalParts directive on the operation definition; only that
directive differs from the previous snapshots.

Defer_If_False_Not_Deferred is renamed to
Defer_If_False_Reports_Incremental_Parts_Accepted_Edge_Case and its
assertion flips to true: a literal if: false on defer still counts as
incremental, an accepted edge case. Likewise
Stream_With_Statically_True_Skip_Does_Not_Report_Incremental_Parts is
renamed to ..._Reports_Incremental_Parts_Accepted_Edge_Case and flips to
true, since the rewriter marks a field's stream directive before its own
static skip is evaluated.

Compile_PreNormalized_Document_Reports_Incremental_Parts_Correctly is
rewritten to demonstrate that the instance Compile overload trusts the
marker directive on the document it is given rather than re-deriving it
from the selection set.
The marker directive is present on the normalized operation for a defer
selection, absent for an operation without defer or stream, and identical
(the same document instance) on a normalized-document cache hit.
…s; the compiler reads the marker instead of re-walking the selection set

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The PR introduces broad, cross-cutting execution/composition/diagnostics changes plus new projects and CI behavior, and the remaining pipeline-state handling questions warrant final human review.

Review effort: Lite
Findings: 2 Medium severity · 2 Low severity

Open (4)

Comment on lines 25 to +33

return TryCoerceVariables(
context,
operationExecutionPlan.VariableDefinitions,
operation.VariableDefinitions,
Comment thread .github/workflows/ci.yml
Comment on lines +307 to +308
- name: Build Cost Analysis Benchmarks
run: dotnet build src/HotChocolate/CostAnalysis/benchmarks/CostAnalysis.Core.Benchmarks/HotChocolate.CostAnalysis.Core.Benchmarks.csproj --framework net11.0 --verbosity q
Mirrors PipelineTools.CreateCacheId: stackalloc below the char
threshold, an ArrayPool rental above it, and a single string
allocation, replacing the interpolated hash.name string. The id
shape and the single-operation fast path are unchanged.
Covers the single-operation direct Hash.Value return, the
multi-operation hash.name and hash.Default shapes, equality with
the previous interpolation formula, and a hash long enough to force
the ArrayPool rental path.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants