Repository navigation
Fix fields added by type interceptors missing the default resolver cost - #10885
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified, and the change includes targeted regression coverage for interceptor ordering and the documented cost behavior.
No open issues 🎉
What changed in this PR
Fixes cost-analysis interceptor ordering so fields added by later type interceptors receive the configured default resolver cost, and documents the behavioral impact when migrating from Hot Chocolate 16.7 to 16.8.
Changes:
- Moves
CostTypeInterceptorto the final interceptor position. - Adds regression coverage for fields added by later interceptors.
- Adds and registers a 16.7-to-16.8 migration guide describing the updated cost behavior.
| File | Description |
|---|---|
| website/content/docs/hotchocolate/migrating/structure.yaml | Registers the new 16.7-to-16.8 migration guide in the documentation navigation. |
| website/content/docs/hotchocolate/migrating/migrate-from-16-7-to-16-8.md | Documents the default resolver cost applied to fields added by type interceptors and the migration impact. |
| src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/InterceptorTests.cs | Adds regression coverage verifying that fields added by later interceptors receive a resolver cost of 10. |
| src/HotChocolate/CostAnalysis/src/CostAnalysis/CostTypeInterceptor.cs | Ensures cost metadata is applied after other type interceptors complete their modifications. |
Review effort: Lite
Contributor
Patch coverage100.0% of changed lines covered (1/1)
Project coverage: 59.5% (322349/541546 lines) |
glen-84
added a commit
that referenced
this pull request
Nov 21, 2026
This was referenced Nov 22, 2026
chore(deps): Bump HotChocolate.Subscriptions.InMemory from 16.7.5 to 16.7.7
Kuestenlogik/Bowire#1032
Merged
This was referenced Nov 23, 2026
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
CostTypeInterceptornow runs after every other type interceptor. Its position,int.MaxValue, equalled the default position of a type interceptor (uint.MaxValue / 2), so it ran in registration order among them, andAddGraphQLServer()registers it first. A field that a later interceptor added inOnBeforeCompleteTypetherefore missed the default resolver cost of 10 that the cost analysis docs give every field without a pure resolver._entitiesfromAddApolloFederation(), thequeryfield fromAddQueryFieldToMutationPayloads(), and fields with a resolver that an application's own interceptor adds. Each selection of them now has a field cost of 10, up from 1 for a field that returns an object, interface, or union type and 0 otherwise, so an operation close toMaxFieldCostcan now be rejected. The new 16.7 to 16.8 migration guide lists this under behavioral breaking changes.Test plan
InterceptorTestscase: a field that an interceptor registered afterAddGraphQLServer()adds gets@cost(weight: "10"). It fails without the position change.