Skip to content

chore: expose schema node in FederationSuccess#2330

Merged
Aenimus merged 3 commits intomainfrom
david/eng-8464-expose-schema-node-in-fed-result
Nov 13, 2025
Merged

chore: expose schema node in FederationSuccess#2330
Aenimus merged 3 commits intomainfrom
david/eng-8464-expose-schema-node-in-fed-result

Conversation

@Aenimus
Copy link
Copy Markdown
Member

@Aenimus Aenimus commented Nov 13, 2025

Summary by CodeRabbit

  • New Features

    • Schema node information is now preserved and surfaced in per‑subgraph configuration, improving access to GraphQL schema definitions.
  • Refactor

    • Improved type safety across public data structures by replacing generic identifiers with domain-specific type aliases (for subgraph, type, and field names).
  • Tests

    • Tests updated to validate schema node propagation in federation/normalization results.

Checklist

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 13, 2025

Walkthrough

Replaces string-based name aliases with typed aliases (SubgraphName, TypeName, FieldName), adds an optional schemaNode (SchemaDefinitionNode | SchemaExtensionNode) to subgraph types and results, and threads schemaNode through normalization and federation result construction.

Changes

Cohort / File(s) Summary
Type Definition Updates
composition/src/subgraph/types.ts
Changed Subgraph.name and related map key/value types to typed aliases (SubgraphName, TypeName, FieldName); added optional schemaNode: SchemaDefinitionNode | SchemaExtensionNode to SubgraphConfig and InternalSubgraph; updated GraphQL/type imports.
Federation Factory Updates
composition/src/v1/federation/federation-factory.ts
Switched internal maps to Map<SubgraphName, ...>; iterate/destructure internalSubgraphBySubgraphName.values() to extract name, schema, schemaNode, etc.; populate subgraphConfigBySubgraphName as Map<SubgraphName, SubgraphConfig> and include schemaNode.
Normalization Factory Updates
composition/src/v1/normalization/normalization-factory.ts
Replaced many Map<string,...>/Set<string> signatures with TypeName/SubgraphName/FieldName aliases; propagate normalizationResult.schemaNode into internalSubgraphBySubgraphName and include schemaNode in the final BatchNormalizationResult.
Tests
composition/tests/v1/federation-factory.test.ts
Updated imports to include stringToNamedTypeNode/stringToNameNode; tests now read subgraphConfigBySubgraphName from federation result and assert presence and schemaNode contents for a subgraph.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas needing extra attention:
    • All call sites and map lookups that switched keys to SubgraphName / values to TypeName/FieldName to ensure type-consistent .get()/.set() usage.
    • Proper propagation and typing of schemaNode through normalization → internal subgraph structures → federation result.
    • Test updates and fixtures verifying schemaNode shape (SchemaDefinitionNode vs SchemaExtensionNode).

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ 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 accurately describes the main objective of the PR: exposing the schema node in the FederationSuccess result type, which aligns with the extensive changes across type definitions, factory implementations, and test updates.
✨ Finishing touches
  • 📝 Generate docstrings

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 13, 2025

Router image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-ac2d41c2afbce9ad0c7c91bdfb561dfce5c324bc

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)
composition/src/v1/federation/federation-factory.ts (1)

3189-3197: Inconsistency: schemaNode missing from contract federation result.

The buildFederationContractResult method constructs subgraphConfigBySubgraphName entries (lines 3191-3197) without including the schemaNode field, unlike buildFederationResult (lines 2897-2903). This creates an inconsistency where the schema node is exposed for regular federation but not for contract federation.

Consider updating this section to include schemaNode:

     for (const subgraph of this.internalSubgraphBySubgraphName.values()) {
       subgraphConfigBySubgraphName.set(subgraph.name, {
         configurationDataByTypeName: subgraph.configurationDataByTypeName,
         directiveDefinitionByName: subgraph.directiveDefinitionByName,
         isVersionTwo: subgraph.isVersionTwo,
         parentDefinitionDataByTypeName: subgraph.parentDefinitionDataByTypeName,
         schema: subgraph.schema,
+        schemaNode: subgraph.schemaNode,
       });
     }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 46b15a7 and a0b37fd.

📒 Files selected for processing (4)
  • composition/src/subgraph/types.ts (3 hunks)
  • composition/src/v1/federation/federation-factory.ts (2 hunks)
  • composition/src/v1/normalization/normalization-factory.ts (2 hunks)
  • composition/tests/v1/federation-factory.test.ts (3 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
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.
📚 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/subgraph/types.ts
  • composition/tests/v1/federation-factory.test.ts
  • composition/src/v1/federation/federation-factory.ts
  • composition/src/v1/normalization/normalization-factory.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/src/subgraph/types.ts
  • composition/src/v1/federation/federation-factory.ts
📚 Learning: 2025-08-29T10:28:04.846Z
Learnt from: JivusAyrus
Repo: wundergraph/cosmo PR: 2156
File: controlplane/src/core/repositories/SubgraphRepository.ts:1749-1751
Timestamp: 2025-08-29T10:28:04.846Z
Learning: In the controlplane codebase, authentication and authorization checks (including organization scoping) are handled at the service layer in files like unlinkSubgraph.ts before calling repository methods. Repository methods like unlinkSubgraph() in SubgraphRepository.ts can focus purely on data operations without redundant security checks.

Applied to files:

  • composition/src/v1/federation/federation-factory.ts
🧬 Code graph analysis (4)
composition/src/subgraph/types.ts (3)
connect/src/wg/cosmo/node/v1/node_pb.ts (1)
  • Subgraph (249-293)
connect-go/gen/proto/wg/cosmo/node/v1/node.pb.go (3)
  • Subgraph (430-438)
  • Subgraph (453-453)
  • Subgraph (468-470)
router/gen/proto/wg/cosmo/node/v1/node.pb.go (3)
  • Subgraph (430-438)
  • Subgraph (453-453)
  • Subgraph (468-470)
composition/tests/v1/federation-factory.test.ts (3)
composition/tests/utils/utils.ts (1)
  • federateSubgraphsSuccess (58-71)
composition/src/router-compatibility-version/router-compatibility-version.ts (1)
  • ROUTER_COMPATIBILITY_VERSION_ONE (3-3)
composition/src/ast/utils.ts (1)
  • stringToNamedTypeNode (100-105)
composition/src/v1/federation/federation-factory.ts (3)
composition/src/resolvability-graph/types/types.ts (1)
  • SubgraphName (13-13)
composition/src/types/types.ts (1)
  • SubgraphName (9-9)
composition/src/subgraph/types.ts (2)
  • InternalSubgraph (27-43)
  • SubgraphConfig (18-25)
composition/src/v1/normalization/normalization-factory.ts (3)
composition/src/resolvability-graph/types/types.ts (3)
  • TypeName (15-15)
  • SubgraphName (13-13)
  • FieldName (7-7)
composition/src/schema-building/types.ts (3)
  • AuthorizationData (309-315)
  • EntityData (268-275)
  • ParentDefinitionData (242-248)
composition/src/subgraph/types.ts (1)
  • InternalSubgraph (27-43)
⏰ 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). (15)
  • GitHub Check: integration_test (./events)
  • GitHub Check: integration_test (./telemetry)
  • GitHub Check: integration_test (./. ./fuzzquery ./lifecycle ./modules)
  • GitHub Check: build_test
  • GitHub Check: image_scan (nonroot)
  • GitHub Check: image_scan
  • GitHub Check: build_push_image
  • GitHub Check: build_push_image (nonroot)
  • GitHub Check: build_test
  • GitHub Check: build_push_image
  • GitHub Check: build_test
  • GitHub Check: build_push_image
  • GitHub Check: build_test
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (8)
composition/src/subgraph/types.ts (3)

9-10: LGTM! Clean import additions for schema node support.

The new imports properly support the schema node fields being added to the subgraph types.


14-14: LGTM! Type refinement improves consistency.

Using SubgraphName instead of string provides better type clarity throughout the codebase.


24-24: LGTM! Schema node fields properly added.

The optional schemaNode fields are appropriately typed and will allow propagation of schema definition/extension information through the federation pipeline.

Also applies to: 41-41

composition/tests/v1/federation-factory.test.ts (2)

16-17: LGTM! Test imports are appropriate.

The imported utilities are needed for the new schema node assertions.


1028-1068: LGTM! Test coverage validates schema node propagation.

The new test assertions properly verify that:

  1. subgraphConfigBySubgraphName is returned from federation
  2. The schemaNode field is present and correctly structured
  3. The schema definition includes the expected query operation type
composition/src/v1/federation/federation-factory.ts (2)

271-271: LGTM! Type refinement is consistent with subgraph types.

The change from Map<string, InternalSubgraph> to Map<SubgraphName, InternalSubgraph> aligns with the type updates in the subgraph types file.


2887-2904: LGTM! Schema node properly propagated in federation result.

The changes correctly:

  1. Update the map type to use SubgraphName keys
  2. Destructure schemaNode from internal subgraphs
  3. Include schemaNode in the subgraph config entries

This ensures the schema node information is available in the federation success result.

composition/src/v1/normalization/normalization-factory.ts (1)

3886-3903: LGTM! Type aliases and schemaNode propagation correctly implemented.

The typed aliases for overriddenFieldNamesByParentTypeName (line 3896) provide better semantic clarity, and the schemaNode propagation (line 3901) correctly threads the schema node from normalization results into the internal subgraph structure, aligning with the PR objectives.

Comment thread composition/src/v1/normalization/normalization-factory.ts 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: 0

🧹 Nitpick comments (3)
composition/src/v1/normalization/normalization-factory.ts (1)

3896-3896: Consistency nit: align InternalSubgraph override map typing.

You initialize overriddenFieldNamesByParentTypeName as Map<TypeName, Set> here, while InternalSubgraph currently declares Map<string, Set>. Consider updating the type in composition/src/subgraph/types.ts to Map<TypeName, Set> to avoid drift.

composition/src/v1/federation/federation-factory.ts (2)

2887-2904: Expose schemaNode in subgraph config — LGTM.

Correctly threads name/schema/schemaNode and typed maps into subgraphConfigBySubgraphName.

If desired, extract this population into a small helper to reuse below and avoid duplication.


3190-3206: <!-- [scratchpad_start]
[task verify_review_comment_federation_factory]
[observations]

  • Base path (lines ~2887-2904) and contract path (lines ~3189-3207) both:
    • Create subgraphConfigBySubgraphName: Map<SubgraphName, SubgraphConfig>()
    • Loop over this.internalSubgraphBySubgraphName.values()
    • Destructure identical properties including schemaNode
    • Set into map with identical 6-property object
  • Base path uses shorthand: schemaNode, at end
  • Contract path uses verbose: schemaNode: schemaNode,
  • "as above" refers to base path pattern that appears ~300 lines earlier
  • SubgraphConfig type properly includes schemaNode?: SchemaDefinitionNode | SchemaExtensionNode;
  • No downstream usage of .schemaNode from these config objects found

[analysis]

  • Code is functionally correct; no issues or bugs detected
  • schemaNode properly exposed in both paths
  • True duplication: identical 42-line block repeated (Map creation + loop + object construction)
  • Optional refactor suggestion valid: extract shared helper to reduce duplication
  • Review intent: approve with optional improvement suggestion
  • This is NOT a critical issue; code works as-is

[pending]
None - verification complete

[actions]
Generate final rewritten comment with tag

[done]

  • Verified both paths handle schemaNode identically
  • Confirmed no critical issues
  • Identified duplication opportunity (optional)
  • Review is approval with optional suggestion
    </scratchpad_end] -->

Consider extracting a shared helper to reduce duplication between base and contract paths.

Both code paths populate subgraphConfigBySubgraphName identically—the same loop and object structure repeat at lines ~2887–2904 and ~3189–3207. Extract this into a private helper method to DRY the code.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a0b37fd and ccfa6e1.

📒 Files selected for processing (2)
  • composition/src/v1/federation/federation-factory.ts (3 hunks)
  • composition/src/v1/normalization/normalization-factory.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
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.
📚 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/federation/federation-factory.ts
  • composition/src/v1/normalization/normalization-factory.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/src/v1/federation/federation-factory.ts
📚 Learning: 2025-08-29T10:28:04.846Z
Learnt from: JivusAyrus
Repo: wundergraph/cosmo PR: 2156
File: controlplane/src/core/repositories/SubgraphRepository.ts:1749-1751
Timestamp: 2025-08-29T10:28:04.846Z
Learning: In the controlplane codebase, authentication and authorization checks (including organization scoping) are handled at the service layer in files like unlinkSubgraph.ts before calling repository methods. Repository methods like unlinkSubgraph() in SubgraphRepository.ts can focus purely on data operations without redundant security checks.

Applied to files:

  • composition/src/v1/federation/federation-factory.ts
🧬 Code graph analysis (2)
composition/src/v1/federation/federation-factory.ts (3)
composition/src/resolvability-graph/types/types.ts (1)
  • SubgraphName (13-13)
composition/src/types/types.ts (1)
  • SubgraphName (9-9)
composition/src/subgraph/types.ts (2)
  • InternalSubgraph (27-43)
  • SubgraphConfig (18-25)
composition/src/v1/normalization/normalization-factory.ts (3)
composition/src/resolvability-graph/types/types.ts (3)
  • TypeName (15-15)
  • SubgraphName (13-13)
  • FieldName (7-7)
composition/src/schema-building/types.ts (3)
  • AuthorizationData (309-315)
  • EntityData (268-275)
  • ParentDefinitionData (242-248)
composition/src/subgraph/types.ts (1)
  • InternalSubgraph (27-43)
⏰ 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). (13)
  • GitHub Check: build_push_image
  • GitHub Check: build_test
  • GitHub Check: build_test
  • GitHub Check: build_push_image
  • GitHub Check: build_push_image (nonroot)
  • GitHub Check: image_scan (nonroot)
  • GitHub Check: image_scan
  • GitHub Check: build_push_image
  • GitHub Check: integration_test (./. ./fuzzquery ./lifecycle ./modules)
  • GitHub Check: build_test
  • GitHub Check: build_test
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
🔇 Additional comments (5)
composition/src/v1/normalization/normalization-factory.ts (4)

3807-3810: Good: stronger typed maps for aggregated state.

Switch to Map<TypeName/...> improves intent without behavior change. LGTM.


3814-3818: Resolved: correct type for error message list.

invalidNameErrorMessages now string[], which matches its contents. Thanks for fixing.


3820-3820: Good: typed fieldCoords map.

Map<TypeName, Set> aligns with downstream consumers.


3901-3902: Test coverage gap confirmed; SchemaExtensionNode (directives-only) path lacks test assertions.

The normalization-factory.ts code at lines 3486-3505 handles both SchemaDefinitionNode (when operationTypes exist) and SchemaExtensionNode (directives-only, lines 3496-3499). The test suite covers only the SchemaDefinitionNode case (federation-factory.test.ts line 1057). No tests validate the SchemaExtensionNode path.

Note: Lines 3500-3504 in the source file contain a TODO comment flagging that pushing the SchemaExtensionNode to definitions "currently breaks engine"—verify whether this test gap is intentional due to engine limitations or requires implementation.

composition/src/v1/federation/federation-factory.ts (1)

271-271: Good: key type tightened to SubgraphName.

Improves clarity; no behavioral change. LGTM.

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

🧹 Nitpick comments (1)
composition/src/v1/federation/federation-factory.ts (1)

2887-2905: Consider extracting duplicated subgraph config building logic.

The logic for building subgraphConfigBySubgraphName is duplicated between buildFederationResult (lines 2887-2905) and buildFederationContractResult (lines 3189-3207).

Consider extracting this into a helper method:

private buildSubgraphConfigMap(): Map<SubgraphName, SubgraphConfig> {
  const subgraphConfigBySubgraphName = new Map<SubgraphName, SubgraphConfig>();
  for (const {
    configurationDataByTypeName,
    directiveDefinitionByName,
    isVersionTwo,
    name,
    parentDefinitionDataByTypeName,
    schema,
    schemaNode,
  } of this.internalSubgraphBySubgraphName.values()) {
    subgraphConfigBySubgraphName.set(name, {
      configurationDataByTypeName,
      directiveDefinitionByName,
      isVersionTwo,
      parentDefinitionDataByTypeName,
      schema,
      schemaNode,
    });
  }
  return subgraphConfigBySubgraphName;
}

Then call it in both methods:

const subgraphConfigBySubgraphName = this.buildSubgraphConfigMap();

Also applies to: 3189-3207

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ccfa6e1 and 4d0718e.

📒 Files selected for processing (2)
  • composition/src/subgraph/types.ts (3 hunks)
  • composition/src/v1/federation/federation-factory.ts (3 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
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.
📚 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/subgraph/types.ts
  • composition/src/v1/federation/federation-factory.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/src/v1/federation/federation-factory.ts
📚 Learning: 2025-08-29T10:28:04.846Z
Learnt from: JivusAyrus
Repo: wundergraph/cosmo PR: 2156
File: controlplane/src/core/repositories/SubgraphRepository.ts:1749-1751
Timestamp: 2025-08-29T10:28:04.846Z
Learning: In the controlplane codebase, authentication and authorization checks (including organization scoping) are handled at the service layer in files like unlinkSubgraph.ts before calling repository methods. Repository methods like unlinkSubgraph() in SubgraphRepository.ts can focus purely on data operations without redundant security checks.

Applied to files:

  • composition/src/v1/federation/federation-factory.ts
🧬 Code graph analysis (2)
composition/src/subgraph/types.ts (5)
connect/src/wg/cosmo/node/v1/node_pb.ts (1)
  • Subgraph (249-293)
connect-go/gen/proto/wg/cosmo/node/v1/node.pb.go (3)
  • Subgraph (430-438)
  • Subgraph (453-453)
  • Subgraph (468-470)
router/gen/proto/wg/cosmo/node/v1/node.pb.go (3)
  • Subgraph (430-438)
  • Subgraph (453-453)
  • Subgraph (468-470)
composition/src/schema-building/types.ts (2)
  • ParentDefinitionData (242-248)
  • PersistedDirectiveDefinitionData (193-200)
composition/src/types/types.ts (1)
  • DirectiveName (3-3)
composition/src/v1/federation/federation-factory.ts (3)
composition/src/resolvability-graph/types/types.ts (1)
  • SubgraphName (13-13)
composition/src/types/types.ts (1)
  • SubgraphName (9-9)
composition/src/subgraph/types.ts (2)
  • InternalSubgraph (27-43)
  • SubgraphConfig (18-25)
⏰ 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). (14)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
  • GitHub Check: build_test
  • GitHub Check: build_push_image
  • GitHub Check: build_test
  • GitHub Check: build_push_image
  • GitHub Check: build_push_image
  • GitHub Check: build_test
  • GitHub Check: image_scan
  • GitHub Check: build_push_image (nonroot)
  • GitHub Check: image_scan (nonroot)
  • GitHub Check: integration_test (./. ./fuzzquery ./lifecycle ./modules)
  • GitHub Check: integration_test (./telemetry)
  • GitHub Check: build_test
🔇 Additional comments (5)
composition/src/subgraph/types.ts (3)

9-10: LGTM! Clean import additions for type safety.

The new imports support the typed aliases (SubgraphName, TypeName, FieldName) and the schema node feature (SchemaDefinitionNode, SchemaExtensionNode), aligning with the PR objective.


12-25: LGTM! Type improvements and schema node exposure.

The changes correctly:

  1. Replace plain string with SubgraphName type alias for better semantic typing
  2. Add optional schemaNode field to SubgraphConfig, enabling downstream consumers to access schema definition nodes

The optional nature of schemaNode is appropriate since not all schemas explicitly define a schema node.


27-43: LGTM! Consistent type refinements across InternalSubgraph.

The changes introduce:

  1. TypeName for map keys in keyFieldNamesByParentTypeName (line 34)
  2. FieldName for set values in overriddenFieldNamesByParentTypeName (line 37)
  3. Optional schemaNode field (line 41)

These refinements improve type safety and consistency with the rest of the codebase while exposing the schema node as intended by the PR.

composition/src/v1/federation/federation-factory.ts (2)

271-271: LGTM! Type refinement for better semantic clarity.

Changing the map key type from string to SubgraphName improves type safety and aligns with the typed aliases introduced in composition/src/subgraph/types.ts.


2887-2905: LGTM! Clean destructuring pattern exposes schema node.

The changes correctly:

  1. Use typed Map<SubgraphName, SubgraphConfig> instead of Map<string, SubgraphConfig>
  2. Destructure fields from internal subgraphs for clarity
  3. Include schemaNode in the returned SubgraphConfig objects (line 2903), fulfilling the PR objective
  4. Use the extracted name field as the map key

The destructuring pattern makes the field extraction explicit and improves code readability.

@Aenimus Aenimus merged commit aeb3cfc into main Nov 13, 2025
43 of 44 checks passed
@Aenimus Aenimus deleted the david/eng-8464-expose-schema-node-in-fed-result branch November 13, 2025 13:47
@coderabbitai coderabbitai Bot mentioned this pull request Feb 27, 2026
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.

2 participants