Skip to content

feat: switch from composition-go wrapper to cosmo wgc composition#1483

Merged
devsergiy merged 14 commits intomasterfrom
chore/remove-compose-wrapper
May 6, 2026
Merged

feat: switch from composition-go wrapper to cosmo wgc composition#1483
devsergiy merged 14 commits intomasterfrom
chore/remove-compose-wrapper

Conversation

@devsergiy
Copy link
Copy Markdown
Member

@devsergiy devsergiy commented May 1, 2026

Playground was fixed and moved from the engine to the execution.

Closes #1191
Fixes #860

@coderabbitai summary

@devsergiy devsergiy requested a review from a team as a code owner May 1, 2026 15:41
@devsergiy devsergiy requested review from StarpTech and endigma May 1, 2026 15:41
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 1, 2026

📝 Walkthrough

Walkthrough

Replaces runtime SDL polling with a config-file-driven federation gateway: introduces composed router configs and embeded SDLs, changes gateway constructors to accept prebuilt config bytes, removes poller/update machinery, updates tests/examples to use the new flow, renames handler packages, adds compose scripts, and updates dependencies.

Changes

Federation Config-Driven Initialization

Layer / File(s) Summary
Schema and Configuration Data
examples/federation/graph.yaml, execution/federationtesting/graph.yaml, execution/engine/testdata/config_factory_federation/{graph.yaml,account_sdl.graphql,product_sdl.graphql,review_sdl.graphql}
Added/updated federation graph YAMLs and SDLs defining three subgraphs (accounts, products, reviews) and routing URLs.
Composed Router Configuration
examples/federation/config.json, execution/engine/testdata/config_factory_federation/config.json, execution/federationtesting/config.json
Added precomputed router config JSON files containing datasource configurations, service SDL fragments, field mappings, fetch/subscription endpoints, and aggregated downstream schema.
Composition Scripts
examples/federation/compose.sh, execution/engine/testdata/config_factory_federation/compose.sh, execution/federationtesting/compose.sh
New scripts invoking wgc (via npx) to produce config.json from graph.yaml and atomically format with jq.
Engine Configuration Factory
execution/engine/config_factory_federation.go, execution/engine/config_factory_federation_test.go
Factory signature simplified to remove internal composition; BuildEngineConfiguration now consumes a prebuilt RouterConfig; tests load router config from testdata.
Gateway Initialization
examples/federation/gateway/gateway.go, execution/federationtesting/gateway/gateway.go, examples/federation/main.go
NewGateway now accepts serialized router config bytes and enableART, returns (*Gateway, error), unmarshals config, builds engine, creates execution engine and HTTP handler eagerly; removed lazy handler factory, readiness signaling, and dynamic UpdateDataSources.
Polling Infrastructure Removal
examples/federation/gateway/datasource_poller.go, execution/federationtesting/gateway/datasource_poller.go, execution/federationtesting/gateway/main.go
Deleted datasource SDL poller code and related types/methods; removed periodic _service { sdl } fetching, SDL caching, observer notifications, and fallback logic.
Testing Utilities and Embedded Assets
execution/federationtesting/util.go
Replaced runtime SDL loading with compile-time embedded bytes (RouterConfigJson, AccountSDL, ProductsSDL, ReviewsSDL); NewFederationSetup now returns (*FederationSetup, error) and accepts gateway factories that can return errors.
Integration and Unit Tests
execution/engine/federation_integration_test.go, execution/engine/federation_integration_static_test.go, execution/engine/skipped_fetch_test.go, execution/engine/execution_engine_test.go, execution/engine/config_factory_federation_test.go
Tests refactored to use embedded router/config JSON and the new config-driven gateway; removed polling timeouts and updated setup/gateway error handling.
Example Server Wiring & Scripts
examples/federation/main.go, examples/federation/start.sh
Example main() reads config.json at startup and constructs gateway via new NewGateway; start script builds module root binary.
Testdata Formatting & SDL edits
various execution/engine/testdata/..., examples/federation/...
Minor SDL formatting changes and small testdata JSON adjustments.

HTTP Handler Package Rename

Layer / File(s) Summary
Package Declaration Updates
examples/federation/gateway/httphandler/{handler.go,http.go,ws.go}, execution/federationtesting/gateway/httphandler/{handler.go,http.go,ws.go}
Renamed package from http to httphandler; exported handler constructors remain but import path changed.
Gateway Wiring
examples/federation/gateway/gateway.go, execution/federationtesting/gateway/gateway.go
Gateways now import and use httphandler.NewGraphqlHTTPHandler for direct HTTP handler construction.

Dependency and Tooling Updates

Layer / File(s) Summary
Module Dependencies
examples/federation/go.mod, execution/go.mod, examples/engine/go.mod, v2/go.mod
Bumped github.com/wundergraph/graphql-go-tools/v2 to v2.1.0, github.com/wundergraph/astjson to v1.1.0, adjusted direct/indirect module lists, and removed some composition/JS-engine indirect deps.
Release Configuration
release-please-config.json
Excluded go.work and go.work.sum from release-please component detection.

Engine Usage Example

Layer / File(s) Summary
New Example Program
examples/engine/go.mod, examples/engine/main.go
Added an examples binary demonstrating parsing/printing, normalization, validation, deterministic cache-key generation, planning with StaticDataSource, execution of synchronous plans, and an AST walker example.

Playground & Static Assets Simplification

Layer / File(s) Summary
Playground Page & Server
execution/playground/files/playground.html, execution/playground/playground.go, execution/playground/playground_test.go, v2/pkg/playground/...
Added an HTML/ESM GraphiQL v5 playground page and reduced template data to endpoints only; removed per-asset handlers and many v2 playground static files/fixtures; updated tests accordingly.

Minor Documentation

Layer / File(s) Summary
README Update
examples/federation/README.md
Changed heading from "Federation Demo" to "Federation example" and expanded getting-started instructions to include compose/regenerate steps.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Gateway
    participant Engine
    participant Accounts
    participant Products
    participant Reviews

    Client->>Gateway: HTTP GraphQL request (/query)
    Gateway->>Engine: Execute request using router config
    Engine->>Accounts: Send fetch (HTTP POST)
    Engine->>Products: Send fetch
    Engine->>Reviews: Send fetch
    Accounts-->>Engine: Return data
    Products-->>Engine: Return data
    Reviews-->>Engine: Return data
    Engine->>Gateway: Compose response
    Gateway->>Client: HTTP response (JSON)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR contains extensive out-of-scope changes: major federation architecture refactoring (removing datasource polling, redesigning gateway initialization), package reorganization (httphandler rename), and playground updates beyond #1191's GraphiQL v5 migration. Separate the composition-go replacement and federation refactoring into dedicated PRs; confirm playground changes align only with GraphiQL v5 migration requirements from issue #1191.
Linked Issues check ❓ Inconclusive The linked issue (#1191) targets GraphiQL v5 migration, while the PR primarily implements composition-go to wgc replacement and federation refactoring. The playground migration is present but secondary to the main composition change. Clarify whether the primary objective is the GraphiQL v5 migration (per #1191) or the composition-go replacement, as the PR heavily refactors federation architecture beyond the linked issue scope.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the primary change: replacing composition-go wrapper with cosmo wgc composition, which is the dominant theme across the changeset.
Description check ✅ Passed The PR description briefly explains the main change (playground fix and move from engine to execution) and references two related issues (#1191, #860), directly corresponding to the changeset which shows playground migration from v2/pkg/playground to execution/playground and GraphiQL upgrade from v3 to v5.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/remove-compose-wrapper

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
execution/engine/config_factory_federation.go (1)

127-137: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Reject nil or incomplete router configs up front.

This method now sits on the only config-building path, but it dereferences routerConfig.EngineConfig immediately. A failed/partial unmarshal or any zero-value caller input turns into a panic instead of a regular error.

Minimal guard
 func (f *FederationEngineConfigFactory) BuildEngineConfiguration(routerConfig *nodev1.RouterConfig) (Configuration, error) {
+	if routerConfig == nil || routerConfig.EngineConfig == nil {
+		return Configuration{}, errors.New("router config is missing engineConfig")
+	}
+
 	plannerConfiguration, err := f.createPlannerConfiguration(routerConfig)
 	if err != nil {
 		return Configuration{}, err
 	}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@execution/engine/config_factory_federation.go` around lines 127 - 137, In
BuildEngineConfiguration (type FederationEngineConfigFactory) add an early
validation guard that checks routerConfig is non-nil, routerConfig.EngineConfig
is non-nil, and routerConfig.EngineConfig.GraphqlSchema is non-empty before
dereferencing them; if any check fails return a descriptive error instead of
proceeding (so callers get a regular error rather than a panic when calling
createPlannerConfiguration, setting DefaultFlushIntervalMillis, or passing
schemaSDL to graphql.NewSchemaFromString).
🧹 Nitpick comments (3)
execution/engine/testdata/config_factory_federation/compose.sh (1)

1-7: ⚡ Quick win

Harden script execution (strict mode + script-relative paths).

Without strict mode, failures in compose/format steps can be missed; relative paths also break when invoked outside the script directory.

💡 Proposed hardening
+#!/usr/bin/env bash
+set -euo pipefail
+
+SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
+
 echo "Composing subgraphs"
-npx -y wgc@latest router compose -i graph.yaml -o config.json
+npx -y wgc@<PINNED_VERSION> router compose -i "$SCRIPT_DIR/graph.yaml" -o "$SCRIPT_DIR/config.json"

 echo "Formatting config"
-jq . config.json > config.json.tmp
-mv config.json.tmp config.json
+jq . "$SCRIPT_DIR/config.json" > "$SCRIPT_DIR/config.json.tmp"
+mv "$SCRIPT_DIR/config.json.tmp" "$SCRIPT_DIR/config.json"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@execution/engine/testdata/config_factory_federation/compose.sh` around lines
1 - 7, The compose.sh script lacks strict mode and uses plain relative paths, so
failures can be ignored and the script breaks when run from another directory;
update compose.sh to enable strict shell options (e.g., set -euo pipefail) at
the top and resolve file paths relative to the script directory (use the script
dir via dirname "$0" / BASH_SOURCE) before invoking npx -y wgc@latest router
compose -i graph.yaml -o config.json and the jq . config.json > config.json.tmp
mv config.json.tmp config.json steps so errors cause exit and files are
read/written relative to the script location.
execution/federationtesting/util.go (1)

50-58: ⚡ Quick win

Embed config.json instead of resolving it from os.Getwd().

This loader is still tied to the caller’s working directory and the "pkg" split heuristic, so the test fixture remains brittle outside the usual go test layout. Since this file already imports embed, embedding the config would make the tests hermetic and remove another copy of the path-resolution logic.

♻️ Suggested refactor
 import (
 	_ "embed"
 	"net/http/httptest"
 	"os"
 	"path/filepath"
 	"strings"
@@
 )
 
+//go:embed config.json
+var testingFederationConfig []byte
+
 func LoadTestingFederationConfig() ([]byte, error) {
-	wd, err := os.Getwd()
-	if err != nil {
-		return nil, err
-	}
-
-	absolutePath := filepath.Join(strings.Split(wd, "pkg")[0], federationTestingDirectoryRelativePath, "config.json")
-	return os.ReadFile(absolutePath)
+	return append([]byte(nil), testingFederationConfig...), nil
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@execution/federationtesting/util.go` around lines 50 - 58,
LoadTestingFederationConfig currently computes a path from os.Getwd() and the
"pkg" split which is brittle; instead embed the fixture at build time and return
the embedded bytes. Add a package-level embedding (e.g. using `//go:embed
config.json` into a byte slice or an embed.FS) and change
LoadTestingFederationConfig to read from that embedded variable (remove
os.Getwd(), filepath, strings logic and any dependency on
federationTestingDirectoryRelativePath) and return the embedded []byte and nil
error.
execution/federationtesting/compose.sh (1)

3-3: Pin the wgc CLI version to ensure reproducible fixture generation.

config.json is checked into the repository. Using wgc@latest means this fixture can silently change when the script is regenerated, breaking repository reproducibility. The wgc CLI does not guarantee stable output across releases due to potential breaking changes in the composition-router contract. Pin an explicit version and update it intentionally when regenerating the config.

This pattern appears in two locations:

  • execution/federationtesting/compose.sh
  • execution/engine/testdata/config_factory_federation/compose.sh
Suggested change
-npx -y wgc@latest router compose -i graph.yaml -o config.json
+npx -y wgc@0.114.2 router compose -i graph.yaml -o config.json
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@execution/federationtesting/compose.sh` at line 3, Replace the unstable
"wgc@latest" invocation with an explicit pinned CLI version in both compose
scripts so the generated config.json is reproducible; specifically, in
execution/federationtesting/compose.sh and
execution/engine/testdata/config_factory_federation/compose.sh update the npx
call that currently references "wgc@latest" to use a fixed version string (e.g.
wgc@X.Y.Z) and commit that version bump so future regenerations are intentional
and repeatable.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@examples/main.go`:
- Around line 558-575: ExampleExecuteOperation is a no-op because preparedPlan
is never initialized; initialize preparedPlan with a concrete plan.Plan (e.g., a
*plan.SynchronousResponsePlan) that contains a Response producing the expected
{"data":{"hello":"world"}} payload before the type switch, then call
resolver.ResolveGraphQLResponse as shown. Specifically, construct and assign a
*plan.SynchronousResponsePlan to preparedPlan (populating its Response field
with the minimal response object), keep using resolve.New(...) and
resolve.NewContext(...), and then the existing switch and
resolver.ResolveGraphQLResponse call will execute as intended.
- Around line 359-389: The ExampleGenerateCacheKey example currently constructs
empty ast.Documents (operationDocument, schemaDocument) then calls
normalizer.NormalizeNamedOperation without parsing inputs and without checking
the operationreport, leading to hashing an empty/invalid AST; fix by parsing the
operation and schema bytes into operationDocument and schemaDocument before
calling astnormalization.NormalizeNamedOperation, then check report.HasErrors()
and return or panic if true, propagate printer.Print errors as before, and only
call keyGen.Write(operationDocument.Input.Variables) after confirming the
Variables slice is non-nil/has length; update the same pattern in the other
cache-key example as well.

In `@execution/engine/federation_integration_test.go`:
- Around line 32-34: Replace the silent bytes.ReplaceAll behavior with an
explicit check that each placeholder exists in cfg before replacing: verify
bytes.Contains(cfg, []byte("http://accounts-url-placeholder")),
bytes.Contains(... "http://products-url-placeholder"), and bytes.Contains(...
"http://reviews-url-placeholder") and call t.Fatalf or require.FailNow with a
clear message if any are missing; then perform the replacement using the
existing bytes.ReplaceAll lines that reference cfg and
setup.AccountsUpstreamServer.URL / setup.ProductsUpstreamServer.URL /
setup.ReviewsUpstreamServer.URL so the test fails fast with a clear diagnostic
when a placeholder is absent.

In `@execution/engine/testdata/config_factory_federation/compose.sh`:
- Line 3: The shell command using "npx -y wgc@latest router compose -i
graph.yaml -o config.json" makes fixture generation non-deterministic; update
that invocation to pin a stable wgc version (for example change "wgc@latest" to
"wgc@1.x.x" or a concrete release like "wgc@1.4.0") in this script and the other
similar script so the generated config.json is reproducible across runs.

In `@execution/federationtesting/compose.sh`:
- Around line 1-7: Add a shebang and enable strict mode at the top of compose.sh
so failures in the router compose (npx -y wgc@latest router compose -i
graph.yaml -o config.json) or the jq formatting step abort the script instead of
letting mv overwrite config.json; specifically, insert a POSIX/ bash shebang and
set -euo pipefail (and optionally IFS) before the first echo so any non-zero
exit or pipe failure stops execution.

In `@execution/federationtesting/gateway/gateway.go`:
- Around line 18-29: ServeHTTP currently reparses the config and recreates the
planner/engine/handler on every request; move that expensive initialization into
NewGateway so the execution engine and its plan cache are built once. In
practice: call NewExecutionEngine (and any planner/schema/datasource
initialization) inside NewGateway, store the resulting engine/planner/handler as
fields on the Gateway struct (add fields if missing), and update ServeHTTP to
reuse those stored instances instead of reinitializing them per request; ensure
any error handling during initialization is performed in NewGateway and
ServeHTTP only uses the ready-to-serve objects.
- Around line 40-43: The protojson.Unmarshal failure leaves rc as a zero-value
RouterConfig and allows execution to continue into BuildEngineConfiguration
where dereferencing rc.EngineConfig can panic; update the error path in the
block that calls protojson.Unmarshal(g.configFileContent, &rc) to stop execution
immediately (return an appropriate error/HTTP response) after logging the
failure and include the error details. Specifically, in the function containing
the protojson.Unmarshal call, detect the error from protojson.Unmarshal, log it
via g.logger (including the error), and then return from the handler/function
(do not fall through to BuildEngineConfiguration or any use of rc.EngineConfig).

---

Outside diff comments:
In `@execution/engine/config_factory_federation.go`:
- Around line 127-137: In BuildEngineConfiguration (type
FederationEngineConfigFactory) add an early validation guard that checks
routerConfig is non-nil, routerConfig.EngineConfig is non-nil, and
routerConfig.EngineConfig.GraphqlSchema is non-empty before dereferencing them;
if any check fails return a descriptive error instead of proceeding (so callers
get a regular error rather than a panic when calling createPlannerConfiguration,
setting DefaultFlushIntervalMillis, or passing schemaSDL to
graphql.NewSchemaFromString).

---

Nitpick comments:
In `@execution/engine/testdata/config_factory_federation/compose.sh`:
- Around line 1-7: The compose.sh script lacks strict mode and uses plain
relative paths, so failures can be ignored and the script breaks when run from
another directory; update compose.sh to enable strict shell options (e.g., set
-euo pipefail) at the top and resolve file paths relative to the script
directory (use the script dir via dirname "$0" / BASH_SOURCE) before invoking
npx -y wgc@latest router compose -i graph.yaml -o config.json and the jq .
config.json > config.json.tmp mv config.json.tmp config.json steps so errors
cause exit and files are read/written relative to the script location.

In `@execution/federationtesting/compose.sh`:
- Line 3: Replace the unstable "wgc@latest" invocation with an explicit pinned
CLI version in both compose scripts so the generated config.json is
reproducible; specifically, in execution/federationtesting/compose.sh and
execution/engine/testdata/config_factory_federation/compose.sh update the npx
call that currently references "wgc@latest" to use a fixed version string (e.g.
wgc@X.Y.Z) and commit that version bump so future regenerations are intentional
and repeatable.

In `@execution/federationtesting/util.go`:
- Around line 50-58: LoadTestingFederationConfig currently computes a path from
os.Getwd() and the "pkg" split which is brittle; instead embed the fixture at
build time and return the embedded bytes. Add a package-level embedding (e.g.
using `//go:embed config.json` into a byte slice or an embed.FS) and change
LoadTestingFederationConfig to read from that embedded variable (remove
os.Getwd(), filepath, strings logic and any dependency on
federationTestingDirectoryRelativePath) and return the embedded []byte and nil
error.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 32d4146a-d374-4d4b-a860-92f5f41c440c

📥 Commits

Reviewing files that changed from the base of the PR and between cc65e4e and eac351c.

⛔ Files ignored due to path filters (11)
  • examples/federation/accounts/graph/generated/federation.go is excluded by !**/generated/**
  • examples/federation/accounts/graph/generated/generated.go is excluded by !**/generated/**
  • examples/federation/go.sum is excluded by !**/*.sum
  • examples/federation/products/graph/generated/federation.go is excluded by !**/generated/**
  • examples/federation/products/graph/generated/generated.go is excluded by !**/generated/**
  • examples/federation/reviews/graph/generated/federation.go is excluded by !**/generated/**
  • examples/federation/reviews/graph/generated/generated.go is excluded by !**/generated/**
  • examples/go.sum is excluded by !**/*.sum
  • execution/go.sum is excluded by !**/*.sum
  • go.work is excluded by !**/*.work
  • go.work.sum is excluded by !**/*.sum
📒 Files selected for processing (59)
  • examples/federation/README.md
  • examples/federation/accounts/gqlgen.yml
  • examples/federation/accounts/graph/entity.resolvers.go
  • examples/federation/accounts/graph/handler.go
  • examples/federation/accounts/graph/model/models_gen.go
  • examples/federation/accounts/graph/resolver.go
  • examples/federation/accounts/graph/schema.resolvers.go
  • examples/federation/accounts/server.go
  • examples/federation/gateway/datasource_poller.go
  • examples/federation/gateway/gateway.go
  • examples/federation/gateway/http/http.go
  • examples/federation/gateway/http/ws.go
  • examples/federation/gateway/main.go
  • examples/federation/go.mod
  • examples/federation/products/gqlgen.yml
  • examples/federation/products/graph/entity.resolvers.go
  • examples/federation/products/graph/handler.go
  • examples/federation/products/graph/model/models_gen.go
  • examples/federation/products/graph/products.go
  • examples/federation/products/graph/resolver.go
  • examples/federation/products/graph/schema.resolvers.go
  • examples/federation/products/graph/variables.go
  • examples/federation/products/server.go
  • examples/federation/reviews/gqlgen.yml
  • examples/federation/reviews/graph/entity.resolvers.go
  • examples/federation/reviews/graph/handler.go
  • examples/federation/reviews/graph/model/models_gen.go
  • examples/federation/reviews/graph/resolver.go
  • examples/federation/reviews/graph/reviews.go
  • examples/federation/reviews/server.go
  • examples/federation/start.sh
  • examples/go.mod
  • examples/main.go
  • execution/engine/config_factory_federation.go
  • execution/engine/config_factory_federation_test.go
  • execution/engine/federation_integration_test.go
  • execution/engine/skipped_fetch_test.go
  • execution/engine/testdata/complex_nesting_query_with_art.json
  • execution/engine/testdata/config_factory_federation/account_sdl.graphql
  • execution/engine/testdata/config_factory_federation/compose.sh
  • execution/engine/testdata/config_factory_federation/config.json
  • execution/engine/testdata/config_factory_federation/graph.yaml
  • execution/engine/testdata/config_factory_federation/product_sdl.graphql
  • execution/engine/testdata/config_factory_federation/review_sdl.graphql
  • execution/federationtesting/accounts/graph/schema.graphqls
  • execution/federationtesting/compose.sh
  • execution/federationtesting/config.json
  • execution/federationtesting/gateway/datasource_poller.go
  • execution/federationtesting/gateway/gateway.go
  • execution/federationtesting/gateway/http/handler.go
  • execution/federationtesting/gateway/httphandler/handler.go
  • execution/federationtesting/gateway/httphandler/http.go
  • execution/federationtesting/gateway/httphandler/ws.go
  • execution/federationtesting/gateway/main.go
  • execution/federationtesting/graph.yaml
  • execution/federationtesting/reviews/graph/schema.graphqls
  • execution/federationtesting/util.go
  • execution/go.mod
  • release-please-config.json
💤 Files with no reviewable changes (35)
  • examples/federation/README.md
  • examples/federation/products/graph/products.go
  • examples/federation/products/graph/resolver.go
  • examples/federation/products/server.go
  • examples/federation/products/gqlgen.yml
  • examples/federation/accounts/gqlgen.yml
  • examples/federation/accounts/graph/resolver.go
  • examples/federation/go.mod
  • examples/federation/accounts/graph/schema.resolvers.go
  • examples/federation/reviews/gqlgen.yml
  • examples/federation/start.sh
  • examples/federation/reviews/server.go
  • examples/federation/reviews/graph/handler.go
  • examples/federation/gateway/http/http.go
  • examples/federation/accounts/graph/handler.go
  • examples/federation/reviews/graph/reviews.go
  • examples/federation/products/graph/schema.resolvers.go
  • execution/engine/testdata/config_factory_federation/product_sdl.graphql
  • examples/federation/accounts/graph/entity.resolvers.go
  • examples/federation/products/graph/model/models_gen.go
  • examples/federation/products/graph/handler.go
  • examples/federation/reviews/graph/model/models_gen.go
  • examples/federation/gateway/datasource_poller.go
  • execution/federationtesting/gateway/http/handler.go
  • examples/federation/gateway/http/ws.go
  • examples/federation/gateway/main.go
  • examples/federation/reviews/graph/resolver.go
  • examples/federation/accounts/graph/model/models_gen.go
  • examples/federation/products/graph/variables.go
  • examples/federation/reviews/graph/entity.resolvers.go
  • examples/federation/accounts/server.go
  • execution/federationtesting/gateway/main.go
  • execution/federationtesting/gateway/datasource_poller.go
  • examples/federation/gateway/gateway.go
  • examples/federation/products/graph/entity.resolvers.go

Comment thread examples/engine/main.go
Comment thread examples/engine/main.go
Comment thread execution/engine/federation_integration_test.go
Comment thread execution/engine/testdata/config_factory_federation/compose.sh
Comment thread execution/federationtesting/compose.sh
Comment thread execution/federationtesting/gateway/gateway.go Outdated
Comment thread execution/federationtesting/gateway/gateway.go
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@execution/federationtesting/gateway/gateway.go`:
- Around line 18-53: Change NewGateway to return (*Gateway, error) and stop
calling logger.Fatal; instead propagate errors from protojson.Unmarshal,
engine.NewFederationEngineConfigFactory(...).BuildEngineConfiguration, and
engine.NewExecutionEngine by returning a wrapped error (include context like
"unmarshal config", "build engine config", "create execution engine") so callers
can handle failures; keep building ctx, engineConfigFactory, upgrader and
handler only on success and update any callers (e.g., tests using
httptest.NewServer) to handle the (gateway, err) return.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8a852fc8-7279-4d35-b5e2-45e9c14611d8

📥 Commits

Reviewing files that changed from the base of the PR and between eac351c and c8cea6f.

📒 Files selected for processing (5)
  • execution/engine/testdata/config_factory_federation/compose.sh
  • execution/engine/testdata/config_factory_federation/config.json
  • execution/federationtesting/compose.sh
  • execution/federationtesting/config.json
  • execution/federationtesting/gateway/gateway.go
✅ Files skipped from review due to trivial changes (1)
  • execution/engine/testdata/config_factory_federation/compose.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • execution/federationtesting/compose.sh

Comment thread execution/federationtesting/gateway/gateway.go Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
execution/federationtesting/util.go (1)

27-35: ⚡ Quick win

Avoid exporting shared mutable embedded fixtures.

These globals are now process-wide writable []bytes. The removed loader returned a fresh buffer on each call, so a test mutating one of these slices would not leak state before, but it can now poison later tests. Prefer embedding as string or exposing accessors that return a cloned []byte to preserve the old copy semantics.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@execution/federationtesting/util.go` around lines 27 - 35, The embedded
variables RouterConfigJson, AccountSDL, ProductsSDL and ReviewsSDL are exported
mutable []byte slices; change them to immutable strings (use //go:embed into
string types) or keep them unexported and add accessor functions (e.g.,
GetRouterConfigJSON(), GetAccountSDL(), GetProductsSDL(), GetReviewsSDL()) that
return a fresh copy (for []byte: return append([]byte(nil), embeddedVar...)) so
tests cannot mutate shared process-wide state; update usages to call the new
accessors or read the string versions accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@execution/federationtesting/util.go`:
- Around line 27-35: The embedded variables RouterConfigJson, AccountSDL,
ProductsSDL and ReviewsSDL are exported mutable []byte slices; change them to
immutable strings (use //go:embed into string types) or keep them unexported and
add accessor functions (e.g., GetRouterConfigJSON(), GetAccountSDL(),
GetProductsSDL(), GetReviewsSDL()) that return a fresh copy (for []byte: return
append([]byte(nil), embeddedVar...)) so tests cannot mutate shared process-wide
state; update usages to call the new accessors or read the string versions
accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 06355ff0-1e62-4fc6-a509-430d980ffbd6

📥 Commits

Reviewing files that changed from the base of the PR and between c8cea6f and 0ccdd2c.

⛔ Files ignored due to path filters (1)
  • go.work.sum is excluded by !**/*.sum
📒 Files selected for processing (3)
  • execution/engine/execution_engine_test.go
  • execution/engine/federation_integration_test.go
  • execution/federationtesting/util.go
✅ Files skipped from review due to trivial changes (1)
  • execution/engine/federation_integration_test.go

@devsergiy
Copy link
Copy Markdown
Member Author

@claude review

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, comment @claude review on this pull request to trigger a review.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@execution/federationtesting/util.go`:
- Around line 50-53: When addGateway[0](setup) fails, the three upstream test
servers created earlier are not closed, leaking resources; update the function
that calls addGateway[0](setup) so that on error it calls Close() (or equivalent
shutdown) on each upstream test server (the three servers created just before
the call) before returning the error, e.g. defer or explicit close logic tied to
the variables that hold those servers so they are always closed if addGateway
returns an error.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c37b9e40-c2d0-4002-adf0-310a2710df3a

📥 Commits

Reviewing files that changed from the base of the PR and between 0ccdd2c and d6a15ce.

📒 Files selected for processing (4)
  • execution/engine/federation_integration_static_test.go
  • execution/engine/federation_integration_test.go
  • execution/federationtesting/gateway/gateway.go
  • execution/federationtesting/util.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • execution/engine/federation_integration_test.go
  • execution/federationtesting/gateway/gateway.go

Comment thread execution/federationtesting/util.go
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@execution/federationtesting/util.go`:
- Around line 39-51: The upstream httptest servers
(setup.AccountsUpstreamServer, setup.ProductsUpstreamServer,
setup.ReviewsUpstreamServer) must be initialized before calling the addGateway
callback because addGateway[0](setup) expects those .URL fields to be set; move
the three httptest.NewServer(...) assignments so they occur before the
addGateway invocation and then pass the populated setup into addGateway
(ensuring FederationSetup.GatewayServer is still set from the callback result);
update any error handling around gw, err from addGateway[0](setup) accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5d873da8-0d66-4080-a14e-5a56d1fab6f0

📥 Commits

Reviewing files that changed from the base of the PR and between d6a15ce and 8ee3575.

📒 Files selected for processing (1)
  • execution/federationtesting/util.go

Comment thread execution/federationtesting/util.go Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
examples/federation/main.go (1)

28-37: ⚠️ Potential issue | 🔴 Critical

Remove the unused upgrader variable or integrate it into NewGateway.

Lines 35-37 configure a websocket upgrader that is never used. Go treats unused local variables as a compile error, so this example fails to build.

Either remove the unused setup:

  • Delete the upgrader declaration, header mutations, and the github.com/gobwas/ws import if no longer needed.

Or, if the Sec-Websocket-Protocol header is still required, pass the upgrader configuration into gateway.NewGateway(...) instead of leaving it as dead code.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/federation/main.go` around lines 28 - 37, The local variable
upgrader (ws.DefaultHTTPUpgrader) is configured (Header.Add
"Sec-Websocket-Protocol") but never used, causing a compile error; either remove
the upgrader declaration and the Header mutation and delete the unused
github.com/gobwas/ws import, or thread this config into gateway.NewGateway by
adding an argument to accept an upgrader or options and pass the configured
upgrader there (referencing upgrader, ws.DefaultHTTPUpgrader,
Sec-Websocket-Protocol, and NewGateway in your change).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@examples/federation/gateway/gateway.go`:
- Around line 45-49: The WebSocket upgrader (upgrader variable of type
ws.HTTPUpgrader) is created with an empty Header, breaking clients that
negotiate the "graphql-ws" subprotocol; update the upgrader.Header to include
the Sec-Websocket-Protocol header with the "graphql-ws" value (e.g., set
Header["Sec-Websocket-Protocol"] = []string{"graphql-ws"} or use Header.Add)
before passing upgrader into httphandler.NewGraphqlHTTPHandler so subscription
clients can negotiate the protocol.

---

Outside diff comments:
In `@examples/federation/main.go`:
- Around line 28-37: The local variable upgrader (ws.DefaultHTTPUpgrader) is
configured (Header.Add "Sec-Websocket-Protocol") but never used, causing a
compile error; either remove the upgrader declaration and the Header mutation
and delete the unused github.com/gobwas/ws import, or thread this config into
gateway.NewGateway by adding an argument to accept an upgrader or options and
pass the configured upgrader there (referencing upgrader,
ws.DefaultHTTPUpgrader, Sec-Websocket-Protocol, and NewGateway in your change).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d6351736-b962-44b1-b671-b8e278884e8a

📥 Commits

Reviewing files that changed from the base of the PR and between d6a15ce and ad32233.

⛔ Files ignored due to path filters (4)
  • examples/engine/go.sum is excluded by !**/*.sum
  • examples/federation/go.sum is excluded by !**/*.sum
  • go.work is excluded by !**/*.work
  • go.work.sum is excluded by !**/*.sum
📒 Files selected for processing (13)
  • examples/engine/go.mod
  • examples/engine/main.go
  • examples/federation/README.md
  • examples/federation/compose.sh
  • examples/federation/config.json
  • examples/federation/gateway/gateway.go
  • examples/federation/gateway/httphandler/handler.go
  • examples/federation/gateway/httphandler/http.go
  • examples/federation/gateway/httphandler/ws.go
  • examples/federation/go.mod
  • examples/federation/graph.yaml
  • examples/federation/main.go
  • examples/federation/start.sh
✅ Files skipped from review due to trivial changes (5)
  • examples/federation/compose.sh
  • examples/federation/gateway/httphandler/ws.go
  • examples/federation/graph.yaml
  • examples/federation/gateway/httphandler/http.go
  • examples/federation/README.md

Comment thread examples/federation/gateway/gateway.go Outdated
Comment thread execution/engine/testdata/config_factory_federation/compose.sh
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
examples/federation/main.go (1)

59-63: Consider resolving config.json relative to the executable or embedding it.

The relative path os.ReadFile("config.json") is resolved against the process working directory. While the documented launch method (./start.sh from examples/federation/) works correctly, this pattern is fragile if the example is launched from elsewhere (e.g., go run examples/federation/main.go from the repository root). For better robustness, resolve the file path relative to the executable location or embed it with the binary.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/federation/main.go` around lines 59 - 63, The code currently reads
config.json with os.ReadFile("config.json") (configFileContent, err :=
os.ReadFile("config.json")), which relies on the current working directory;
change this to resolve the path relative to the running binary or embed the
file. Option A: use os.Executable() and filepath.Dir to build the absolute path
(e.g., exePath, _ := os.Executable(); cfgPath :=
filepath.Join(filepath.Dir(exePath), "config.json"); configFileContent, err :=
os.ReadFile(cfgPath)). Option B: use the embed package (declare //go:embed
config.json and a variable) and read the embedded bytes instead of calling
os.ReadFile. Apply the chosen change where configFileContent and the os.ReadFile
call appear.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@examples/federation/README.md`:
- Line 14: Update the sentence "Services defines a few queries and
subscriptions." in the README so the subject and verb agree: change "Services
defines" to "Services define" (i.e., edit the string literal in the
examples/federation/README.md to read "Services define a few queries and
subscriptions.").
- Around line 26-29: Step 3 is ambiguous about how to run compose.sh; update the
README step to show an explicit command and working directory, e.g. instruct
users to run the script from the repository root with `./compose.sh` (or `bash
compose.sh`) and, if needed, ensure it is executable (`chmod +x compose.sh`);
reference the Step 3 bullet and the compose.sh script name so the change is easy
to locate.

---

Nitpick comments:
In `@examples/federation/main.go`:
- Around line 59-63: The code currently reads config.json with
os.ReadFile("config.json") (configFileContent, err :=
os.ReadFile("config.json")), which relies on the current working directory;
change this to resolve the path relative to the running binary or embed the
file. Option A: use os.Executable() and filepath.Dir to build the absolute path
(e.g., exePath, _ := os.Executable(); cfgPath :=
filepath.Join(filepath.Dir(exePath), "config.json"); configFileContent, err :=
os.ReadFile(cfgPath)). Option B: use the embed package (declare //go:embed
config.json and a variable) and read the embedded bytes instead of calling
os.ReadFile. Apply the chosen change where configFileContent and the os.ReadFile
call appear.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 593d3c66-0c4f-4302-a60f-db9b1313236d

📥 Commits

Reviewing files that changed from the base of the PR and between ad32233 and e1f64d6.

⛔ Files ignored due to path filters (4)
  • examples/federation/go.sum is excluded by !**/*.sum
  • go.work.sum is excluded by !**/*.sum
  • v2/pkg/playground/files/favicon.png is excluded by !**/*.png
  • v2/pkg/playground/files/logo.png is excluded by !**/*.png
📒 Files selected for processing (12)
  • examples/federation/README.md
  • examples/federation/gateway/gateway.go
  • examples/federation/go.mod
  • examples/federation/main.go
  • execution/playground/files/playground.html
  • execution/playground/playground.go
  • execution/playground/playground_test.go
  • v2/go.mod
  • v2/pkg/playground/files/playground.css
  • v2/pkg/playground/files/playground.html
  • v2/pkg/playground/files/playground.js
  • v2/pkg/playground/fixtures/handlers.golden
💤 Files with no reviewable changes (3)
  • v2/pkg/playground/fixtures/handlers.golden
  • v2/pkg/playground/files/playground.css
  • v2/pkg/playground/files/playground.html
✅ Files skipped from review due to trivial changes (1)
  • execution/playground/files/playground.html
🚧 Files skipped from review as they are similar to previous changes (5)
  • v2/go.mod
  • examples/federation/gateway/gateway.go
  • execution/playground/playground.go
  • execution/playground/playground_test.go
  • examples/federation/go.mod

Comment thread examples/federation/README.md
Comment thread examples/federation/README.md
Comment thread execution/playground/playground.go
Comment thread execution/playground/files/playground.html
@devsergiy devsergiy merged commit 34d07fc into master May 6, 2026
11 checks passed
@devsergiy devsergiy deleted the chore/remove-compose-wrapper branch May 6, 2026 10:08
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.

Popover does not disappear in Playground UI after latest Chrome update

2 participants