From ca29c2a7de8cc82800f4edfc8c066280fc4ee345 Mon Sep 17 00:00:00 2001 From: Dominik Korittki <23359034+dkorittki@users.noreply.github.com> Date: Tue, 3 Mar 2026 09:58:13 +0100 Subject: [PATCH 1/6] chore(router): gofmt (#2576) --- .github/actions/go-linter/action.yaml | 11 ++++ aws-lambda-router/Makefile | 3 ++ composition-go/Makefile | 5 +- graphqlmetrics/Makefile | 3 ++ package.json | 2 +- router-tests/Makefile | 3 ++ .../connectrpc/connectrpc_client_test.go | 12 ++--- .../connectrpc_server_lifecycle_test.go | 2 +- router-tests/connectrpc/connectrpc_test.go | 6 +-- .../verify-operation-context-values/module.go | 4 +- router/Makefile | 3 ++ router/core/context.go | 6 +-- router/core/operation_processor.go | 48 ++++++++--------- router/core/plan_generator.go | 2 +- router/pkg/config/config.go | 54 +++++++++---------- router/pkg/connectrpc/handler_test.go | 1 - router/pkg/connectrpc/operation_loader.go | 1 - .../pkg/connectrpc/vanguard_service_test.go | 2 +- router/pkg/mcpserver/server.go | 1 - 19 files changed, 96 insertions(+), 73 deletions(-) diff --git a/.github/actions/go-linter/action.yaml b/.github/actions/go-linter/action.yaml index fd341901dc..c5f54cb8ff 100644 --- a/.github/actions/go-linter/action.yaml +++ b/.github/actions/go-linter/action.yaml @@ -21,3 +21,14 @@ runs: version: 2025.1.1 install-go: false working-directory: ${{ inputs.working-directory }} + + - name: Check gofmt formatting + run: | + files=$(gofmt -l .) + if [ -n "$files" ]; then + echo "The following files are not gofmt-formatted:" + echo "$files" + exit 1 + fi + shell: bash + working-directory: ${{ inputs.working-directory }} diff --git a/aws-lambda-router/Makefile b/aws-lambda-router/Makefile index 2d72ea8209..5bb325a818 100644 --- a/aws-lambda-router/Makefile +++ b/aws-lambda-router/Makefile @@ -23,6 +23,9 @@ deploy: build-sam lint: staticcheck ./... +format: + go fmt ./... + test: go test -v ./... diff --git a/composition-go/Makefile b/composition-go/Makefile index 5a18260ac1..0e66c8a248 100644 --- a/composition-go/Makefile +++ b/composition-go/Makefile @@ -6,4 +6,7 @@ test-coverage: go test -v -coverprofile=coverage_normal.out -coverpkg=github.com/wundergraph/cosmo/composition-go/... ./... go test -v -tags=wg_composition_v8 -coverprofile=coverage_v8.out -coverpkg=github.com/wundergraph/cosmo/composition-go/... ./... -.PHONY: test \ No newline at end of file +format: + go fmt ./... + +.PHONY: test format \ No newline at end of file diff --git a/graphqlmetrics/Makefile b/graphqlmetrics/Makefile index 6b59fe545e..d5640b15e6 100644 --- a/graphqlmetrics/Makefile +++ b/graphqlmetrics/Makefile @@ -19,6 +19,9 @@ lint: go vet ./... staticcheck ./... +format: + go fmt ./... + VERSION?=dev build: CGO_ENABLED=0 go build -trimpath -ldflags "-extldflags -static -X github.com/wundergraph/cosmo/graphqlmetrics/core.Version=$(VERSION)" -a -o graphqlmetrics cmd/main.go diff --git a/package.json b/package.json index b45c0ee007..25b409404b 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "build": "pnpm -r run build", "test": "pnpm run -r --parallel test", "generate": "pnpm buf generate --path proto/wg/cosmo/platform --path proto/wg/cosmo/notifications --path proto/wg/cosmo/common --path proto/wg/cosmo/node --template buf.ts.gen.yaml && pnpm -r run --filter './connect' build", - "husky": "husky install", + "prepare": "husky install", "lint:fix": "pnpm run -r --parallel lint:fix", "clean": "rm -rf node_modules **/node_modules dist **/dist gen **/gen .next **/.next tsconfig.tsbuildinfo **/tsconfig.tsbuildinfo .eslintcache **/.eslintcache", "release-preview": "lerna publish --ignore-scripts --dry-run", diff --git a/router-tests/Makefile b/router-tests/Makefile index 8e856304e4..48376edbce 100644 --- a/router-tests/Makefile +++ b/router-tests/Makefile @@ -37,6 +37,9 @@ lint: go vet ./... staticcheck ./... +format: + go fmt ./... + test-stability: @while $(MAKE) test-fresh; do :; done diff --git a/router-tests/connectrpc/connectrpc_client_test.go b/router-tests/connectrpc/connectrpc_client_test.go index 664998c327..39d16f30a2 100644 --- a/router-tests/connectrpc/connectrpc_client_test.go +++ b/router-tests/connectrpc/connectrpc_client_test.go @@ -26,7 +26,7 @@ func TestConnectRPC_ClientProtocols(t *testing.T) { GraphQLHandler: EmployeeGraphQLHandler(), }) defer ts.Close() - + err := ts.Start() require.NoError(t, err) @@ -126,7 +126,7 @@ func TestConnectRPC_ClientErrorHandling(t *testing.T) { ts := NewTestConnectRPCServer(t, ConnectRPCServerOptions{ GraphQLHandler: ErrorGraphQLHandler("Employee not found"), }) - + err := ts.Start() require.NoError(t, err) @@ -169,11 +169,11 @@ func TestConnectRPC_ClientErrorHandling(t *testing.T) { "errors": [{"message": "Could not fetch pets"}] }`)) } - + ts := NewTestConnectRPCServer(t, ConnectRPCServerOptions{ GraphQLHandler: handler, }) - + err := ts.Start() require.NoError(t, err) @@ -189,7 +189,7 @@ func TestConnectRPC_ClientErrorHandling(t *testing.T) { _, err = client.GetEmployeeById(context.Background(), req) // Per GraphQL spec, errors at top level should result in an error require.Error(t, err) - + var connectErr *connect.Error require.ErrorAs(t, err, &connectErr) assert.Equal(t, connect.CodeUnknown, connectErr.Code()) @@ -225,7 +225,7 @@ func TestConnectRPC_ClientErrorHandling(t *testing.T) { ts := NewTestConnectRPCServer(t, ConnectRPCServerOptions{ GraphQLHandler: HTTPErrorHandler(http.StatusInternalServerError, "Internal Server Error"), }) - + err := ts.Start() require.NoError(t, err) diff --git a/router-tests/connectrpc/connectrpc_server_lifecycle_test.go b/router-tests/connectrpc/connectrpc_server_lifecycle_test.go index 2c837a8dec..35836d93fe 100644 --- a/router-tests/connectrpc/connectrpc_server_lifecycle_test.go +++ b/router-tests/connectrpc/connectrpc_server_lifecycle_test.go @@ -107,4 +107,4 @@ func TestConnectRPC_ServerLifecycle_GracefulShutdown(t *testing.T) { assert.NoError(t, err) assert.Less(t, duration, 10*time.Second, "stop should complete within timeout") }) -} \ No newline at end of file +} diff --git a/router-tests/connectrpc/connectrpc_test.go b/router-tests/connectrpc/connectrpc_test.go index 0f5de24c06..0109dc7f96 100644 --- a/router-tests/connectrpc/connectrpc_test.go +++ b/router-tests/connectrpc/connectrpc_test.go @@ -13,7 +13,7 @@ func TestConnectRPC_ServiceDiscovery(t *testing.T) { t.Run("discovers services from proto files", func(t *testing.T) { ts := NewTestConnectRPCServer(t, ConnectRPCServerOptions{}) - + err := ts.Start() require.NoError(t, err) @@ -30,8 +30,8 @@ func TestConnectRPC_ServiceDiscovery(t *testing.T) { for _, serviceName := range serviceNames { t.Logf(" - Service: %s", serviceName) } - + operationCount := ts.GetOperationCount() t.Logf("Discovered %d operation(s)", operationCount) }) -} \ No newline at end of file +} diff --git a/router-tests/modules/verify-operation-context-values/module.go b/router-tests/modules/verify-operation-context-values/module.go index b044bc71c5..ac53d2f236 100644 --- a/router-tests/modules/verify-operation-context-values/module.go +++ b/router-tests/modules/verify-operation-context-values/module.go @@ -50,11 +50,11 @@ func (m *VerifyOperationContextValuesModule) Middleware(ctx core.RequestContext, } // Convert variables to JSON string for easier testing - captured.VariablesJSON = "{}" + captured.VariablesJSON = "{}" if captured.Variables != nil { variablesBytes := captured.Variables.MarshalTo(nil) captured.VariablesJSON = string(variablesBytes) - } + } // Send the captured values to the test select { case m.ResultsChan <- captured: diff --git a/router/Makefile b/router/Makefile index 6a51c0341e..40b14d27de 100644 --- a/router/Makefile +++ b/router/Makefile @@ -27,6 +27,9 @@ lint: go vet ./... staticcheck ./... +format: + go fmt ./... + clean-testcache: go clean -testcache diff --git a/router/core/context.go b/router/core/context.go index 6162f96499..408abfeac9 100644 --- a/router/core/context.go +++ b/router/core/context.go @@ -708,9 +708,9 @@ func (o *operationContext) GetTypeFieldUsageInfoMetrics() []*graphqlmetrics.Type // OperationTimings contains timing information for various stages of operation processing type OperationTimings struct { - ParsingTime time.Duration - ValidationTime time.Duration - PlanningTime time.Duration + ParsingTime time.Duration + ValidationTime time.Duration + PlanningTime time.Duration NormalizationTime time.Duration } diff --git a/router/core/operation_processor.go b/router/core/operation_processor.go index a4842d6b57..68d71af2ed 100644 --- a/router/core/operation_processor.go +++ b/router/core/operation_processor.go @@ -111,23 +111,23 @@ type OperationProcessorOptions struct { PersistedOperationClient *persistedoperation.Client AutomaticPersistedOperationCacheTtl int - EnablePersistedOperationsCache bool - PersistedOpsNormalizationCache *ristretto.Cache[uint64, NormalizationCacheEntry] - NormalizationCache *ristretto.Cache[uint64, NormalizationCacheEntry] - QueryDepthCache *ristretto.Cache[uint64, ComplexityCacheEntry] - VariablesNormalizationCache *ristretto.Cache[uint64, VariablesNormalizationCacheEntry] - RemapVariablesCache *ristretto.Cache[uint64, RemapVariablesCacheEntry] - ValidationCache *ristretto.Cache[uint64, bool] - OperationHashCache *ristretto.Cache[uint64, string] - ParseKitPoolSize int - IntrospectionEnabled bool - ApolloCompatibilityFlags config.ApolloCompatibilityFlags - ApolloRouterCompatibilityFlags config.ApolloRouterCompatibilityFlags - DisableExposingVariablesContentOnValidationError bool - RelaxSubgraphOperationFieldSelectionMergingNullability bool - ComplexityLimits *config.ComplexityLimits - ParserTokenizerLimits astparser.TokenizerLimits - OperationNameLengthLimit int + EnablePersistedOperationsCache bool + PersistedOpsNormalizationCache *ristretto.Cache[uint64, NormalizationCacheEntry] + NormalizationCache *ristretto.Cache[uint64, NormalizationCacheEntry] + QueryDepthCache *ristretto.Cache[uint64, ComplexityCacheEntry] + VariablesNormalizationCache *ristretto.Cache[uint64, VariablesNormalizationCacheEntry] + RemapVariablesCache *ristretto.Cache[uint64, RemapVariablesCacheEntry] + ValidationCache *ristretto.Cache[uint64, bool] + OperationHashCache *ristretto.Cache[uint64, string] + ParseKitPoolSize int + IntrospectionEnabled bool + ApolloCompatibilityFlags config.ApolloCompatibilityFlags + ApolloRouterCompatibilityFlags config.ApolloRouterCompatibilityFlags + DisableExposingVariablesContentOnValidationError bool + RelaxSubgraphOperationFieldSelectionMergingNullability bool + ComplexityLimits *config.ComplexityLimits + ParserTokenizerLimits astparser.TokenizerLimits + OperationNameLengthLimit int } // OperationProcessor provides shared resources to the parseKit and OperationKit. @@ -1422,10 +1422,10 @@ func (o *OperationKit) skipIncludeVariableNames() []string { } type parseKitOptions struct { - apolloCompatibilityFlags config.ApolloCompatibilityFlags - apolloRouterCompatibilityFlags config.ApolloRouterCompatibilityFlags - disableExposingVariablesContentOnValidationError bool - relaxSubgraphOperationFieldSelectionMergingNullability bool + apolloCompatibilityFlags config.ApolloCompatibilityFlags + apolloRouterCompatibilityFlags config.ApolloRouterCompatibilityFlags + disableExposingVariablesContentOnValidationError bool + relaxSubgraphOperationFieldSelectionMergingNullability bool } func createParseKit(i int, options *parseKitOptions) *parseKit { @@ -1486,9 +1486,9 @@ func NewOperationProcessor(opts OperationProcessorOptions) *OperationProcessor { operationNameLengthLimit: opts.OperationNameLengthLimit, complexityLimits: opts.ComplexityLimits, parseKitOptions: &parseKitOptions{ - apolloCompatibilityFlags: opts.ApolloCompatibilityFlags, - apolloRouterCompatibilityFlags: opts.ApolloRouterCompatibilityFlags, - disableExposingVariablesContentOnValidationError: opts.DisableExposingVariablesContentOnValidationError, + apolloCompatibilityFlags: opts.ApolloCompatibilityFlags, + apolloRouterCompatibilityFlags: opts.ApolloRouterCompatibilityFlags, + disableExposingVariablesContentOnValidationError: opts.DisableExposingVariablesContentOnValidationError, relaxSubgraphOperationFieldSelectionMergingNullability: opts.RelaxSubgraphOperationFieldSelectionMergingNullability, }, } diff --git a/router/core/plan_generator.go b/router/core/plan_generator.go index a92264b042..b06a74999b 100644 --- a/router/core/plan_generator.go +++ b/router/core/plan_generator.go @@ -342,7 +342,7 @@ func (pg *PlanGenerator) loadConfiguration(routerConfig *nodev1.RouterConfig, lo if _, ok := redisSources[providerId]; !ok { redisSources[providerId] = nil routerEngineConfig.Events.Providers.Redis = append(routerEngineConfig.Events.Providers.Redis, config.RedisEventSource{ - ID: providerId, + ID: providerId, }) } } diff --git a/router/pkg/config/config.go b/router/pkg/config/config.go index 79adc0972d..e0998c6e4c 100644 --- a/router/pkg/config/config.go +++ b/router/pkg/config/config.go @@ -414,33 +414,33 @@ type EngineExecutionConfiguration struct { ForceEnableInboundRequestDeduplication bool `envDefault:"false" env:"ENGINE_FORCE_ENABLE_INBOUND_REQUEST_DEDUPLICATION" yaml:"force_enable_inbound_request_deduplication"` EnableRequestTracing bool `envDefault:"true" env:"ENGINE_ENABLE_REQUEST_TRACING" yaml:"enable_request_tracing"` // EnableExecutionPlanCacheResponseHeader is deprecated, use EngineDebugConfiguration.EnableCacheResponseHeaders instead. - EnableExecutionPlanCacheResponseHeader bool `envDefault:"false" env:"ENGINE_ENABLE_EXECUTION_PLAN_CACHE_RESPONSE_HEADER" yaml:"enable_execution_plan_cache_response_header"` - MaxConcurrentResolvers int `envDefault:"1024" env:"ENGINE_MAX_CONCURRENT_RESOLVERS" yaml:"max_concurrent_resolvers,omitempty"` - EnableNetPoll bool `envDefault:"true" env:"ENGINE_ENABLE_NET_POLL" yaml:"enable_net_poll"` - WebSocketClientPollTimeout time.Duration `envDefault:"1s" env:"ENGINE_WEBSOCKET_CLIENT_POLL_TIMEOUT" yaml:"websocket_client_poll_timeout,omitempty"` - WebSocketClientConnBufferSize int `envDefault:"128" env:"ENGINE_WEBSOCKET_CLIENT_CONN_BUFFER_SIZE" yaml:"websocket_client_conn_buffer_size,omitempty"` - WebSocketClientReadTimeout time.Duration `envDefault:"5s" env:"ENGINE_WEBSOCKET_CLIENT_READ_TIMEOUT" yaml:"websocket_client_read_timeout,omitempty"` - WebSocketClientWriteTimeout time.Duration `envDefault:"10s" env:"ENGINE_WEBSOCKET_CLIENT_WRITE_TIMEOUT" yaml:"websocket_client_write_timeout,omitempty"` - WebSocketClientPingInterval time.Duration `envDefault:"15s" env:"ENGINE_WEBSOCKET_CLIENT_PING_INTERVAL" yaml:"websocket_client_ping_interval,omitempty"` - WebSocketClientPingTimeout time.Duration `envDefault:"30s" env:"ENGINE_WEBSOCKET_CLIENT_PING_TIMEOUT" yaml:"websocket_client_ping_timeout,omitempty"` - WebSocketClientFrameTimeout time.Duration `envDefault:"100ms" env:"ENGINE_WEBSOCKET_CLIENT_FRAME_TIMEOUT" yaml:"websocket_client_frame_timeout,omitempty"` - ExecutionPlanCacheSize int64 `envDefault:"1024" env:"ENGINE_EXECUTION_PLAN_CACHE_SIZE" yaml:"execution_plan_cache_size,omitempty"` - MinifySubgraphOperations bool `envDefault:"true" env:"ENGINE_MINIFY_SUBGRAPH_OPERATIONS" yaml:"minify_subgraph_operations"` - EnablePersistedOperationsCache bool `envDefault:"true" env:"ENGINE_ENABLE_PERSISTED_OPERATIONS_CACHE" yaml:"enable_persisted_operations_cache"` - EnableNormalizationCache bool `envDefault:"true" env:"ENGINE_ENABLE_NORMALIZATION_CACHE" yaml:"enable_normalization_cache"` - NormalizationCacheSize int64 `envDefault:"1024" env:"ENGINE_NORMALIZATION_CACHE_SIZE" yaml:"normalization_cache_size,omitempty"` - OperationHashCacheSize int64 `envDefault:"2048" env:"ENGINE_OPERATION_HASH_CACHE_SIZE" yaml:"operation_hash_cache_size,omitempty"` - ParseKitPoolSize int `envDefault:"16" env:"ENGINE_PARSEKIT_POOL_SIZE" yaml:"parsekit_pool_size,omitempty"` - EnableValidationCache bool `envDefault:"true" env:"ENGINE_ENABLE_VALIDATION_CACHE" yaml:"enable_validation_cache"` - ValidationCacheSize int64 `envDefault:"1024" env:"ENGINE_VALIDATION_CACHE_SIZE" yaml:"validation_cache_size,omitempty"` - DisableExposingVariablesContentOnValidationError bool `envDefault:"false" env:"ENGINE_DISABLE_EXPOSING_VARIABLES_CONTENT_ON_VALIDATION_ERROR" yaml:"disable_exposing_variables_content_on_validation_error"` - ResolverMaxRecyclableParserSize int `envDefault:"32768" env:"ENGINE_RESOLVER_MAX_RECYCLABLE_PARSER_SIZE" yaml:"resolver_max_recyclable_parser_size,omitempty"` - EnableSubgraphFetchOperationName bool `envDefault:"false" env:"ENGINE_ENABLE_SUBGRAPH_FETCH_OPERATION_NAME" yaml:"enable_subgraph_fetch_operation_name"` - DisableVariablesRemapping bool `envDefault:"false" env:"ENGINE_DISABLE_VARIABLES_REMAPPING" yaml:"disable_variables_remapping"` - EnableRequireFetchReasons bool `envDefault:"false" env:"ENGINE_ENABLE_REQUIRE_FETCH_REASONS" yaml:"enable_require_fetch_reasons"` - SubscriptionFetchTimeout time.Duration `envDefault:"30s" env:"ENGINE_SUBSCRIPTION_FETCH_TIMEOUT" yaml:"subscription_fetch_timeout,omitempty"` - ValidateRequiredExternalFields bool `envDefault:"false" env:"ENGINE_VALIDATE_REQUIRED_EXTERNAL_FIELDS" yaml:"validate_required_external_fields"` - RelaxSubgraphOperationFieldSelectionMergingNullability bool `envDefault:"false" env:"ENGINE_RELAX_SUBGRAPH_OPERATION_FIELD_SELECTION_MERGING_NULLABILITY" yaml:"relax_subgraph_operation_field_selection_merging_nullability"` + EnableExecutionPlanCacheResponseHeader bool `envDefault:"false" env:"ENGINE_ENABLE_EXECUTION_PLAN_CACHE_RESPONSE_HEADER" yaml:"enable_execution_plan_cache_response_header"` + MaxConcurrentResolvers int `envDefault:"1024" env:"ENGINE_MAX_CONCURRENT_RESOLVERS" yaml:"max_concurrent_resolvers,omitempty"` + EnableNetPoll bool `envDefault:"true" env:"ENGINE_ENABLE_NET_POLL" yaml:"enable_net_poll"` + WebSocketClientPollTimeout time.Duration `envDefault:"1s" env:"ENGINE_WEBSOCKET_CLIENT_POLL_TIMEOUT" yaml:"websocket_client_poll_timeout,omitempty"` + WebSocketClientConnBufferSize int `envDefault:"128" env:"ENGINE_WEBSOCKET_CLIENT_CONN_BUFFER_SIZE" yaml:"websocket_client_conn_buffer_size,omitempty"` + WebSocketClientReadTimeout time.Duration `envDefault:"5s" env:"ENGINE_WEBSOCKET_CLIENT_READ_TIMEOUT" yaml:"websocket_client_read_timeout,omitempty"` + WebSocketClientWriteTimeout time.Duration `envDefault:"10s" env:"ENGINE_WEBSOCKET_CLIENT_WRITE_TIMEOUT" yaml:"websocket_client_write_timeout,omitempty"` + WebSocketClientPingInterval time.Duration `envDefault:"15s" env:"ENGINE_WEBSOCKET_CLIENT_PING_INTERVAL" yaml:"websocket_client_ping_interval,omitempty"` + WebSocketClientPingTimeout time.Duration `envDefault:"30s" env:"ENGINE_WEBSOCKET_CLIENT_PING_TIMEOUT" yaml:"websocket_client_ping_timeout,omitempty"` + WebSocketClientFrameTimeout time.Duration `envDefault:"100ms" env:"ENGINE_WEBSOCKET_CLIENT_FRAME_TIMEOUT" yaml:"websocket_client_frame_timeout,omitempty"` + ExecutionPlanCacheSize int64 `envDefault:"1024" env:"ENGINE_EXECUTION_PLAN_CACHE_SIZE" yaml:"execution_plan_cache_size,omitempty"` + MinifySubgraphOperations bool `envDefault:"true" env:"ENGINE_MINIFY_SUBGRAPH_OPERATIONS" yaml:"minify_subgraph_operations"` + EnablePersistedOperationsCache bool `envDefault:"true" env:"ENGINE_ENABLE_PERSISTED_OPERATIONS_CACHE" yaml:"enable_persisted_operations_cache"` + EnableNormalizationCache bool `envDefault:"true" env:"ENGINE_ENABLE_NORMALIZATION_CACHE" yaml:"enable_normalization_cache"` + NormalizationCacheSize int64 `envDefault:"1024" env:"ENGINE_NORMALIZATION_CACHE_SIZE" yaml:"normalization_cache_size,omitempty"` + OperationHashCacheSize int64 `envDefault:"2048" env:"ENGINE_OPERATION_HASH_CACHE_SIZE" yaml:"operation_hash_cache_size,omitempty"` + ParseKitPoolSize int `envDefault:"16" env:"ENGINE_PARSEKIT_POOL_SIZE" yaml:"parsekit_pool_size,omitempty"` + EnableValidationCache bool `envDefault:"true" env:"ENGINE_ENABLE_VALIDATION_CACHE" yaml:"enable_validation_cache"` + ValidationCacheSize int64 `envDefault:"1024" env:"ENGINE_VALIDATION_CACHE_SIZE" yaml:"validation_cache_size,omitempty"` + DisableExposingVariablesContentOnValidationError bool `envDefault:"false" env:"ENGINE_DISABLE_EXPOSING_VARIABLES_CONTENT_ON_VALIDATION_ERROR" yaml:"disable_exposing_variables_content_on_validation_error"` + ResolverMaxRecyclableParserSize int `envDefault:"32768" env:"ENGINE_RESOLVER_MAX_RECYCLABLE_PARSER_SIZE" yaml:"resolver_max_recyclable_parser_size,omitempty"` + EnableSubgraphFetchOperationName bool `envDefault:"false" env:"ENGINE_ENABLE_SUBGRAPH_FETCH_OPERATION_NAME" yaml:"enable_subgraph_fetch_operation_name"` + DisableVariablesRemapping bool `envDefault:"false" env:"ENGINE_DISABLE_VARIABLES_REMAPPING" yaml:"disable_variables_remapping"` + EnableRequireFetchReasons bool `envDefault:"false" env:"ENGINE_ENABLE_REQUIRE_FETCH_REASONS" yaml:"enable_require_fetch_reasons"` + SubscriptionFetchTimeout time.Duration `envDefault:"30s" env:"ENGINE_SUBSCRIPTION_FETCH_TIMEOUT" yaml:"subscription_fetch_timeout,omitempty"` + ValidateRequiredExternalFields bool `envDefault:"false" env:"ENGINE_VALIDATE_REQUIRED_EXTERNAL_FIELDS" yaml:"validate_required_external_fields"` + RelaxSubgraphOperationFieldSelectionMergingNullability bool `envDefault:"false" env:"ENGINE_RELAX_SUBGRAPH_OPERATION_FIELD_SELECTION_MERGING_NULLABILITY" yaml:"relax_subgraph_operation_field_selection_merging_nullability"` } type BlockOperationConfiguration struct { diff --git a/router/pkg/connectrpc/handler_test.go b/router/pkg/connectrpc/handler_test.go index b85206b2da..3887cc4879 100644 --- a/router/pkg/connectrpc/handler_test.go +++ b/router/pkg/connectrpc/handler_test.go @@ -176,4 +176,3 @@ func TestConvertProtoJSONToGraphQLVariables(t *testing.T) { }`, string(result)) }) } - diff --git a/router/pkg/connectrpc/operation_loader.go b/router/pkg/connectrpc/operation_loader.go index 9d0889e581..af93ebc690 100644 --- a/router/pkg/connectrpc/operation_loader.go +++ b/router/pkg/connectrpc/operation_loader.go @@ -116,4 +116,3 @@ func LoadOperationsForService(serviceName string, operationFiles []string, logge return operations, nil } - diff --git a/router/pkg/connectrpc/vanguard_service_test.go b/router/pkg/connectrpc/vanguard_service_test.go index 2fdbd54211..4689618f9c 100644 --- a/router/pkg/connectrpc/vanguard_service_test.go +++ b/router/pkg/connectrpc/vanguard_service_test.go @@ -215,7 +215,7 @@ func TestVanguardService_ServiceHandler(t *testing.T) { // Create handler with mock server protoLoader := GetSharedProtoLoader(t, "testdata/services/employee.v1") - + // Build operations map with service-scoped approach before creating registry serviceName := "employee.v1.EmployeeService" operations := map[string]map[string]*schemaloader.Operation{ diff --git a/router/pkg/mcpserver/server.go b/router/pkg/mcpserver/server.go index 35b365bba4..81a9f504f3 100644 --- a/router/pkg/mcpserver/server.go +++ b/router/pkg/mcpserver/server.go @@ -40,7 +40,6 @@ func requestHeadersFromRequest(ctx context.Context, r *http.Request) context.Con return withRequestHeaders(ctx, headers) } - // headersFromContext extracts the request headers from the context. func headersFromContext(ctx context.Context) (http.Header, error) { headers, ok := ctx.Value(requestHeadersKey{}).(http.Header) From d4ab1322c69ea40892c3c0ea7d8d8390c3c52eda Mon Sep 17 00:00:00 2001 From: Dominik Korittki <23359034+dkorittki@users.noreply.github.com> Date: Wed, 4 Mar 2026 09:47:43 +0100 Subject: [PATCH 2/6] chore: revert package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 25b409404b..b45c0ee007 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "build": "pnpm -r run build", "test": "pnpm run -r --parallel test", "generate": "pnpm buf generate --path proto/wg/cosmo/platform --path proto/wg/cosmo/notifications --path proto/wg/cosmo/common --path proto/wg/cosmo/node --template buf.ts.gen.yaml && pnpm -r run --filter './connect' build", - "prepare": "husky install", + "husky": "husky install", "lint:fix": "pnpm run -r --parallel lint:fix", "clean": "rm -rf node_modules **/node_modules dist **/dist gen **/gen .next **/.next tsconfig.tsbuildinfo **/tsconfig.tsbuildinfo .eslintcache **/.eslintcache", "release-preview": "lerna publish --ignore-scripts --dry-run", From 7430d69bd08412e388c1f79788a1e2603e76d5b0 Mon Sep 17 00:00:00 2001 From: Dominik Korittki <23359034+dkorittki@users.noreply.github.com> Date: Wed, 4 Mar 2026 13:29:23 +0100 Subject: [PATCH 3/6] chore: revert Makefiles in favor of another pull request --- aws-lambda-router/Makefile | 3 --- composition-go/Makefile | 3 --- router-tests/Makefile | 3 --- router/Makefile | 3 --- 4 files changed, 12 deletions(-) diff --git a/aws-lambda-router/Makefile b/aws-lambda-router/Makefile index 5bb325a818..2d72ea8209 100644 --- a/aws-lambda-router/Makefile +++ b/aws-lambda-router/Makefile @@ -23,9 +23,6 @@ deploy: build-sam lint: staticcheck ./... -format: - go fmt ./... - test: go test -v ./... diff --git a/composition-go/Makefile b/composition-go/Makefile index 0e66c8a248..f517a52fd1 100644 --- a/composition-go/Makefile +++ b/composition-go/Makefile @@ -6,7 +6,4 @@ test-coverage: go test -v -coverprofile=coverage_normal.out -coverpkg=github.com/wundergraph/cosmo/composition-go/... ./... go test -v -tags=wg_composition_v8 -coverprofile=coverage_v8.out -coverpkg=github.com/wundergraph/cosmo/composition-go/... ./... -format: - go fmt ./... - .PHONY: test format \ No newline at end of file diff --git a/router-tests/Makefile b/router-tests/Makefile index 48376edbce..8e856304e4 100644 --- a/router-tests/Makefile +++ b/router-tests/Makefile @@ -37,9 +37,6 @@ lint: go vet ./... staticcheck ./... -format: - go fmt ./... - test-stability: @while $(MAKE) test-fresh; do :; done diff --git a/router/Makefile b/router/Makefile index 40b14d27de..6a51c0341e 100644 --- a/router/Makefile +++ b/router/Makefile @@ -27,9 +27,6 @@ lint: go vet ./... staticcheck ./... -format: - go fmt ./... - clean-testcache: go clean -testcache From f194c430e8da9611ebf2087c393a7908740b49aa Mon Sep 17 00:00:00 2001 From: Dominik Korittki <23359034+dkorittki@users.noreply.github.com> Date: Wed, 4 Mar 2026 13:30:18 +0100 Subject: [PATCH 4/6] chore: fix Makefile --- composition-go/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composition-go/Makefile b/composition-go/Makefile index f517a52fd1..5a18260ac1 100644 --- a/composition-go/Makefile +++ b/composition-go/Makefile @@ -6,4 +6,4 @@ test-coverage: go test -v -coverprofile=coverage_normal.out -coverpkg=github.com/wundergraph/cosmo/composition-go/... ./... go test -v -tags=wg_composition_v8 -coverprofile=coverage_v8.out -coverpkg=github.com/wundergraph/cosmo/composition-go/... ./... -.PHONY: test format \ No newline at end of file +.PHONY: test \ No newline at end of file From d74a0c737f343792f190214e7c3f21298fbf7fd5 Mon Sep 17 00:00:00 2001 From: Dominik Korittki <23359034+dkorittki@users.noreply.github.com> Date: Wed, 4 Mar 2026 13:30:49 +0100 Subject: [PATCH 5/6] chore: revert graphqlmetrics/Makefile --- graphqlmetrics/Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/graphqlmetrics/Makefile b/graphqlmetrics/Makefile index d5640b15e6..6b59fe545e 100644 --- a/graphqlmetrics/Makefile +++ b/graphqlmetrics/Makefile @@ -19,9 +19,6 @@ lint: go vet ./... staticcheck ./... -format: - go fmt ./... - VERSION?=dev build: CGO_ENABLED=0 go build -trimpath -ldflags "-extldflags -static -X github.com/wundergraph/cosmo/graphqlmetrics/core.Version=$(VERSION)" -a -o graphqlmetrics cmd/main.go From debc484e1ff004239e0883bc762730f236bbf13a Mon Sep 17 00:00:00 2001 From: Dominik Korittki <23359034+dkorittki@users.noreply.github.com> Date: Tue, 31 Mar 2026 11:24:10 +0200 Subject: [PATCH 6/6] chore: format router files --- router-tests/events/kafka_events_test.go | 1 - router-tests/events/nats_events_test.go | 2 -- router-tests/events/redis_events_test.go | 1 - router-tests/lifecycle/shutdown_test.go | 2 +- router-tests/modules/context_error_field_test.go | 2 +- router-tests/modules/set_scopes_test.go | 2 +- router-tests/modules/stream_receive_test.go | 2 +- router-tests/observability/prometheus_test.go | 1 - router-tests/telemetry/connection_metrics_test.go | 2 +- router-tests/telemetry/metrics_log_export_test.go | 2 +- router-tests/telemetry/stream_metrics_test.go | 2 +- router-tests/testenv/testenv.go | 2 +- router/pkg/mcpserver/server_test.go | 2 +- router/pkg/trace/meter.go | 1 - 14 files changed, 9 insertions(+), 15 deletions(-) diff --git a/router-tests/events/kafka_events_test.go b/router-tests/events/kafka_events_test.go index e76560a90d..dc13e10fae 100644 --- a/router-tests/events/kafka_events_test.go +++ b/router-tests/events/kafka_events_test.go @@ -20,7 +20,6 @@ import ( "github.com/wundergraph/cosmo/router/pkg/config" ) - type kafkaSubscriptionArgs struct { dataValue []byte errValue error diff --git a/router-tests/events/nats_events_test.go b/router-tests/events/nats_events_test.go index 88a46c0d77..7b3f3822b5 100644 --- a/router-tests/events/nats_events_test.go +++ b/router-tests/events/nats_events_test.go @@ -56,7 +56,6 @@ func (c *ConfigPollerMock) Stop(_ context.Context) error { return nil } - type natsSubscriptionArgs struct { dataValue []byte errValue error @@ -1432,7 +1431,6 @@ func TestNatsEvents(t *testing.T) { }) }) - t.Run("subscribe to multiple subjects", func(t *testing.T) { t.Parallel() diff --git a/router-tests/events/redis_events_test.go b/router-tests/events/redis_events_test.go index fbf126c905..a3a8eae2e5 100644 --- a/router-tests/events/redis_events_test.go +++ b/router-tests/events/redis_events_test.go @@ -18,7 +18,6 @@ import ( "github.com/wundergraph/cosmo/router/pkg/config" ) - type subscriptionArgs struct { dataValue []byte errValue error diff --git a/router-tests/lifecycle/shutdown_test.go b/router-tests/lifecycle/shutdown_test.go index 2960023bca..36691a2146 100644 --- a/router-tests/lifecycle/shutdown_test.go +++ b/router-tests/lifecycle/shutdown_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/wundergraph/cosmo/router-tests/testutils" "github.com/wundergraph/cosmo/router-tests/testenv" + "github.com/wundergraph/cosmo/router-tests/testutils" "github.com/wundergraph/cosmo/router/core" "github.com/wundergraph/cosmo/router/pkg/config" "go.uber.org/goleak" diff --git a/router-tests/modules/context_error_field_test.go b/router-tests/modules/context_error_field_test.go index 0e658cc8f2..590ae15441 100644 --- a/router-tests/modules/context_error_field_test.go +++ b/router-tests/modules/context_error_field_test.go @@ -7,9 +7,9 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/wundergraph/cosmo/router-tests/testutils" contexterror "github.com/wundergraph/cosmo/router-tests/modules/context-error" "github.com/wundergraph/cosmo/router-tests/testenv" + "github.com/wundergraph/cosmo/router-tests/testutils" "github.com/wundergraph/cosmo/router/core" "github.com/wundergraph/cosmo/router/pkg/config" ) diff --git a/router-tests/modules/set_scopes_test.go b/router-tests/modules/set_scopes_test.go index 8b907f2cb6..2ff93352be 100644 --- a/router-tests/modules/set_scopes_test.go +++ b/router-tests/modules/set_scopes_test.go @@ -8,10 +8,10 @@ import ( "time" "github.com/stretchr/testify/require" - "github.com/wundergraph/cosmo/router-tests/testutils" "github.com/wundergraph/cosmo/router-tests/jwks" setScopesModule "github.com/wundergraph/cosmo/router-tests/modules/custom-set-scopes" "github.com/wundergraph/cosmo/router-tests/testenv" + "github.com/wundergraph/cosmo/router-tests/testutils" "github.com/wundergraph/cosmo/router/cmd/custom/module" "github.com/wundergraph/cosmo/router/core" "github.com/wundergraph/cosmo/router/pkg/authentication" diff --git a/router-tests/modules/stream_receive_test.go b/router-tests/modules/stream_receive_test.go index 99584a3dba..30fb26f490 100644 --- a/router-tests/modules/stream_receive_test.go +++ b/router-tests/modules/stream_receive_test.go @@ -11,11 +11,11 @@ import ( "github.com/hasura/go-graphql-client" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/wundergraph/cosmo/router-tests/testutils" "github.com/wundergraph/cosmo/router-tests/events" "github.com/wundergraph/cosmo/router-tests/jwks" stream_receive "github.com/wundergraph/cosmo/router-tests/modules/stream-receive" "github.com/wundergraph/cosmo/router-tests/testenv" + "github.com/wundergraph/cosmo/router-tests/testutils" "github.com/wundergraph/cosmo/router/core" "github.com/wundergraph/cosmo/router/pkg/authentication" "github.com/wundergraph/cosmo/router/pkg/config" diff --git a/router-tests/observability/prometheus_test.go b/router-tests/observability/prometheus_test.go index 44c405542e..75184ffba4 100644 --- a/router-tests/observability/prometheus_test.go +++ b/router-tests/observability/prometheus_test.go @@ -5763,4 +5763,3 @@ func findCacheMetrics(mf []*io_prometheus_client.MetricFamily) []*io_prometheus_ func findEngineMetrics(mf []*io_prometheus_client.MetricFamily) []*io_prometheus_client.MetricFamily { return findMetricsWithPrefix(mf, "router_engine_") } - diff --git a/router-tests/telemetry/connection_metrics_test.go b/router-tests/telemetry/connection_metrics_test.go index 3d60186208..421c9a8664 100644 --- a/router-tests/telemetry/connection_metrics_test.go +++ b/router-tests/telemetry/connection_metrics_test.go @@ -6,8 +6,8 @@ import ( "time" "github.com/stretchr/testify/require" - "github.com/wundergraph/cosmo/router-tests/testutils" "github.com/wundergraph/cosmo/router-tests/testenv" + "github.com/wundergraph/cosmo/router-tests/testutils" "github.com/wundergraph/cosmo/router/core" "github.com/wundergraph/cosmo/router/pkg/config" "github.com/wundergraph/cosmo/router/pkg/otel" diff --git a/router-tests/telemetry/metrics_log_export_test.go b/router-tests/telemetry/metrics_log_export_test.go index cf23ece761..28ec8c484e 100644 --- a/router-tests/telemetry/metrics_log_export_test.go +++ b/router-tests/telemetry/metrics_log_export_test.go @@ -8,8 +8,8 @@ import ( "time" "github.com/stretchr/testify/require" - "github.com/wundergraph/cosmo/router-tests/testutils" "github.com/wundergraph/cosmo/router-tests/testenv" + "github.com/wundergraph/cosmo/router-tests/testutils" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.uber.org/zap/zapcore" diff --git a/router-tests/telemetry/stream_metrics_test.go b/router-tests/telemetry/stream_metrics_test.go index 8d3be2c076..131c57508a 100644 --- a/router-tests/telemetry/stream_metrics_test.go +++ b/router-tests/telemetry/stream_metrics_test.go @@ -10,9 +10,9 @@ import ( "github.com/hasura/go-graphql-client" "github.com/nats-io/nats.go" "github.com/stretchr/testify/require" - "github.com/wundergraph/cosmo/router-tests/testutils" "github.com/wundergraph/cosmo/router-tests/events" "github.com/wundergraph/cosmo/router-tests/testenv" + "github.com/wundergraph/cosmo/router-tests/testutils" "github.com/wundergraph/cosmo/router/pkg/config" otelattrs "github.com/wundergraph/cosmo/router/pkg/otel" "go.opentelemetry.io/otel/sdk/metric" diff --git a/router-tests/testenv/testenv.go b/router-tests/testenv/testenv.go index 81055f6b60..93da790b38 100644 --- a/router-tests/testenv/testenv.go +++ b/router-tests/testenv/testenv.go @@ -64,9 +64,9 @@ import ( "github.com/wundergraph/cosmo/router/pkg/controlplane/configpoller" "github.com/wundergraph/cosmo/router/pkg/logging" rmetric "github.com/wundergraph/cosmo/router/pkg/metric" - "github.com/wundergraph/cosmo/router/pkg/statistics" "github.com/wundergraph/cosmo/router/pkg/pubsub/datasource" pubsubNats "github.com/wundergraph/cosmo/router/pkg/pubsub/nats" + "github.com/wundergraph/cosmo/router/pkg/statistics" rtrace "github.com/wundergraph/cosmo/router/pkg/trace" ) diff --git a/router/pkg/mcpserver/server_test.go b/router/pkg/mcpserver/server_test.go index b5ecf39c00..3c18725402 100644 --- a/router/pkg/mcpserver/server_test.go +++ b/router/pkg/mcpserver/server_test.go @@ -161,7 +161,7 @@ func TestReload_PrefixModeAvoidsReservedNameCollision(t *testing.T) { tempDir := t.TempDir() writeOperationFiles(t, tempDir, map[string]string{ "GetOperationInfo.graphql": getOperationInfoOp, - "ListEmployees.graphql": listEmployeesOp, + "ListEmployees.graphql": listEmployeesOp, }) schemaDoc, report := astparser.ParseGraphqlDocumentString(testSchema) diff --git a/router/pkg/trace/meter.go b/router/pkg/trace/meter.go index 198f0bbc4f..185508c008 100644 --- a/router/pkg/trace/meter.go +++ b/router/pkg/trace/meter.go @@ -35,7 +35,6 @@ type ( } ) - func createExporter(log *zap.Logger, exp *ExporterConfig) (sdktrace.SpanExporter, error) { u, err := url.Parse(exp.Endpoint) if err != nil {