chore: propagate federated directive definitions, subgraph schema nod…#2325
chore: propagate federated directive definitions, subgraph schema nod…#2325
Conversation
…e, default deprecated arg
WalkthroughAdds tracking and propagation of directive definitions via a new Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
Comment |
Router image scan passed✅ No security vulnerabilities found in image: |
There was a problem hiding this comment.
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)
composition/src/federation/types.ts (1)
42-52: AdddirectiveDefinitionByNameto the contracts success result.
federateSubgraphsWithContractsnow spreads aFederationSuccessobject (which includesdirectiveDefinitionByName) into an object literal typed asFederationResultWithContractsSuccess. Because this type doesn’t listdirectiveDefinitionByName, TypeScript flags the return with “Object literal may only specify known properties”. Please add the field so the contracts success type stays aligned.export type FederationResultWithContractsSuccess = { + directiveDefinitionByName: Map<DirectiveName, DirectiveDefinitionNode>; fieldConfigurations: Array<FieldConfiguration>; federatedGraphAST: DocumentNode; federatedGraphClientSchema: GraphQLSchema;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
composition/package.json(1 hunks)composition/src/buildASTSchema/buildASTSchema.ts(1 hunks)composition/src/federation/types.ts(3 hunks)composition/src/schema-building/utils.ts(3 hunks)composition/src/v1/federation/federation-factory.ts(5 hunks)composition/src/v1/normalization/normalization-factory.ts(8 hunks)composition/tests/v1/directives/directives.test.ts(8 hunks)composition/tests/v1/directives/fieldset-directives.test.ts(2 hunks)composition/tests/v1/events.test.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: StarpTech
Repo: wundergraph/cosmo PR: 2142
File: helm/cosmo/Chart.yaml:0-0
Timestamp: 2025-08-15T10:21:45.838Z
Learning: In the WunderGraph Cosmo project, helm chart version upgrades and README badge synchronization are handled in separate helm release PRs, not in the initial version bump PRs.
📚 Learning: 2025-09-08T20:57:07.946Z
Learnt from: JivusAyrus
Repo: wundergraph/cosmo PR: 2156
File: controlplane/src/core/repositories/SubgraphRepository.ts:1746-1763
Timestamp: 2025-09-08T20:57:07.946Z
Learning: The checkSubgraphSchema.ts file already correctly implements linked subgraph functionality, using byName(linkedSubgraph.name, linkedSubgraph.namespace) to fetch target subgraphs and properly handles parse(newSchemaSDL) for schema building. The implementation doesn't need fixes for byId usage or schema parsing as it's already correct.
Applied to files:
composition/src/v1/normalization/normalization-factory.tscomposition/tests/v1/directives/fieldset-directives.test.tscomposition/tests/v1/directives/directives.test.ts
📚 Learning: 2025-08-20T10:08:17.857Z
Learnt from: endigma
Repo: wundergraph/cosmo PR: 2155
File: router/core/router.go:1857-1866
Timestamp: 2025-08-20T10:08:17.857Z
Learning: router/pkg/config/config.schema.json forbids null values for traffic_shaping.subgraphs: additionalProperties references $defs.traffic_shaping_subgraph_request_rule with type "object". Therefore, in core.NewSubgraphTransportOptions, dereferencing each subgraph rule pointer is safe under schema-validated configs, and a nil-check is unnecessary.
Applied to files:
composition/tests/v1/directives/directives.test.ts
🧬 Code graph analysis (5)
composition/src/federation/types.ts (1)
composition/src/types/types.ts (1)
DirectiveName(3-3)
composition/src/v1/normalization/normalization-factory.ts (4)
composition/src/utils/utils.ts (1)
getOrThrowError(26-32)composition/src/ast/utils.ts (2)
operationTypeNodeToDefaultType(164-168)stringToNamedTypeNode(100-105)composition/src/v1/normalization/walkers.ts (2)
upsertDirectiveSchemaAndEntityDefinitions(43-215)upsertParentsAndChildren(217-572)composition/src/buildASTSchema/buildASTSchema.ts (1)
buildASTSchema(26-72)
composition/src/schema-building/utils.ts (2)
composition/src/utils/string-constants.ts (2)
DEPRECATED(27-27)REASON(120-120)composition/src/ast/utils.ts (1)
stringToNameNode(77-82)
composition/tests/v1/directives/directives.test.ts (8)
composition/tests/utils/utils.ts (4)
normalizeSubgraphSuccess(36-46)schemaToSortedNormalizedString(23-25)normalizeString(19-21)federateSubgraphsSuccess(58-71)composition/src/router-compatibility-version/router-compatibility-version.ts (1)
ROUTER_COMPATIBILITY_VERSION_ONE(3-3)composition/tests/v1/utils/utils.ts (3)
SCHEMA_QUERY_DEFINITION(158-162)INACCESSIBLE_DIRECTIVE(50-53)TAG_DIRECTIVE(115-117)composition/src/types/types.ts (1)
DirectiveName(3-3)composition/src/utils/string-constants.ts (2)
INACCESSIBLE(67-67)TAG(153-153)composition/src/v1/constants/directive-definitions.ts (2)
INACCESSIBLE_DEFINITION(446-462)TAG_DEFINITION(709-735)composition/src/subgraph/types.ts (1)
Subgraph(11-15)composition/src/ast/utils.ts (1)
parse(272-274)
composition/src/v1/federation/federation-factory.ts (3)
composition/src/types/types.ts (2)
DirectiveName(3-3)TypeName(11-11)composition/src/schema-building/ast.ts (1)
MutableDefinitionNode(266-273)composition/src/warnings/types.ts (1)
Warning(9-17)
⏰ 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). (9)
- GitHub Check: build_push_image
- GitHub Check: build_push_image (nonroot)
- GitHub Check: integration_test (./telemetry)
- GitHub Check: integration_test (./events)
- GitHub Check: integration_test (./. ./fuzzquery ./lifecycle ./modules)
- GitHub Check: build_test
- GitHub Check: build_test
- GitHub Check: build_push_image
- GitHub Check: Analyze (go)
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
composition/tests/v1/directives/directives.test.ts(8 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-08T20:57:07.946Z
Learnt from: JivusAyrus
Repo: wundergraph/cosmo PR: 2156
File: controlplane/src/core/repositories/SubgraphRepository.ts:1746-1763
Timestamp: 2025-09-08T20:57:07.946Z
Learning: The checkSubgraphSchema.ts file already correctly implements linked subgraph functionality, using byName(linkedSubgraph.name, linkedSubgraph.namespace) to fetch target subgraphs and properly handles parse(newSchemaSDL) for schema building. The implementation doesn't need fixes for byId usage or schema parsing as it's already correct.
Applied to files:
composition/tests/v1/directives/directives.test.ts
📚 Learning: 2025-08-20T10:08:17.857Z
Learnt from: endigma
Repo: wundergraph/cosmo PR: 2155
File: router/core/router.go:1857-1866
Timestamp: 2025-08-20T10:08:17.857Z
Learning: router/pkg/config/config.schema.json forbids null values for traffic_shaping.subgraphs: additionalProperties references $defs.traffic_shaping_subgraph_request_rule with type "object". Therefore, in core.NewSubgraphTransportOptions, dereferencing each subgraph rule pointer is safe under schema-validated configs, and a nil-check is unnecessary.
Applied to files:
composition/tests/v1/directives/directives.test.ts
🧬 Code graph analysis (1)
composition/tests/v1/directives/directives.test.ts (7)
composition/tests/utils/utils.ts (4)
normalizeSubgraphSuccess(36-46)schemaToSortedNormalizedString(23-25)normalizeString(19-21)federateSubgraphsSuccess(58-71)composition/src/router-compatibility-version/router-compatibility-version.ts (1)
ROUTER_COMPATIBILITY_VERSION_ONE(3-3)composition/src/types/types.ts (1)
DirectiveName(3-3)composition/src/utils/string-constants.ts (2)
INACCESSIBLE(67-67)TAG(153-153)composition/src/v1/constants/directive-definitions.ts (2)
INACCESSIBLE_DEFINITION(446-462)TAG_DEFINITION(709-735)composition/src/subgraph/types.ts (1)
Subgraph(11-15)composition/src/ast/utils.ts (1)
parse(272-274)
⏰ 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). (16)
- GitHub Check: build_push_image
- GitHub Check: integration_test (./events)
- GitHub Check: build_push_image (nonroot)
- GitHub Check: build_test
- GitHub Check: integration_test (./. ./fuzzquery ./lifecycle ./modules)
- GitHub Check: image_scan (nonroot)
- GitHub Check: image_scan
- GitHub Check: integration_test (./telemetry)
- GitHub Check: build_push_image
- GitHub Check: build_test
- GitHub Check: build_push_image
- GitHub Check: build_test
- GitHub Check: build_test
- GitHub Check: build_test
- GitHub Check: Analyze (go)
- GitHub Check: Analyze (javascript-typescript)
…e, default deprecated arg
Summary by CodeRabbit
New Features
Chores
Tests
Checklist