Skip to content

Conversation

@SkArchon
Copy link
Contributor

@SkArchon SkArchon commented Dec 8, 2025

Right now we pass in all subgraph errors to the engine loader hook OnFinished function (See Here), which means that whenever any subgraph has an error, we will pass that/those errors to the OnFinished function for an irrelevant Subgraph, which leads to the following

  • Incorrect status information attached to that subgraph's Engine Loader span (See Here)
  • Access logs incorrect status used (See Here)

Checklist

  • I have discussed my proposed changes in an issue and have received approval to proceed.
  • I have followed the coding standards of the project.
  • Tests or benchmarks have been added or updated.

Summary by CodeRabbit

  • Refactor

    • Error reporting now attributes failures to specific data sources, yielding clearer, source-specific error messages and deterministic ordering when combined.
    • Aggregated error output is suppressed when no errors are present, reducing noise.
  • Tests

    • Test suites updated to validate per-source error attribution, message details, ordering, and context initialization across authorization, rate-limit, and fetch-failure scenarios.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 8, 2025

Walkthrough

Refactors Context to track subgraph errors as a map keyed by data source, changes appendSubgraphErrors to accept DataSourceInfo and store per-source joined errors, makes SubgraphErrors() return nil when empty or a deterministic joined error, updates loader/resolvable call sites and many tests to use the new context/error shape.

Changes

Cohort / File(s) Summary
Context & error model
v2/pkg/engine/resolve/context.go
Replace subgraphErrors error with subgraphErrors map[string]error; initialize in NewContext; change appendSubgraphErrors to accept ds DataSourceInfo and store per-source joined errors; SubgraphErrors() returns nil when empty and joins errors deterministically; clone/Free copy/clear the map; added sort import.
Loader & ResponseInfo
v2/pkg/engine/resolve/loader.go
newResponseInfo now accepts subgraphErrors map[string]error and selects Err by res.ds.Name; call sites updated to pass DataSourceInfo-aware errors; invocations of appendSubgraphErrors updated to include ds first.
Resolvable usages
v2/pkg/engine/resolve/resolvable.go
Updated call sites to ctx.appendSubgraphErrors(ds, err, subgraphError) to associate errors with the appropriate data source; signature changed accordingly.
Tests — authorization
v2/pkg/engine/resolve/authorization_test.go
Tests switched to NewContext(context.Background()) and per-subgraph error checks via resolveCtx.subgraphErrors[expectedSubgraph]; assertions adjusted to validate per-source error entries and lengths.
Tests — loader & hooks
v2/pkg/engine/resolve/loader_hooks_test.go, v2/pkg/engine/resolve/loader_test.go
Test context instantiation changed to NewContext(...) with subsequent field assignments; tests updated for new appendSubgraphErrors signature and per-subgraph error plumbing.
Tests — extensions, ratelimit, federation, resolve
v2/pkg/engine/resolve/extensions_test.go, v2/pkg/engine/resolve/ratelimit_test.go, v2/pkg/engine/resolve/resolve_federation_test.go, v2/pkg/engine/resolve/resolve_test.go
Replace inline Context literals with NewContext(...), set fields (authorizer, rateLimiter, tracing, etc.) via assignments, and adapt assertions to reference subgraphErrors map entries where applicable.
Misc / Manifest
go.mod
Module file present in diff context; no additional public API changes beyond Context field and method behavior described above.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Review all updated call sites to ensure the correct DataSourceInfo is supplied to appendSubgraphErrors.
  • Verify SubgraphErrors() deterministic ordering and nil-when-empty behavior.
  • Inspect clone/Free semantics for proper deep-copying/clearing of subgraphErrors to avoid shared-state or race issues.
  • Run the updated tests, focusing on cases aggregating multiple errors per subgraph.

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: group subgraph errors by subgraph name' directly matches the PR's primary objective to fix errors being grouped incorrectly by implementing per-subgraph error tracking.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch milinda/eng-8637-error-message-attached-to-multiple-unrelated-subgraphs

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 75ea694 and 42024d2.

📒 Files selected for processing (1)
  • v2/pkg/engine/resolve/context.go (5 hunks)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: SkArchon
Repo: wundergraph/graphql-go-tools PR: 1351
File: v2/pkg/engine/resolve/context.go:160-162
Timestamp: 2025-12-09T15:30:57.980Z
Learning: In the graphql-go-tools repository, Context instances in v2/pkg/engine/resolve must be created using NewContext() rather than Context{} literals. The codebase intentionally avoids defensive nil checks for Context.subgraphErrors to enforce this pattern and fail fast on improper usage. Do not suggest adding defensive nil checks for map fields in Context that are initialized by NewContext().
📚 Learning: 2025-12-09T15:30:57.980Z
Learnt from: SkArchon
Repo: wundergraph/graphql-go-tools PR: 1351
File: v2/pkg/engine/resolve/context.go:160-162
Timestamp: 2025-12-09T15:30:57.980Z
Learning: Ensure all Context instances in v2/pkg/engine/resolve are created with NewContext() instead of Context{} literals. The codebase avoids defensive nil checks for Context.subgraphErrors to enforce correct usage and fail fast on misuse. Do not add defensive nil checks for map fields in Context that are initialized by NewContext().

Applied to files:

  • v2/pkg/engine/resolve/context.go
📚 Learning: 2025-10-16T13:05:19.838Z
Learnt from: Noroth
Repo: wundergraph/graphql-go-tools PR: 1323
File: v2/pkg/engine/datasource/grpc_datasource/compiler.go:683-702
Timestamp: 2025-10-16T13:05:19.838Z
Learning: In GraphQL field resolver context resolution (v2/pkg/engine/datasource/grpc_datasource/compiler.go), when traversing paths in resolveContextDataForPath, the code can safely assume that intermediate path segments will only be messages or lists, never scalars. This is because field resolvers are only defined on GraphQL object types, not scalar types, so the parent function must return either a message or a list. This invariant is enforced by the GraphQL type system design.

Applied to files:

  • v2/pkg/engine/resolve/context.go
📚 Learning: 2025-07-02T15:28:02.122Z
Learnt from: SkArchon
Repo: wundergraph/graphql-go-tools PR: 1203
File: v2/pkg/engine/resolve/loader.go:63-67
Timestamp: 2025-07-02T15:28:02.122Z
Learning: In the graphql-go-tools codebase, result structs are consistently initialized with non-nil bytes.Buffer instances, making additional nil checks for res.out unnecessary defensive programming.

Applied to files:

  • v2/pkg/engine/resolve/context.go
📚 Learning: 2025-08-08T09:43:07.433Z
Learnt from: Noroth
Repo: wundergraph/graphql-go-tools PR: 1262
File: v2/pkg/engine/datasource/grpc_datasource/json_builder.go:0-0
Timestamp: 2025-08-08T09:43:07.433Z
Learning: In v2/pkg/engine/datasource/grpc_datasource/json_builder.go, mergeEntities intentionally uses the loop index when calling indexMap.getResultIndex because the index map is type-aware, making per-type counters unnecessary under the current assumptions. Avoid suggesting per-type ordinal counters for this path in future reviews.

Applied to files:

  • v2/pkg/engine/resolve/context.go
📚 Learning: 2025-09-19T14:50:19.528Z
Learnt from: endigma
Repo: wundergraph/graphql-go-tools PR: 1298
File: v2/pkg/engine/resolve/resolve.go:999-1011
Timestamp: 2025-09-19T14:50:19.528Z
Learning: In the graphql-go-tools resolver, when handling backpressure for async unsubscribe operations, the team prefers using individual goroutines over bounded deferrer implementations. The rationale is that bounded implementations can also overflow, and the preferred solution for overload is scaling the deployment rather than internal buffering. The current approach prevents deadlocks at the cost of goroutine creation, which is an acceptable tradeoff.

Applied to files:

  • v2/pkg/engine/resolve/context.go
📚 Learning: 2025-11-19T09:42:17.644Z
Learnt from: Noroth
Repo: wundergraph/graphql-go-tools PR: 1341
File: v2/pkg/engine/datasource/grpc_datasource/execution_plan_visitor_federation.go:406-429
Timestamp: 2025-11-19T09:42:17.644Z
Learning: In the wundergraph/graphql-go-tools gRPC datasource implementation (v2/pkg/engine/datasource/grpc_datasource), field resolvers must have arguments. The system does not currently support defining field resolvers without arguments. This invariant ensures that the `parentCallID` increment in `enterFieldResolver` is always matched by a decrement in `LeaveField` (which checks `r.operation.FieldHasArguments(ref)`).

Applied to files:

  • v2/pkg/engine/resolve/context.go
📚 Learning: 2025-07-28T12:44:56.405Z
Learnt from: Noroth
Repo: wundergraph/graphql-go-tools PR: 1246
File: v2/pkg/engine/datasource/grpc_datasource/execution_plan_visitor.go:457-457
Timestamp: 2025-07-28T12:44:56.405Z
Learning: In the graphql-go-tools gRPC datasource, only non-null lists use protobuf's repeated field syntax directly. For nullable or nested lists, wrapper types are used because protobuf repeated fields cannot be nullable. The TypeIsNonNullList check ensures only appropriate list types are marked as repeated in the protobuf message structure.

Applied to files:

  • v2/pkg/engine/resolve/context.go
🧬 Code graph analysis (1)
v2/pkg/engine/resolve/context.go (1)
v2/pkg/engine/resolve/loader.go (1)
  • DataSourceInfo (45-48)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build and test (go 1.25 / ubuntu-latest)
  • GitHub Check: Build and test (go 1.25 / windows-latest)
  • GitHub Check: Build and test (go 1.25 / ubuntu-latest)
🔇 Additional comments (7)
v2/pkg/engine/resolve/context.go (7)

9-9: LGTM!

The sort import is necessary for the deterministic error ordering in SubgraphErrors(), ensuring consistent output across calls.


17-17: Good documentation addition!

This comment addresses the past review feedback and clearly communicates the requirement to use NewContext() instead of direct initialization. This helps prevent nil map panics at runtime.


36-36: Core fix for subgraph error attribution!

The change from error to map[string]error is the fundamental fix that enables per-subgraph error tracking. This directly addresses the bug where errors from one subgraph were incorrectly attributed to unrelated subgraphs.


142-159: Well-implemented deterministic error aggregation!

The implementation correctly:

  • Returns nil when there are no errors (clean empty state)
  • Sorts keys to ensure deterministic, testable output across all calls
  • Joins errors in a predictable order using errors.Join

The sorting overhead is negligible since this is typically called once per request at completion.


161-163: Correct per-subgraph error accumulation!

The implementation properly:

  • Associates errors with specific data sources via ds.Name
  • Accumulates multiple errors for the same subgraph using errors.Join
  • Handles edge cases correctly (nil existing errors, empty new errors)

The absence of defensive nil checks follows the established pattern requiring NewContext() usage. Based on learnings, this enforces proper API usage and fails fast on violations.


175-176: Proper map initialization!

The subgraphErrors map is correctly initialized in NewContext(), ensuring safe usage in appendSubgraphErrors() without defensive nil checks. This enforces the requirement that all Context instances must be created via NewContext().


211-216: Proper map cloning with defensive check!

The clone() method correctly:

  • Uses a defensive nil check (appropriate for clone() unlike appendSubgraphErrors())
  • Creates a new map to prevent sharing state between clones
  • Copies all entries from the source map

The defensive nil check is appropriate here since clone() may be called on contexts from various code paths or during migrations.


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

Copy link
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: 0

🧹 Nitpick comments (2)
v2/pkg/engine/resolve/context.go (2)

9-9: Per-subgraph error aggregation and deterministic ordering look correct; consider a tiny guard for nil-only error slices

The shift to subgraphErrors map[string]error, aggregation in appendSubgraphErrors keyed by ds.Name, and the deterministic SubgraphErrors() implementation (sorted keys + errors.Join) all align well with the goal of scoping errors to the correct subgraph and making results idempotent across calls. NewContext initializing the map and the defensive nil check in appendSubgraphErrors plus the deep-copy in clone together make this robust.

One small, optional refinement: to avoid storing entries whose combined error is nil and to skip an extra Join when all provided errs are nil, you could early‑out:

 func (c *Context) appendSubgraphErrors(ds DataSourceInfo, errs ...error) {
 	if c.subgraphErrors == nil {
 		c.subgraphErrors = make(map[string]error)
 	}
-	c.subgraphErrors[ds.Name] = errors.Join(c.subgraphErrors[ds.Name], errors.Join(errs...))
+	joinedErr := errors.Join(errs...)
+	if joinedErr == nil {
+		return
+	}
+	c.subgraphErrors[ds.Name] = errors.Join(c.subgraphErrors[ds.Name], joinedErr)
 }

This keeps the public behaviour of SubgraphErrors() the same while slightly reducing unnecessary allocations and map entries for subgraphs that never actually produced a non‑nil error.

Also applies to: 35-36, 141-165, 172-179, 213-218


186-193: Confirm whether WithContext should also deep‑copy subgraphErrors like clone does

clone now creates an independent subgraphErrors map:

if c.subgraphErrors != nil {
	cpy.subgraphErrors = make(map[string]error, len(c.subgraphErrors))
	for k, v := range c.subgraphErrors {
		cpy.subgraphErrors[k] = v
	}
}

but WithContext still does a shallow struct copy:

cpy := *c
cpy.ctx = ctx
return &cpy

which means any WithContext result shares the same subgraphErrors map with the original Context. That may be intentional (same logical request, different base context.Context) or it may be surprising, given that clone now isolates the map.

If you want WithContext to behave like clone w.r.t. subgraph errors, you could mirror the same map copy there:

func (c *Context) WithContext(ctx context.Context) *Context {
	if ctx == nil {
		panic("nil context.Context")
	}
	cpy := *c
	cpy.ctx = ctx
+	if c.subgraphErrors != nil {
+		cpy.subgraphErrors = make(map[string]error, len(c.subgraphErrors))
+		for k, v := range c.subgraphErrors {
+			cpy.subgraphErrors[k] = v
+		}
+	}
	return &cpy
}

Worth double‑checking usages of WithContext to ensure the current sharing vs. proposed copying matches the intended lifecycle of per‑subgraph error state.

Also applies to: 213-218

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c8b7e58 and 56cc568.

📒 Files selected for processing (1)
  • v2/pkg/engine/resolve/context.go (5 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
v2/pkg/engine/resolve/context.go (1)
v2/pkg/engine/resolve/loader.go (1)
  • DataSourceInfo (45-48)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build and test (go 1.25 / ubuntu-latest)
  • GitHub Check: Build and test (go 1.25 / windows-latest)

Copy link
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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 56cc568 and 0066a1c.

📒 Files selected for processing (1)
  • v2/pkg/engine/resolve/context.go (5 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
v2/pkg/engine/resolve/context.go (1)
v2/pkg/engine/resolve/loader.go (1)
  • DataSourceInfo (45-48)
🪛 GitHub Actions: v2-ci
v2/pkg/engine/resolve/context.go

[error] 161-161: panic: assignment to entry in nil map during TestAuthorization (disallow_root_fetch).

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build and test (go 1.25 / ubuntu-latest)
🔇 Additional comments (5)
v2/pkg/engine/resolve/context.go (5)

9-9: LGTM!

The sort package is correctly imported to enable deterministic ordering of subgraph errors.


35-35: LGTM!

The field type change from error to map[string]error correctly implements per-subgraph error tracking.


141-158: LGTM!

The refactored SubgraphErrors() method correctly returns a deterministically ordered aggregation of per-subgraph errors. The nil check, sorting, and error joining logic are all properly implemented.


174-175: LGTM!

The map initialization in NewContext is correct. However, as noted in the past comments and confirmed by the pipeline failure, not all Context instances are created via NewContext(), which is why defensive initialization is needed in appendSubgraphErrors.


210-216: LGTM!

The map cloning logic correctly performs a defensive nil check and deep copy to prevent shared references.

Copy link
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: 0

🧹 Nitpick comments (1)
v2/pkg/engine/resolve/resolve_test.go (1)

165-2250: Consistent subgraphErrors initialization looks good; consider a tiny helper to reduce repetition

All the updated Context literals that now include subgraphErrors: make(map[string]error) are correct and help ensure any write-path into subgraphErrors can’t panic on a nil map. From a maintenance angle, you might eventually want a small test helper (e.g. newTestContext() returning a Context with ctx: context.Background() and subgraphErrors initialized) to avoid touching dozens of call sites every time Context grows a new field. Not required for this PR, just an optional clean‑up for later.

Also applies to: 1431-2250

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0066a1c and 6dee1a6.

📒 Files selected for processing (7)
  • v2/pkg/engine/resolve/authorization_test.go (14 hunks)
  • v2/pkg/engine/resolve/extensions_test.go (5 hunks)
  • v2/pkg/engine/resolve/loader_hooks_test.go (13 hunks)
  • v2/pkg/engine/resolve/loader_test.go (7 hunks)
  • v2/pkg/engine/resolve/ratelimit_test.go (9 hunks)
  • v2/pkg/engine/resolve/resolve_federation_test.go (18 hunks)
  • v2/pkg/engine/resolve/resolve_test.go (62 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • v2/pkg/engine/resolve/authorization_test.go
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2025-10-16T13:05:19.838Z
Learnt from: Noroth
Repo: wundergraph/graphql-go-tools PR: 1323
File: v2/pkg/engine/datasource/grpc_datasource/compiler.go:683-702
Timestamp: 2025-10-16T13:05:19.838Z
Learning: In GraphQL field resolver context resolution (v2/pkg/engine/datasource/grpc_datasource/compiler.go), when traversing paths in resolveContextDataForPath, the code can safely assume that intermediate path segments will only be messages or lists, never scalars. This is because field resolvers are only defined on GraphQL object types, not scalar types, so the parent function must return either a message or a list. This invariant is enforced by the GraphQL type system design.

Applied to files:

  • v2/pkg/engine/resolve/resolve_test.go
📚 Learning: 2025-07-02T15:28:02.122Z
Learnt from: SkArchon
Repo: wundergraph/graphql-go-tools PR: 1203
File: v2/pkg/engine/resolve/loader.go:63-67
Timestamp: 2025-07-02T15:28:02.122Z
Learning: In the graphql-go-tools codebase, result structs are consistently initialized with non-nil bytes.Buffer instances, making additional nil checks for res.out unnecessary defensive programming.

Applied to files:

  • v2/pkg/engine/resolve/resolve_test.go
  • v2/pkg/engine/resolve/resolve_federation_test.go
📚 Learning: 2025-11-19T10:53:06.342Z
Learnt from: Noroth
Repo: wundergraph/graphql-go-tools PR: 1341
File: v2/pkg/engine/datasource/grpc_datasource/execution_plan.go:1039-1097
Timestamp: 2025-11-19T10:53:06.342Z
Learning: In v2/pkg/engine/datasource/grpc_datasource field resolver response handling, the `resolveRequiredFields` function intentionally uses two distinct approaches: for simple GraphQL object types it populates `message.Fields`, while for composite types (interface/union) it exclusively uses `message.FieldSelectionSet` with fragment-based selections. This differs from `buildFieldMessage` (regular queries) because field resolver responses returning composite types must align with protobuf oneOf structure, where all selections—including common interface fields—are handled through fragment selections built by `buildCompositeField`. The two approaches cannot be mixed in field resolver responses.

Applied to files:

  • v2/pkg/engine/resolve/resolve_test.go
📚 Learning: 2025-12-02T08:25:26.682Z
Learnt from: Noroth
Repo: wundergraph/graphql-go-tools PR: 1341
File: v2/pkg/engine/datasource/grpc_datasource/execution_plan.go:1053-1118
Timestamp: 2025-12-02T08:25:26.682Z
Learning: In v2/pkg/engine/datasource/grpc_datasource field resolver response handling for composite types (interface/union), buildFieldResolverTypeMessage correctly combines both message.Fields and message.FieldSelectionSet: message.Fields contains interface-level fields that can be selected directly on the interface (such as __typename or fields defined in the interface itself), while message.FieldSelectionSet contains type-specific fields from inline fragments. This mixing is intentional and correct for GraphQL interfaces, as interface-level fields exist outside inline fragment selections and must be handled separately from type-specific fragment selections.

Applied to files:

  • v2/pkg/engine/resolve/resolve_test.go
📚 Learning: 2025-11-19T09:42:17.644Z
Learnt from: Noroth
Repo: wundergraph/graphql-go-tools PR: 1341
File: v2/pkg/engine/datasource/grpc_datasource/execution_plan_visitor_federation.go:406-429
Timestamp: 2025-11-19T09:42:17.644Z
Learning: In the wundergraph/graphql-go-tools gRPC datasource implementation (v2/pkg/engine/datasource/grpc_datasource), field resolvers must have arguments. The system does not currently support defining field resolvers without arguments. This invariant ensures that the `parentCallID` increment in `enterFieldResolver` is always matched by a decrement in `LeaveField` (which checks `r.operation.FieldHasArguments(ref)`).

Applied to files:

  • v2/pkg/engine/resolve/resolve_test.go
📚 Learning: 2025-08-29T09:35:47.969Z
Learnt from: ysmolski
Repo: wundergraph/graphql-go-tools PR: 1282
File: v2/pkg/engine/plan/visitor.go:5-5
Timestamp: 2025-08-29T09:35:47.969Z
Learning: The wundergraph/graphql-go-tools project does not support Go versions < 1.23, so compatibility concerns for features available in Go 1.21+ (like cmp.Or) should not be raised.

Applied to files:

  • v2/pkg/engine/resolve/resolve_test.go
🧬 Code graph analysis (4)
v2/pkg/engine/resolve/extensions_test.go (1)
v2/pkg/engine/resolve/context.go (2)
  • Context (17-36)
  • RateLimitOptions (108-121)
v2/pkg/engine/resolve/ratelimit_test.go (1)
v2/pkg/engine/resolve/context.go (3)
  • Context (17-36)
  • RateLimitOptions (108-121)
  • RateLimitErrorExtensionCode (123-126)
v2/pkg/engine/resolve/resolve_test.go (1)
v2/pkg/engine/resolve/context.go (1)
  • Context (17-36)
v2/pkg/engine/resolve/loader_hooks_test.go (2)
v2/pkg/engine/resolve/loader.go (1)
  • LoaderHooks (38-43)
v2/pkg/engine/resolve/context.go (1)
  • Context (17-36)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build and test (go 1.25 / ubuntu-latest)
  • GitHub Check: Build and test (go 1.25 / ubuntu-latest)
  • GitHub Check: Build and test (go 1.25 / windows-latest)
🔇 Additional comments (5)
v2/pkg/engine/resolve/ratelimit_test.go (1)

58-58: Subgraph error map initialization in rate-limit tests is consistent and correct

All updated Context literals now initialize subgraphErrors with make(map[string]error), which aligns with the new per-subgraph error tracking and avoids nil-map writes during resolution. No further issues spotted in these tests.

Also applies to: 76-76, 92-92, 108-108, 124-124, 143-143, 168-168, 191-191, 214-214

v2/pkg/engine/resolve/extensions_test.go (1)

22-22: Context updates for extensions tests correctly wire subgraphErrors

The added subgraphErrors: make(map[string]error) on all Context literals used in TestExtensions matches the updated Context API and ensures downstream error aggregation can safely write per-subgraph errors. Everything looks consistent.

Also applies to: 47-47, 72-72, 94-94, 119-119

v2/pkg/engine/resolve/resolve_federation_test.go (1)

179-179: Federation tests correctly initialize Context.subgraphErrors across all scenarios

Each federation test now passes a Context with subgraphErrors: make(map[string]error), both for pointer and value contexts. This is in line with the new per-subgraph error tracking and avoids nil-map writes during parallel fetches. No issues found in these changes.

Also applies to: 370-370, 526-526, 672-672, 816-816, 1021-1021, 1102-1102, 1240-1240, 1521-1521, 1649-1649, 1777-1777, 1906-1906, 2148-2148, 2420-2420, 2692-2692, 2832-2832, 2989-2989

v2/pkg/engine/resolve/loader_test.go (1)

288-290: Loader tests and benchmark correctly updated for subgraphErrors

All loader tests and the benchmark now initialize subgraphErrors on the Contexts with make(map[string]error), matching the new Context shape and preventing nil-map writes during LoadGraphQLResponseData. Reusing a single Context in the benchmark remains safe given these scenarios are success paths. No further issues noted.

Also applies to: 377-380, 469-472, 751-755, 1028-1031, 1124-1127, 1427-1430

v2/pkg/engine/resolve/loader_hooks_test.go (1)

60-63: Loader hooks tests are correctly wired to the new subgraph error tracking

The updated resolve contexts used in loader-hooks tests now initialize subgraphErrors and, where applicable, LoaderHooks. This allows:

  • TestLoaderHooks to capture per-subgraph SubgraphError instances via ResponseInfo.Err, and
  • resolveCtx.SubgraphErrors() to return a non-nil aggregated error when subgraph errors occur.

The wiring is consistent across serial, parallel, and list-item fetch scenarios, and expectations around SubgraphError contents remain valid.

Also applies to: 135-138, 204-207, 270-273, 337-340, 428-428, 466-466, 504-504, 542-542, 580-580, 618-618, 656-656

@SkArchon SkArchon force-pushed the milinda/eng-8637-error-message-attached-to-multiple-unrelated-subgraphs branch from 6dee1a6 to 75ea694 Compare December 9, 2025 15:15
Copy link
Contributor

@ysmolski ysmolski left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@SkArchon SkArchon merged commit d65d348 into master Dec 10, 2025
11 checks passed
@SkArchon SkArchon deleted the milinda/eng-8637-error-message-attached-to-multiple-unrelated-subgraphs branch December 10, 2025 11:21
SkArchon pushed a commit that referenced this pull request Dec 10, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.0.0-rc.241](v2.0.0-rc.240...v2.0.0-rc.241)
(2025-12-10)


### Bug Fixes

* group subgraph errors by subgraph name
([#1351](#1351))
([d65d348](d65d348))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Fixed an issue where subgraph errors are now properly grouped by
subgraph name in v2.0.0-rc.241.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

4 participants