Skip to content

Filter objectTypeNames for non-batched hydration - #706

Merged
gnawf merged 1 commit into
masterfrom
filter-object-type-names-non-batched-hydration
Nov 25, 2025
Merged

Filter objectTypeNames for non-batched hydration#706
gnawf merged 1 commit into
masterfrom
filter-object-type-names-non-batched-hydration

Conversation

@gnawf

@gnawf gnawf commented Nov 25, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

@github-actions

Copy link
Copy Markdown

Test Results

  613 files  +  613    613 suites  +613   1m 5s ⏱️ + 1m 5s
2 028 tests +2 028  1 507 ✅ +1 507  521 💤 +521  0 ❌ ±0 
2 036 runs  +2 036  1 515 ✅ +1 515  521 💤 +521  0 ❌ ±0 

Results for commit 8edc55f. ± Comparison against base commit a76601b.

*
* Could be empty if there are no object types involved e.g. returns scalar, enum etc.
*/
val backingFieldReturnsObjectTypeNames: Set<String>

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Precomputes this info and stores it.


val queries = NadelHydrationFieldsBuilder
.makeBatchBackingQueries(
executionHints = executionContext.hints,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Need to evaluate FF for new behavior.

} else {
virtualField.children
}
),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is the fix needed.

val fieldChildren = if (executionHints.hydrationFilterObjectTypes()) {
deepClone(fields = filterChildren(instruction, virtualField.children)) +
makeObjectIdFields(executionBlueprint, aliasHelper, instruction)
} else {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

So thing is, we applied this type name filtering for batch hydrations but not for non-batched hydration.

I unified the behavior and also moved the getBackingFieldOverallObjectTypenames to be precomputed in the instruction.

Also moved the filtering to before deepClone so we don't unnecessarily clone objects we were about to filter anyway.

FF is here to ensure smooth rollout.

else -> onNotObjectType(unwrappedType)
}
return type.unwrapAll()
.whenType(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Edited this to use the new whenType

internal val isPartitionedCall: Boolean = false,
internal val executionCoroutine: CoroutineScope,
) {
private val serviceContexts = ConcurrentHashMap<String, CompletableFuture<Any?>>()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Remanent code, not used

private fun getReturnsObjectTypeNames(
backingField: GraphQLFieldDefinition,
virtualTypeContext: NadelVirtualTypeContext?,
): Set<String> {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Function that precomputes returned object type names

@gnawf
gnawf merged commit 6f26e6b into master Nov 25, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants