agent_patch
runs/2026-02-21__03-36-16__gpt-5-1-codex-mini/flux-pr-1087/flux-pr-1087.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/agent-logs/agent.patch
5791 bytes
diff --git a/app/pkg/testing/permutations/permutations.go b/app/pkg/testing/permutations/permutations.go
new file mode 100644
index 0000000..85355cf
--- /dev/null
+++ b/app/pkg/testing/permutations/permutations.go
@@ -0,0 +1,33 @@
+package permutations
+
+import "gonum.org/v1/gonum/stat/combin"
+
+// Permutation holds a single reordered version of a slice along with the
+// order of indexes used to produce it.
+type Permutation[T any] struct {
+ Order []int
+ Items []T
+}
+
+// Generate returns permutations of the provided list. Each permutation carries
+// both the new order and the reordered items.
+func Generate[T any](items []T) []*Permutation[T] {
+ size := len(items)
+ list := combin.Permutations(size, size)
+
+ permutations := make([]*Permutation[T], 0, len(list))
+ for _, order := range list {
+ orderCopy := append([]int(nil), order...)
+ permuted := make([]T, size)
+ for i, idx := range orderCopy {
+ permuted[i] = items[idx]
+ }
+
+ permutations = append(permutations, &Permutation[T]{
+ Order: orderCopy,
+ Items: permuted,
+ })
+ }
+
+ return permutations
+}
diff --git a/tmp/agent-patch-flux-pr-1087.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/v2/pkg/engine/datasourcetesting/datasourcetesting.go b/app/v2/pkg/engine/datasourcetesting/datasourcetesting.go
index 9a02e3e..efefe79 100644
--- a/tmp/agent-patch-flux-pr-1087.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/v2/pkg/engine/datasourcetesting/datasourcetesting.go
+++ b/app/v2/pkg/engine/datasourcetesting/datasourcetesting.go
@@ -13,7 +13,6 @@ import (
"github.com/kylelemons/godebug/pretty"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- "gonum.org/v1/gonum/stat/combin"
"github.com/wundergraph/graphql-go-tools/v2/pkg/internal/unsafeprinter"
@@ -25,6 +24,7 @@ import (
"github.com/wundergraph/graphql-go-tools/v2/pkg/engine/postprocess"
"github.com/wundergraph/graphql-go-tools/v2/pkg/internal/unsafeparser"
"github.com/wundergraph/graphql-go-tools/v2/pkg/operationreport"
+ "github.com/wundergraph/graphql-go-tools/v2/pkg/testing/permutations"
)
type testOptions struct {
@@ -76,7 +76,7 @@ func RunWithPermutations(t *testing.T, definition, operation, operationName stri
permutation := dataSourcePermutations[i]
t.Run(fmt.Sprintf("permutation %v", permutation.Order), func(t *testing.T) {
permutationPlanConfiguration := config
- permutationPlanConfiguration.DataSources = permutation.DataSources
+ permutationPlanConfiguration.DataSources = permutation.Items
t.Run("run", RunTest(
definition,
@@ -101,7 +101,7 @@ func RunWithPermutationsVariants(t *testing.T, definition, operation, operationN
permutation := dataSourcePermutations[i]
t.Run(fmt.Sprintf("permutation %v", permutation.Order), func(t *testing.T) {
permutationPlanConfiguration := config
- permutationPlanConfiguration.DataSources = permutation.DataSources
+ permutationPlanConfiguration.DataSources = permutation.Items
t.Run("run", RunTest(
definition,
@@ -243,24 +243,6 @@ func OrderDS(dataSources []plan.DataSource, order []int) (out []plan.DataSource)
return out
}
-func DataSourcePermutations(dataSources []plan.DataSource) []*Permutation {
- size := len(dataSources)
- elementsCount := len(dataSources)
- list := combin.Permutations(size, elementsCount)
-
- permutations := make([]*Permutation, 0, len(list))
-
- for _, v := range list {
- permutations = append(permutations, &Permutation{
- Order: v,
- DataSources: OrderDS(dataSources, v),
- })
- }
-
- return permutations
-}
-
-type Permutation struct {
- Order []int
- DataSources []plan.DataSource
+func DataSourcePermutations(dataSources []plan.DataSource) []*permutations.Permutation[plan.DataSource] {
+ return permutations.Generate(dataSources)
}
diff --git a/tmp/agent-patch-flux-pr-1087.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/v2/pkg/engine/plan/datasource_filter_collect_nodes_visitor.go b/app/v2/pkg/engine/plan/datasource_filter_collect_nodes_visitor.go
index 1262c2e..fdc35eb 100644
--- a/tmp/agent-patch-flux-pr-1087.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/v2/pkg/engine/plan/datasource_filter_collect_nodes_visitor.go
+++ b/app/v2/pkg/engine/plan/datasource_filter_collect_nodes_visitor.go
@@ -197,8 +197,11 @@ func (f *collectNodesVisitor) isInterfaceObject(typeName string) bool {
// has disabled entity resolver
func (f *collectNodesVisitor) allKeysHasDisabledEntityResolver(typeName string) bool {
- keys := f.dataSource.FederationConfiguration().Keys
- return !slices.ContainsFunc(keys.FilterByTypeAndResolvability(typeName, false), func(k FederationFieldConfiguration) bool {
+ keys := f.dataSource.FederationConfiguration().Keys.FilterByTypeAndResolvability(typeName, false)
+ if len(keys) == 0 {
+ return false
+ }
+ return !slices.ContainsFunc(keys, func(k FederationFieldConfiguration) bool {
return !k.DisableEntityResolver
})
}
diff --git a/tmp/agent-patch-flux-pr-1087.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/v2/pkg/engine/plan/datasource_filter_visitor.go b/app/v2/pkg/engine/plan/datasource_filter_visitor.go
index f96b8e8..0bd1d71 100644
--- a/tmp/agent-patch-flux-pr-1087.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/v2/pkg/engine/plan/datasource_filter_visitor.go
+++ b/app/v2/pkg/engine/plan/datasource_filter_visitor.go
@@ -206,6 +206,11 @@ func (f *DataSourceFilter) selectUniqNodeParentsUpToRootNode(i int) {
if !ok {
break
}
+ parent := f.nodes.items[parentIdx]
+ if parent.IsExternal && !parent.IsProvided {
+ // stop walking up once we hit an external node we can't resolve locally
+ break
+ }
f.nodes.items[parentIdx].selectWithReason(ReasonStage1SameSourceParent, f.enableSelectionReasons)
current = parentIdx