Consistent object type names without instruction#714
Conversation
Fixes bug where objectTypeNames is empty for renames
gnawf
left a comment
There was a problem hiding this comment.
Need to add a test, but src/main/ code changes should be done.
|
|
||
| return NadelTransformFieldResult( | ||
| newField = objectTypesNoRenames | ||
| .takeIf(List<GraphQLObjectTypeName>::isNotEmpty) |
| val objectsWithoutRename = overallField.objectTypeNames | ||
| .asSequence() | ||
| .filterNot { it in renameInstructions } | ||
| .toHashSet() |
There was a problem hiding this comment.
So for some reason in NadelRenameTransform the objectsWithoutRename is calculated inside isApplicable which leads to a bug when the ExecutableNormalizedField.objectTypeNames has been edited by another transform prior to NadelRenameTransform.transformField running
| state: State, | ||
| transformServiceExecutionContext: NadelTransformServiceExecutionContext?, | ||
| ): NadelTransformFieldResult { | ||
| val objectTypeNamesWithoutRename = field.objectTypeNames.filter { it !in state.instructionsByObjectTypeNames } |
There was a problem hiding this comment.
Moved it here to be consistent with all other impls, this fixes the bug I found.
| field: ExecutableNormalizedField, | ||
| executionBlueprint: NadelOverallExecutionBlueprint, | ||
| ): List<ExecutableNormalizedField> { | ||
| val setOfFieldObjectTypeNames = field.objectTypeNames.toSet() |
There was a problem hiding this comment.
This is stupid, field.objectTypeNames is already a Set<String>
So we're just cloning the Set here, and we don't even edit it etc, we just do Set.contains check
Test Results 615 files + 615 615 suites +615 1m 5s ⏱️ + 1m 5s For more details on these failures, see this check. Results for commit 720ee01. ± Comparison against base commit ac893ee. ♻️ This comment has been updated with latest results. |
While testing #713 I found this bug. See comments for details.